复用忽略协议查找流的相关代码

This commit is contained in:
xiongziliang
2020-09-06 18:19:54 +08:00
parent 599e8493ca
commit 51ae8d4083
4 changed files with 21 additions and 21 deletions

View File

@@ -79,16 +79,8 @@ std::shared_ptr<MediaSinkInterface> Recorder::createRecorder(type type, const st
}
}
static MediaSource::Ptr getMediaSource(const string &vhost, const string &app, const string &stream_id){
auto src = MediaSource::find(RTMP_SCHEMA, vhost, app, stream_id);
if(src){
return src;
}
return MediaSource::find(RTSP_SCHEMA, vhost, app, stream_id);
}
bool Recorder::isRecording(type type, const string &vhost, const string &app, const string &stream_id){
auto src = getMediaSource(vhost, app, stream_id);
auto src = MediaSource::find(vhost, app, stream_id);
if(!src){
return false;
}
@@ -96,7 +88,7 @@ bool Recorder::isRecording(type type, const string &vhost, const string &app, co
}
bool Recorder::startRecord(type type, const string &vhost, const string &app, const string &stream_id,const string &customized_path){
auto src = getMediaSource(vhost, app, stream_id);
auto src = MediaSource::find(vhost, app, stream_id);
if (!src) {
WarnL << "未找到相关的MediaSource,startRecord失败:" << vhost << "/" << app << "/" << stream_id;
return false;
@@ -105,7 +97,7 @@ bool Recorder::startRecord(type type, const string &vhost, const string &app, co
}
bool Recorder::stopRecord(type type, const string &vhost, const string &app, const string &stream_id){
auto src = getMediaSource(vhost, app, stream_id);
auto src = MediaSource::find(vhost, app, stream_id);
if(!src){
return false;
}