修复只有aac的Rtmp流无法注册bug

This commit is contained in:
cqm 2023-07-27 17:59:50 +08:00
parent 442df29c83
commit 2adc12c4ab
2 changed files with 7 additions and 2 deletions

View File

@ -623,7 +623,7 @@ bool MultiMediaSourceMuxer::onTrackFrame(const Frame::Ptr &frame_in) {
}
else if (frame->getTrackType() == TrackAudio) {
if (rtmp) {
if (_audio_dec && rtmp->readerCount())
if (_audio_dec && (rtmp->readerCount() || !rtmp->isRegisted()))
_audio_dec->inputFrame(frame, true, false, false);
rtmp = nullptr;
}

View File

@ -43,7 +43,11 @@ public:
int readerCount() const{
return _media_src->readerCount();
}
bool isRegisted() const { return _is_registed; }
void onRegist(MediaSource& sender, bool regist) override {
MediaSourceEventInterceptor::onRegist(sender, regist);
_is_registed = regist;
}
void addTrackCompleted() override {
RtmpMuxer::addTrackCompleted();
makeConfigPacket();
@ -76,6 +80,7 @@ public:
private:
bool _enabled = true;
bool _is_registed = false;
bool _clear_cache = false;
ProtocolOption _option;
RtmpMediaSource::Ptr _media_src;