mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-23 11:17:09 +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){
|
bool HttpSession::checkLiveStream(const string &schema, const string &url_suffix, const function<void(const MediaSource::Ptr &src)> &cb){
|
||||||
auto pos = strrchr(_parser.Url().data(), '.');
|
auto pos = strcasestr(_parser.Url().data(), url_suffix.data());
|
||||||
if (!pos) {
|
if (!pos || pos + url_suffix.size() != 1 + &_parser.Url().back()) {
|
||||||
//未找到后缀
|
//未找到后缀
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (strcasecmp(pos, url_suffix.data()) != 0) {
|
|
||||||
//未找到直播流后缀
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//这是个符合后缀的直播的流
|
//这是个符合后缀的直播的流
|
||||||
_mediaInfo.parse(schema + "://" + _parser["Host"] + _parser.FullUrl());
|
_mediaInfo.parse(schema + "://" + _parser["Host"] + _parser.FullUrl());
|
||||||
@ -238,10 +234,10 @@ bool HttpSession::checkLiveStream(const string &schema, const string &url_suffi
|
|||||||
return true;
|
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直播。
|
//如果url(除去?以及后面的参数)后缀是.ts,那么表明该url是一个http-ts直播。
|
||||||
bool HttpSession::checkLiveStreamTS(const function<void()> &cb){
|
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);
|
auto ts_src = dynamic_pointer_cast<TSMediaSource>(src);
|
||||||
assert(ts_src);
|
assert(ts_src);
|
||||||
if (!cb) {
|
if (!cb) {
|
||||||
|
Loading…
Reference in New Issue
Block a user