Commit 50075782 by ziyue

hls/ts 播放器不做content-length严格限制

parent bf191aa9
ZLToolKit @ 74cd97f7
Subproject commit c41a8e61e43292080462517027554d0015e26fbe
Subproject commit 74cd97f7e9712848b8df1ecf47760fb6d97b74ee
......@@ -167,9 +167,9 @@ void HlsPlayer::onResponseHeader(const string &status, const HttpClient::HttpHea
//失败
throw invalid_argument("bad http status code:" + status);
}
auto content_type = const_cast<HttpClient::HttpHeader &>(headers)["Content-Type"];
if (content_type.find("application/vnd.apple.mpegurl") != 0) {
throw invalid_argument("content type not m3u8: " + content_type);
auto content_type = strToLower(const_cast<HttpClient::HttpHeader &>(headers)["Content-Type"]);
if (content_type.find("application/vnd.apple.mpegurl") != 0 && content_type.find("application/x-mpegurl") != 0) {
WarnL << "may not a hls video: " << content_type << ", url: " << getUrl();
}
_m3u8.clear();
}
......
......@@ -24,9 +24,9 @@ void HttpTSPlayer::onResponseHeader(const string &status, const HttpClient::Http
throw invalid_argument("bad http status code:" + status);
}
auto content_type = const_cast<HttpClient::HttpHeader &>(header)["Content-Type"];
auto content_type = strToLower(const_cast<HttpClient::HttpHeader &>(header)["Content-Type"]);
if (content_type.find("video/mp2t") != 0 && content_type.find("video/mpeg") != 0) {
throw invalid_argument("content type not mpeg-ts: " + content_type);
WarnL << "may not a mpeg-ts video: " << content_type << ", url: " << getUrl();
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论