From 7e4010df83ffd9b513daaea02f93b53f77a26716 Mon Sep 17 00:00:00 2001 From: Kiki Date: Thu, 18 May 2023 16:35:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DstartSendRtp=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3gop=E7=BC=93=E5=AD=98=E5=8A=9F=E8=83=BD=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E5=A4=B1=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98=20(#2455?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 如果帧序列为SPS PPS SEI IDR,那么GOP缓存会从IDR开始,导致解码器未获取到SPS PPS从而不能秒开 --- src/Common/MultiMediaSourceMuxer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Common/MultiMediaSourceMuxer.cpp b/src/Common/MultiMediaSourceMuxer.cpp index daa68769..440adcc1 100644 --- a/src/Common/MultiMediaSourceMuxer.cpp +++ b/src/Common/MultiMediaSourceMuxer.cpp @@ -327,7 +327,6 @@ EventPoller::Ptr MultiMediaSourceMuxer::getOwnerPoller(MediaSource &sender) { } bool MultiMediaSourceMuxer::onTrackReady(const Track::Ptr &track) { - bool ret = false; if (_rtmp) { ret = _rtmp->addTrack(track) ? true : ret; @@ -471,7 +470,9 @@ bool MultiMediaSourceMuxer::onTrackFrame(const Frame::Ptr &frame_in) { // 视频时,遇到第一帧配置帧或关键帧则标记为gop开始处 auto video_key_pos = frame->keyFrame() || frame->configFrame(); _ring->write(frame, video_key_pos && !_video_key_pos); - _video_key_pos = video_key_pos; + if (!frame->dropAble()) { + _video_key_pos = video_key_pos; + } } else { // 没有视频时,设置is_key为true,目的是关闭gop缓存 _ring->write(frame, !haveVideo());