调整 RtspSession::_push_src类型,统一为 RtspMediaSource::Ptr _push_src;

This commit is contained in:
Johnny 2021-10-15 18:23:25 +08:00
parent efa839c60b
commit 722097be05
3 changed files with 8 additions and 7 deletions

View File

@ -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;
}

View File

@ -259,10 +259,11 @@ void RtspSession::handleReq_ANNOUNCE(const Parser &parser) {
for (auto &track : _sdp_track) {
_rtcp_context.emplace_back(std::make_shared<RtcpContextForRecv>());
}
_push_src = std::make_shared<RtspMediaSourceImp>(_media_info._vhost, _media_info._app, _media_info._streamid);
_push_src->setListener(dynamic_pointer_cast<MediaSourceEvent>(shared_from_this()));
_push_src->setProtocolTranslation(enableHls, enableMP4);
_push_src->setSdp(parser.Content());
auto push_src = std::make_shared<RtspMediaSourceImp>(_media_info._vhost, _media_info._app, _media_info._streamid);
push_src->setListener(dynamic_pointer_cast<MediaSourceEvent>(shared_from_this()));
push_src->setProtocolTranslation(enableHls, enableMP4);
push_src->setSdp(parser.Content());
_push_src = std::move(push_src);
sendRtspResponse("200 OK");
};

View File

@ -185,7 +185,7 @@ private:
//url解析后保存的相关信息
MediaInfo _media_info;
//rtsp推流相关绑定的源
RtspMediaSourceImp::Ptr _push_src;
RtspMediaSource::Ptr _push_src;
//rtsp播放器绑定的直播源
std::weak_ptr<RtspMediaSource> _play_src;
//直播源读取器