[vlc-commits] demux: adaptive: fix probing with multiple ID3

Francois Cartegnie git at videolan.org
Tue Apr 6 12:07:32 UTC 2021


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Apr  6 09:58:36 2021 +0200| [4e87c5494cfd34d85fa42d4f5e6bbf094f2c6f9b] | committer: Francois Cartegnie

demux: adaptive: fix probing with multiple ID3

regression regarding #24237 after chunk probe only change

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4e87c5494cfd34d85fa42d4f5e6bbf094f2c6f9b
---

 modules/demux/adaptive/StreamFormat.cpp | 4 ++--
 modules/demux/hls/HLSStreams.cpp        | 9 ++++-----
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/modules/demux/adaptive/StreamFormat.cpp b/modules/demux/adaptive/StreamFormat.cpp
index 927a8a71a9..b75b31f3f8 100644
--- a/modules/demux/adaptive/StreamFormat.cpp
+++ b/modules/demux/adaptive/StreamFormat.cpp
@@ -118,10 +118,10 @@ StreamFormat::StreamFormat(const void *data_, size_t sz)
     else /* Check Packet Audio formats */
     {
         /* It MUST have ID3 header, but HLS spec is an oxymoron */
-        if(sz > 10 && ID3TAG_IsTag(data, false))
+        while(sz > 10 && ID3TAG_IsTag(data, false))
         {
             size_t tagsize = ID3TAG_Parse(data, sz, ID3Callback, this);
-            if(tagsize >= sz)
+            if(tagsize >= sz || tagsize == 0)
                 return; /* not enough peek */
             data += tagsize;
             sz -= tagsize;
diff --git a/modules/demux/hls/HLSStreams.cpp b/modules/demux/hls/HLSStreams.cpp
index 41a15b8f70..a612c98586 100644
--- a/modules/demux/hls/HLSStreams.cpp
+++ b/modules/demux/hls/HLSStreams.cpp
@@ -99,18 +99,17 @@ int HLSStream::ID3TAG_Parse_Handler(uint32_t i_tag, const uint8_t *p_payload, si
 
 block_t * HLSStream::checkBlock(block_t *p_block, bool b_first)
 {
-    if(b_first && p_block &&
-       p_block->i_buffer >= 10 && ID3TAG_IsTag(p_block->p_buffer, false))
+    if(b_first && p_block)
     {
-        while( p_block->i_buffer )
+        while(p_block->i_buffer >= 10 && ID3TAG_IsTag(p_block->p_buffer, false))
         {
             size_t i_size = ID3TAG_Parse( p_block->p_buffer, p_block->i_buffer,
                                           ID3TAG_Parse_Handler, static_cast<void *>(this) );
+            if(i_size >= p_block->i_buffer || i_size == 0)
+                break;
             /* Skip ID3 for demuxer */
             p_block->p_buffer += i_size;
             p_block->i_buffer -= i_size;
-            if( i_size == 0 )
-                break;
         }
     }
 



More information about the vlc-commits mailing list