From 722097be051cf357bb7552dab4119e1f8ade0e62 Mon Sep 17 00:00:00 2001 From: Johnny Date: Fri, 15 Oct 2021 18:23:25 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=20RtspSession::=5Fpush=5Fsrc?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=EF=BC=8C=E7=BB=9F=E4=B8=80=E4=B8=BA=20RtspMe?= =?UTF-8?q?diaSource::Ptr=20=5Fpush=5Fsrc;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Common/MultiMediaSourceMuxer.cpp | 4 ++-- src/Rtsp/RtspSession.cpp | 9 +++++---- src/Rtsp/RtspSession.h | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Common/MultiMediaSourceMuxer.cpp b/src/Common/MultiMediaSourceMuxer.cpp index 73f47d80..82a3999b 100644 --- a/src/Common/MultiMediaSourceMuxer.cpp +++ b/src/Common/MultiMediaSourceMuxer.cpp @@ -187,9 +187,9 @@ bool MultiMediaSourceMuxer::setupRecord(MediaSource &sender, Recorder::type type bool MultiMediaSourceMuxer::isRecording(MediaSource &sender, Recorder::type type) { switch (type){ case Recorder::type_hls : - return _hls ? true : false; + return !!_hls; case Recorder::type_mp4 : - return _mp4 ? true : false; + return !!_mp4; default: return false; } diff --git a/src/Rtsp/RtspSession.cpp b/src/Rtsp/RtspSession.cpp index edb9a104..9cb16b41 100644 --- a/src/Rtsp/RtspSession.cpp +++ b/src/Rtsp/RtspSession.cpp @@ -259,10 +259,11 @@ void RtspSession::handleReq_ANNOUNCE(const Parser &parser) { for (auto &track : _sdp_track) { _rtcp_context.emplace_back(std::make_shared()); } - _push_src = std::make_shared(_media_info._vhost, _media_info._app, _media_info._streamid); - _push_src->setListener(dynamic_pointer_cast(shared_from_this())); - _push_src->setProtocolTranslation(enableHls, enableMP4); - _push_src->setSdp(parser.Content()); + auto push_src = std::make_shared(_media_info._vhost, _media_info._app, _media_info._streamid); + push_src->setListener(dynamic_pointer_cast(shared_from_this())); + push_src->setProtocolTranslation(enableHls, enableMP4); + push_src->setSdp(parser.Content()); + _push_src = std::move(push_src); sendRtspResponse("200 OK"); }; diff --git a/src/Rtsp/RtspSession.h b/src/Rtsp/RtspSession.h index d9caf1b1..9911b0d4 100644 --- a/src/Rtsp/RtspSession.h +++ b/src/Rtsp/RtspSession.h @@ -185,7 +185,7 @@ private: //url解析后保存的相关信息 MediaInfo _media_info; //rtsp推流相关绑定的源 - RtspMediaSourceImp::Ptr _push_src; + RtspMediaSource::Ptr _push_src; //rtsp播放器绑定的直播源 std::weak_ptr _play_src; //直播源读取器