From 5007578202e72a583bfb1233efc128741b690ac0 Mon Sep 17 00:00:00 2001 From: ziyue <1213642868@qq.com> Date: Fri, 21 Jan 2022 16:10:27 +0800 Subject: [PATCH] =?UTF-8?q?hls/ts=20=E6=92=AD=E6=94=BE=E5=99=A8=E4=B8=8D?= =?UTF-8?q?=E5=81=9Acontent-length=E4=B8=A5=E6=A0=BC=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3rdpart/ZLToolKit | 2 +- src/Http/HlsPlayer.cpp | 6 +++--- src/Http/HttpTSPlayer.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/3rdpart/ZLToolKit b/3rdpart/ZLToolKit index c41a8e61..74cd97f7 160000 --- a/3rdpart/ZLToolKit +++ b/3rdpart/ZLToolKit @@ -1 +1 @@ -Subproject commit c41a8e61e43292080462517027554d0015e26fbe +Subproject commit 74cd97f7e9712848b8df1ecf47760fb6d97b74ee diff --git a/src/Http/HlsPlayer.cpp b/src/Http/HlsPlayer.cpp index f17b6f16..3c867acf 100644 --- a/src/Http/HlsPlayer.cpp +++ b/src/Http/HlsPlayer.cpp @@ -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(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(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(); } diff --git a/src/Http/HttpTSPlayer.cpp b/src/Http/HttpTSPlayer.cpp index e3a4b8ac..a77de5ce 100644 --- a/src/Http/HttpTSPlayer.cpp +++ b/src/Http/HttpTSPlayer.cpp @@ -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(header)["Content-Type"]; + auto content_type = strToLower(const_cast(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(); } }