fixed issue #2874, thanks quxiaohui-debug

This commit is contained in:
cqm 2023-10-16 09:32:26 +08:00
parent 75a3132964
commit 9bf48567b2
2 changed files with 8 additions and 1 deletions

View File

@ -89,7 +89,7 @@ bool RtcMediaSourceMuxer::inputFrame(const Frame::Ptr &frame)
addTrack(track);
if (!_audio_dec) return false;
}
if (readerCount()) {
if (readerCount() || !_regist) {
_audio_dec->inputFrame(frame, true, false);
if (!_count)
InfoL << "start transcode " << frame->getCodecName() << "," << frame->pts() << "->Opus";
@ -108,6 +108,11 @@ bool RtcMediaSourceMuxer::inputFrame(const Frame::Ptr &frame)
}
#if defined(ENABLE_FFMPEG)
void RtcMediaSourceMuxer::onRegist(MediaSource &sender, bool regist)
{
MediaSourceEventInterceptor::onRegist(sender, regist);
_regist = regist;
}
bool RtcMediaSourceMuxer::addTrack(const Track::Ptr & track)
{

View File

@ -46,11 +46,13 @@ public:
#if defined(ENABLE_FFMPEG)
~RtcMediaSourceMuxer() override{resetTracks();}
void onRegist(MediaSource &sender, bool regist) override;
bool addTrack(const Track::Ptr & track) override;
void resetTracks() override;
private:
int _count = 0;
bool _regist = false;
std::shared_ptr<FFmpegDecoder> _audio_dec;
std::shared_ptr<FFmpegEncoder> _audio_enc;
#endif