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

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

@@ -810,19 +810,11 @@ void installWebApi() {
}
});
static auto 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);
};
api_regist2("/index/api/startSendRtp",[](API_ARGS2){
CHECK_SECRET();
CHECK_ARGS("vhost", "app", "stream", "ssrc", "dst_url", "dst_port", "is_udp");
auto src = getMediaSource(allArgs["vhost"], allArgs["app"], allArgs["stream"]);
auto src = MediaSource::find(allArgs["vhost"], allArgs["app"], allArgs["stream"]);
if (!src) {
throw ApiRetException("该媒体流不存在", API::OtherFailed);
}
@@ -840,7 +832,7 @@ void installWebApi() {
CHECK_SECRET();
CHECK_ARGS("vhost", "app", "stream");
auto src = getMediaSource(allArgs["vhost"], allArgs["app"], allArgs["stream"]);
auto src = MediaSource::find(allArgs["vhost"], allArgs["app"], allArgs["stream"]);
if (!src) {
throw ApiRetException("该媒体流不存在", API::OtherFailed);
}