demux: adaptive: make Content-Type no longer authoritative
authorFrancois Cartegnie <fcvlcdev@free.fr>
Sun, 7 Jun 2020 17:55:21 +0000 (19:55 +0200)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Sun, 7 Jun 2020 17:58:33 +0000 (19:58 +0200)
tired of bogus HLS configs
ref #24817

modules/demux/adaptive/plumbing/Demuxer.cpp

index e8e123b..43d3daf 100644 (file)
@@ -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))