Commit 9bf48567 by cqm

fixed issue #2874, thanks quxiaohui-debug

parent 75a31329
...@@ -89,7 +89,7 @@ bool RtcMediaSourceMuxer::inputFrame(const Frame::Ptr &frame) ...@@ -89,7 +89,7 @@ bool RtcMediaSourceMuxer::inputFrame(const Frame::Ptr &frame)
addTrack(track); addTrack(track);
if (!_audio_dec) return false; if (!_audio_dec) return false;
} }
if (readerCount()) { if (readerCount() || !_regist) {
_audio_dec->inputFrame(frame, true, false); _audio_dec->inputFrame(frame, true, false);
if (!_count) if (!_count)
InfoL << "start transcode " << frame->getCodecName() << "," << frame->pts() << "->Opus"; InfoL << "start transcode " << frame->getCodecName() << "," << frame->pts() << "->Opus";
...@@ -108,6 +108,11 @@ bool RtcMediaSourceMuxer::inputFrame(const Frame::Ptr &frame) ...@@ -108,6 +108,11 @@ bool RtcMediaSourceMuxer::inputFrame(const Frame::Ptr &frame)
} }
#if defined(ENABLE_FFMPEG) #if defined(ENABLE_FFMPEG)
void RtcMediaSourceMuxer::onRegist(MediaSource &sender, bool regist)
{
MediaSourceEventInterceptor::onRegist(sender, regist);
_regist = regist;
}
bool RtcMediaSourceMuxer::addTrack(const Track::Ptr & track) bool RtcMediaSourceMuxer::addTrack(const Track::Ptr & track)
{ {
......
...@@ -46,11 +46,13 @@ public: ...@@ -46,11 +46,13 @@ public:
#if defined(ENABLE_FFMPEG) #if defined(ENABLE_FFMPEG)
~RtcMediaSourceMuxer() override{resetTracks();} ~RtcMediaSourceMuxer() override{resetTracks();}
void onRegist(MediaSource &sender, bool regist) override;
bool addTrack(const Track::Ptr & track) override; bool addTrack(const Track::Ptr & track) override;
void resetTracks() override; void resetTracks() override;
private: private:
int _count = 0; int _count = 0;
bool _regist = false;
std::shared_ptr<FFmpegDecoder> _audio_dec; std::shared_ptr<FFmpegDecoder> _audio_dec;
std::shared_ptr<FFmpegEncoder> _audio_enc; std::shared_ptr<FFmpegEncoder> _audio_enc;
#endif #endif
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论