From 316301e910e094bdc4a51e33d90599a4a7a6af76 Mon Sep 17 00:00:00 2001 From: ziyue <1213642868@qq.com> Date: Mon, 1 Aug 2022 11:34:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A1=AE=E4=BF=9Drtsp=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E6=8B=89=E6=B5=81=E4=BB=A3=E7=90=86=E6=94=AF=E6=8C=81GOP?= =?UTF-8?q?=E7=BC=93=E5=AD=98:=20#1843?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtsp/RtspPlayerImp.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Rtsp/RtspPlayerImp.h b/src/Rtsp/RtspPlayerImp.h index bb3137c3..e2cdf6d4 100644 --- a/src/Rtsp/RtspPlayerImp.h +++ b/src/Rtsp/RtspPlayerImp.h @@ -79,11 +79,10 @@ private: } void onRecvRTP(RtpPacket::Ptr rtp, const SdpTrack::Ptr &track) override { - _demuxer->inputRtp(rtp); + //rtp解复用时可以判断是否为关键帧起始位置 + auto key_pos = _demuxer->inputRtp(rtp); if (_rtsp_media_src) { - // rtsp直接代理是无法判断该rtp是否是I帧,所以GOP缓存基本是无效的 - // 为了减少内存使用,那么我们设置为一直关键帧以便清空GOP缓存 - _rtsp_media_src->onWrite(std::move(rtp), true); + _rtsp_media_src->onWrite(std::move(rtp), key_pos); } }