diff --git a/server/WebApi.cpp b/server/WebApi.cpp index 1500b2c1..97f3bf00 100755 --- a/server/WebApi.cpp +++ b/server/WebApi.cpp @@ -1719,7 +1719,7 @@ void installWebApi() { auto &allArgs = _args; CHECK_ARGS("app", "stream"); - return StrPrinter << RTC_SCHEMA << "://" << _args["Host"] << "/" << _args["app"] << "/" + return StrPrinter << "rtc://" << _args["Host"] << "/" << _args["app"] << "/" << _args["stream"] << "?" << _args.getParser().params() + "&session=" + _session_id; } diff --git a/src/Common/MediaSource.cpp b/src/Common/MediaSource.cpp index 0859b7ce..c6bf5d93 100644 --- a/src/Common/MediaSource.cpp +++ b/src/Common/MediaSource.cpp @@ -491,7 +491,19 @@ MediaSource::Ptr MediaSource::find(const string &vhost, const string &app, const if (src) { return src; } - return MediaSource::find(HLS_SCHEMA, vhost, app, stream_id, from_mp4); + src = MediaSource::find(TS_SCHEMA, vhost, app, stream_id, from_mp4); + if (src) { + return src; + } + src = MediaSource::find(FMP4_SCHEMA, vhost, app, stream_id, from_mp4); + if (src) { + return src; + } + src = MediaSource::find(HLS_SCHEMA, vhost, app, stream_id, from_mp4); + if (src) { + return src; + } + return MediaSource::find(HLS_FMP4_SCHEMA, vhost, app, stream_id, from_mp4); } void MediaSource::emitEvent(bool regist){ diff --git a/src/Common/macros.h b/src/Common/macros.h index 8c86fc10..cc31202e 100644 --- a/src/Common/macros.h +++ b/src/Common/macros.h @@ -51,16 +51,14 @@ } #endif // CLEAR_ARR -#define VHOST_KEY "vhost" -#define HTTP_SCHEMA "http" #define RTSP_SCHEMA "rtsp" -#define RTC_SCHEMA "rtc" #define RTMP_SCHEMA "rtmp" -#define HLS_SCHEMA "hls" #define TS_SCHEMA "ts" #define FMP4_SCHEMA "fmp4" +#define HLS_SCHEMA "hls" #define HLS_FMP4_SCHEMA "hls.fmp4" -#define SRT_SCHEMA "srt" + +#define VHOST_KEY "vhost" #define DEFAULT_VHOST "__defaultVhost__" #ifdef __cplusplus diff --git a/src/Http/HttpFileManager.cpp b/src/Http/HttpFileManager.cpp index 3233d48f..b57d6411 100644 --- a/src/Http/HttpFileManager.cpp +++ b/src/Http/HttpFileManager.cpp @@ -620,7 +620,7 @@ static string getFilePath(const Parser &parser,const MediaInfo &media_info, Sess * @param cb 回调对象 */ void HttpFileManager::onAccessPath(Session &sender, Parser &parser, const HttpFileManager::invoker &cb) { - auto fullUrl = string(HTTP_SCHEMA) + "://" + parser["Host"] + parser.fullUrl(); + auto fullUrl = "http://" + parser["Host"] + parser.fullUrl(); MediaInfo media_info(fullUrl); auto file_path = getFilePath(parser, media_info, sender); if (file_path.size() == 0) { diff --git a/srt/SrtTransportImp.cpp b/srt/SrtTransportImp.cpp index 56d6bd8a..ab67f52b 100644 --- a/srt/SrtTransportImp.cpp +++ b/srt/SrtTransportImp.cpp @@ -54,7 +54,7 @@ bool SrtTransportImp::parseStreamid(std::string &streamid) { if (!toolkit::start_with(streamid, "#!::")) { return false; } - _media_info.schema = SRT_SCHEMA; + _media_info.schema = "srt"; std::string real_streamid = streamid.substr(4); std::string vhost, app, stream_name; diff --git a/webrtc/WebRtcTransport.cpp b/webrtc/WebRtcTransport.cpp index 3f798358..eafe579b 100644 --- a/webrtc/WebRtcTransport.cpp +++ b/webrtc/WebRtcTransport.cpp @@ -1258,7 +1258,7 @@ void play_plugin(Session &sender, const WebRtcArgs &args, const WebRtcPluginMana return; } // 还原成rtc,目的是为了hook时识别哪种播放协议 - info.schema = RTC_SCHEMA; + info.schema = "rtc"; auto rtc = WebRtcPlayer::create(EventPollerPool::Instance().getPoller(), src, info, preferred_tcp); cb(*rtc); });