From 6ff5556b71162363d718428ec241b0efc5cd6410 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Mon, 4 Dec 2023 23:18:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B9=B3=E6=BB=91=E5=8F=91?= =?UTF-8?q?=E9=80=81=E9=80=BB=E8=BE=91=EF=BC=8C=E8=A7=A3=E5=86=B3=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=88=B3=E8=B7=B3=E5=8F=98=E5=AF=BC=E8=87=B4=E5=8F=91?= =?UTF-8?q?=E9=80=81=E4=B8=8D=E5=B9=B3=E6=BB=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Common/MultiMediaSourceMuxer.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Common/MultiMediaSourceMuxer.cpp b/src/Common/MultiMediaSourceMuxer.cpp index 32506dda..416e83bb 100644 --- a/src/Common/MultiMediaSourceMuxer.cpp +++ b/src/Common/MultiMediaSourceMuxer.cpp @@ -587,16 +587,14 @@ void MultiMediaSourceMuxer::resetTracks() { } bool MultiMediaSourceMuxer::onTrackFrame(const Frame::Ptr &frame) { + if (_option.modify_stamp != ProtocolOption::kModifyStampOff) { + // 时间戳不采用原始的绝对时间戳 + const_cast(frame) = std::make_shared(frame, _stamp[frame->getTrackType()], _option.modify_stamp); + } return _paced_sender ? _paced_sender->inputFrame(frame) : onTrackFrame_l(frame); } -bool MultiMediaSourceMuxer::onTrackFrame_l(const Frame::Ptr &frame_in) { - auto frame = frame_in; - if (_option.modify_stamp != ProtocolOption::kModifyStampOff) { - // 时间戳不采用原始的绝对时间戳 - frame = std::make_shared(frame, _stamp[frame->getTrackType()], _option.modify_stamp); - } - +bool MultiMediaSourceMuxer::onTrackFrame_l(const Frame::Ptr &frame) { bool ret = false; if (_rtmp) { ret = _rtmp->inputFrame(frame) ? true : ret; @@ -624,7 +622,7 @@ bool MultiMediaSourceMuxer::onTrackFrame_l(const Frame::Ptr &frame_in) { } if (_ring) { // 此场景由于直接转发,可能存在切换线程引起的数据被缓存在管道,所以需要CacheAbleFrame - frame = Frame::getCacheAbleFrame(frame); + const_cast(frame) = Frame::getCacheAbleFrame(frame); if (frame->getTrackType() == TrackVideo) { // 视频时,遇到第一帧配置帧或关键帧则标记为gop开始处 auto video_key_pos = frame->keyFrame() || frame->configFrame();