Commit 3c1e0531 by xiongziliang

修复循环引用的问题

parent 5cc4258b
......@@ -241,7 +241,7 @@ void HlsPlayerImp::onPacket(const char *data,uint64_t len) {
}
if (!_decoder) {
_decoder = DecoderImp::createDecoder(DecoderImp::decoder_ts, dynamic_pointer_cast<HlsPlayerImp>(shared_from_this()));
_decoder = DecoderImp::createDecoder(DecoderImp::decoder_ts, this);
}
if (_decoder) {
......
......@@ -42,7 +42,7 @@ static Decoder::Ptr createDecoder_l(DecoderImp::Type type) {
/////////////////////////////////////////////////////////////
DecoderImp::Ptr DecoderImp::createDecoder(Type type, const MediaSinkInterface::Ptr &sink){
DecoderImp::Ptr DecoderImp::createDecoder(Type type, MediaSinkInterface *sink){
auto decoder = createDecoder_l(type);
if(!decoder){
return nullptr;
......@@ -54,7 +54,7 @@ int DecoderImp::input(const uint8_t *data, int bytes){
return _decoder->input(data, bytes);
}
DecoderImp::DecoderImp(const Decoder::Ptr &decoder,const MediaSinkInterface::Ptr &sink){
DecoderImp::DecoderImp(const Decoder::Ptr &decoder, MediaSinkInterface *sink){
_decoder = decoder;
_sink = sink;
_decoder->setOnDecode([this](int stream,int codecid,int flags,int64_t pts,int64_t dts,const void *data,int bytes){
......
......@@ -53,7 +53,7 @@ public:
typedef std::shared_ptr<DecoderImp> Ptr;
~DecoderImp() = default;
static Ptr createDecoder(Type type, const MediaSinkInterface::Ptr &sink);
static Ptr createDecoder(Type type, MediaSinkInterface *sink);
int input(const uint8_t *data, int bytes);
protected:
......@@ -61,12 +61,12 @@ protected:
void onFrame(const Frame::Ptr &frame);
private:
DecoderImp(const Decoder::Ptr &decoder, const MediaSinkInterface::Ptr &sink);
DecoderImp(const Decoder::Ptr &decoder, MediaSinkInterface *sink);
void onDecode(int stream,int codecid,int flags,int64_t pts,int64_t dts,const void *data,int bytes);
private:
Decoder::Ptr _decoder;
MediaSinkInterface::Ptr _sink;
MediaSinkInterface *_sink;
FrameMerger _merger;
int _codecid_video = 0;
int _codecid_audio = 0;
......
......@@ -152,11 +152,11 @@ void RtpProcess::onRtpDecode(const uint8_t *packet, int bytes, uint32_t timestam
if (checkTS(packet, bytes)) {
//猜测是ts负载
InfoP(this) << "judged to be TS";
_decoder = DecoderImp::createDecoder(DecoderImp::decoder_ts, shared_from_this());
_decoder = DecoderImp::createDecoder(DecoderImp::decoder_ts, this);
} else {
//猜测是ps负载
InfoP(this) << "judged to be PS";
_decoder = DecoderImp::createDecoder(DecoderImp::decoder_ps, shared_from_this());
_decoder = DecoderImp::createDecoder(DecoderImp::decoder_ps, this);
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论