mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-10-31 08:39:34 +08:00
解决http-ts直播与hls直播冲突的问题
This commit is contained in:
parent
c76930e3cd
commit
2d0cf5cdd9
@ -166,15 +166,11 @@ bool HttpSession::checkWebSocket(){
|
||||
}
|
||||
|
||||
bool HttpSession::checkLiveStream(const string &schema, const string &url_suffix, const function<void(const MediaSource::Ptr &src)> &cb){
|
||||
auto pos = strrchr(_parser.Url().data(), '.');
|
||||
if (!pos) {
|
||||
auto pos = strcasestr(_parser.Url().data(), url_suffix.data());
|
||||
if (!pos || pos + url_suffix.size() != 1 + &_parser.Url().back()) {
|
||||
//未找到后缀
|
||||
return false;
|
||||
}
|
||||
if (strcasecmp(pos, url_suffix.data()) != 0) {
|
||||
//未找到直播流后缀
|
||||
return false;
|
||||
}
|
||||
|
||||
//这是个符合后缀的直播的流
|
||||
_mediaInfo.parse(schema + "://" + _parser["Host"] + _parser.FullUrl());
|
||||
@ -238,10 +234,10 @@ bool HttpSession::checkLiveStream(const string &schema, const string &url_suffi
|
||||
return true;
|
||||
}
|
||||
|
||||
//http-ts 链接格式:http://vhost-url:port/app/streamid.ts?key1=value1&key2=value2
|
||||
//http-ts 链接格式:http://vhost-url:port/app/streamid.live.ts?key1=value1&key2=value2
|
||||
//如果url(除去?以及后面的参数)后缀是.ts,那么表明该url是一个http-ts直播。
|
||||
bool HttpSession::checkLiveStreamTS(const function<void()> &cb){
|
||||
return checkLiveStream(TS_SCHEMA, ".ts", [this, cb](const MediaSource::Ptr &src) {
|
||||
return checkLiveStream(TS_SCHEMA, ".live.ts", [this, cb](const MediaSource::Ptr &src) {
|
||||
auto ts_src = dynamic_pointer_cast<TSMediaSource>(src);
|
||||
assert(ts_src);
|
||||
if (!cb) {
|
||||
|
Loading…
Reference in New Issue
Block a user