修复循环引用的问题
This commit is contained in:
parent
5cc4258ba2
commit
3c1e0531de
|
|
@ -241,7 +241,7 @@ void HlsPlayerImp::onPacket(const char *data,uint64_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_decoder) {
|
if (!_decoder) {
|
||||||
_decoder = DecoderImp::createDecoder(DecoderImp::decoder_ts, dynamic_pointer_cast<HlsPlayerImp>(shared_from_this()));
|
_decoder = DecoderImp::createDecoder(DecoderImp::decoder_ts, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_decoder) {
|
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);
|
auto decoder = createDecoder_l(type);
|
||||||
if(!decoder){
|
if(!decoder){
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
@ -54,7 +54,7 @@ int DecoderImp::input(const uint8_t *data, int bytes){
|
||||||
return _decoder->input(data, 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;
|
_decoder = decoder;
|
||||||
_sink = sink;
|
_sink = sink;
|
||||||
_decoder->setOnDecode([this](int stream,int codecid,int flags,int64_t pts,int64_t dts,const void *data,int bytes){
|
_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;
|
typedef std::shared_ptr<DecoderImp> Ptr;
|
||||||
~DecoderImp() = default;
|
~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);
|
int input(const uint8_t *data, int bytes);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -61,12 +61,12 @@ protected:
|
||||||
void onFrame(const Frame::Ptr &frame);
|
void onFrame(const Frame::Ptr &frame);
|
||||||
|
|
||||||
private:
|
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);
|
void onDecode(int stream,int codecid,int flags,int64_t pts,int64_t dts,const void *data,int bytes);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Decoder::Ptr _decoder;
|
Decoder::Ptr _decoder;
|
||||||
MediaSinkInterface::Ptr _sink;
|
MediaSinkInterface *_sink;
|
||||||
FrameMerger _merger;
|
FrameMerger _merger;
|
||||||
int _codecid_video = 0;
|
int _codecid_video = 0;
|
||||||
int _codecid_audio = 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)) {
|
if (checkTS(packet, bytes)) {
|
||||||
//猜测是ts负载
|
//猜测是ts负载
|
||||||
InfoP(this) << "judged to be TS";
|
InfoP(this) << "judged to be TS";
|
||||||
_decoder = DecoderImp::createDecoder(DecoderImp::decoder_ts, shared_from_this());
|
_decoder = DecoderImp::createDecoder(DecoderImp::decoder_ts, this);
|
||||||
} else {
|
} else {
|
||||||
//猜测是ps负载
|
//猜测是ps负载
|
||||||
InfoP(this) << "judged to be PS";
|
InfoP(this) << "judged to be PS";
|
||||||
_decoder = DecoderImp::createDecoder(DecoderImp::decoder_ps, shared_from_this());
|
_decoder = DecoderImp::createDecoder(DecoderImp::decoder_ps, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue