[vlc-commits] [Git][videolan/vlc][3.0.x] 2 commits: demux: adaptive: skip ID3 in front of any segment

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Fri Nov 4 10:11:53 UTC 2022



Jean-Baptiste Kempf pushed to branch 3.0.x at VideoLAN / VLC


Commits:
63289deb by Francois Cartegnie at 2022-11-04T09:53:47+00:00
demux: adaptive: skip ID3 in front of any segment

more HLS crap FTW

refs #27441

(cherry picked from commit e062e9d65010fc5b30ef46336da7de44c76a6125)

- - - - -
5e58b6a9 by Francois Cartegnie at 2022-11-04T09:53:47+00:00
demux: adaptive: fix MIME format update

refs #27441

(cherry picked from commit 7b2c84807e92b8b2282f3b25b0cd8759cbf8c472)

- - - - -


2 changed files:

- modules/demux/adaptive/SegmentTracker.cpp
- modules/demux/adaptive/StreamFormat.cpp


Changes:

=====================================
modules/demux/adaptive/SegmentTracker.cpp
=====================================
@@ -399,7 +399,7 @@ ChunkInterface * SegmentTracker::getNextChunk(bool switch_allowed)
         chunkformat = StreamFormat(p_peek, i_peek);
         /* fallback on Mime type */
         if(chunkformat == StreamFormat(StreamFormat::Type::Unknown))
-            format = StreamFormat(chunk.chunk->getContentType());
+            chunkformat = StreamFormat(chunk.chunk->getContentType());
         chunk.chunk->setStreamFormat(chunkformat);
         returnedChunk = wrappedck;
     }


=====================================
modules/demux/adaptive/StreamFormat.cpp
=====================================
@@ -128,6 +128,16 @@ StreamFormat::StreamFormat(const void *data_, size_t sz)
     type = Type::Unknown;
     const char moov[] = "ftypmoovmoofemsg";
 
+    /* Skipped ID3 if any */
+    while(sz > 10 && ID3TAG_IsTag(data, false))
+    {
+        size_t tagsize = ID3TAG_Parse(data, sz, ID3Callback, this);
+        if(tagsize >= sz || tagsize == 0)
+            return; /* not enough peek */
+        data += tagsize;
+        sz -= tagsize;
+    }
+
     if(sz > 188 && data[0] == 0x47 && data[188] == 0x47)
         type = StreamFormat::Type::MPEG2TS;
     else if(sz > 8 && (!memcmp(&moov,    &data[4], 4) ||
@@ -144,15 +154,6 @@ StreamFormat::StreamFormat(const void *data_, size_t sz)
     else /* Check Packet Audio formats */
     {
         /* It MUST have ID3 header, but HLS spec is an oxymoron */
-        while(sz > 10 && ID3TAG_IsTag(data, false))
-        {
-            size_t tagsize = ID3TAG_Parse(data, sz, ID3Callback, this);
-            if(tagsize >= sz || tagsize == 0)
-                return; /* not enough peek */
-            data += tagsize;
-            sz -= tagsize;
-        }
-        /* Skipped ID3 if any */
         if(sz > 3 && (!memcmp("\xFF\xF1", data, 2) ||
                       !memcmp("\xFF\xF9", data, 2)))
         {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/47bd9018f0f33770e850d038f9981503e04b25fc...5e58b6a9fa37d2fa11384cce6714c52811281146

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/47bd9018f0f33770e850d038f9981503e04b25fc...5e58b6a9fa37d2fa11384cce6714c52811281146
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list