[vlc-commits] demux: adaptive: make Content-Type no longer authoritative

Francois Cartegnie git at videolan.org
Tue Jun 16 10:18:57 CEST 2020


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Jun  7 19:55:21 2020 +0200| [7518adcaface092781bcaa12794acb813bb2a17c] | committer: Francois Cartegnie

demux: adaptive: make Content-Type no longer authoritative

tired of bogus HLS configs
ref #24817

(cherry picked from commit 036bde530b42c96c583447c6dccaceb3e623206e)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=7518adcaface092781bcaa12794acb813bb2a17c
---

 modules/demux/adaptive/plumbing/Demuxer.cpp | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/modules/demux/adaptive/plumbing/Demuxer.cpp b/modules/demux/adaptive/plumbing/Demuxer.cpp
index d3221f0969..3d7c26563a 100644
--- a/modules/demux/adaptive/plumbing/Demuxer.cpp
+++ b/modules/demux/adaptive/plumbing/Demuxer.cpp
@@ -114,18 +114,20 @@ bool MimeDemuxer::create()
         return false;
 
     StreamFormat format(StreamFormat::UNKNOWN);
-    char *type = stream_ContentType(p_newstream);
-    if(type)
-    {
-        format = StreamFormat(std::string(type));
-        free(type);
-    }
+
     /* Try to probe */
+    const uint8_t *p_peek;
+    size_t i_peek = sourcestream->Peek(&p_peek, StreamFormat::PEEK_SIZE);
+    format = StreamFormat(reinterpret_cast<const void *>(p_peek), i_peek);
+
     if(format == StreamFormat(StreamFormat::UNKNOWN))
     {
-        const uint8_t *p_peek;
-        size_t i_peek = sourcestream->Peek(&p_peek, StreamFormat::PEEK_SIZE);
-        format = StreamFormat(reinterpret_cast<const void *>(p_peek), i_peek);
+        char *type = stream_ContentType(p_newstream);
+        if(type)
+        {
+            format = StreamFormat(std::string(type));
+            free(type);
+        }
     }
 
     if(format != StreamFormat(StreamFormat::UNKNOWN))



More information about the vlc-commits mailing list