[vlc-commits] demux: smooth: patch moof sequence with sequence number

Francois Cartegnie git at videolan.org
Wed Jan 6 20:27:04 UTC 2021


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jan  6 19:34:00 2021 +0100| [94b80fd6cb049795876a872eb8461c7796ed64aa] | committer: Francois Cartegnie

demux: smooth: patch moof sequence with sequence number

regression after 1a7915a5fabb25b0d7f582ec06a6a2f77ab82717

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

 modules/demux/smooth/mp4/IndexReader.cpp        | 10 ++++++++--
 modules/demux/smooth/mp4/IndexReader.hpp        |  2 +-
 modules/demux/smooth/playlist/SmoothSegment.cpp |  2 +-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/modules/demux/smooth/mp4/IndexReader.cpp b/modules/demux/smooth/mp4/IndexReader.cpp
index e101ae307b..fe7c5402ce 100644
--- a/modules/demux/smooth/mp4/IndexReader.cpp
+++ b/modules/demux/smooth/mp4/IndexReader.cpp
@@ -36,12 +36,18 @@ IndexReader::IndexReader(vlc_object_t *obj)
 {
 }
 
-bool IndexReader::parseIndex(block_t *p_block, BaseRepresentation *rep)
+bool IndexReader::parseIndex(block_t *p_block, BaseRepresentation *rep, uint64_t sequence)
 {
     if(!rep || !parseBlock(p_block))
         return false;
 
-    /* Do track ID fixup */
+    /* Fixup moof sequence as they do not monotonically increase
+       nor provide a way to have moof time on implicit discontinuity */
+    const MP4_Box_t *mfhd_box = MP4_BoxGet( rootbox, "moof/mfhd" );
+    if( mfhd_box )
+        SetDWBE( &p_block->p_buffer[mfhd_box->i_pos + 8 + 4], sequence );
+
+    /* Do track ID fixup, must match track #1 */
     const MP4_Box_t *tfhd_box = MP4_BoxGet( rootbox, "moof/traf/tfhd" );
     if ( tfhd_box )
         SetDWBE( &p_block->p_buffer[tfhd_box->i_pos + 8 + 4], 0x01 );
diff --git a/modules/demux/smooth/mp4/IndexReader.hpp b/modules/demux/smooth/mp4/IndexReader.hpp
index a8599a6529..94b20e4f18 100644
--- a/modules/demux/smooth/mp4/IndexReader.hpp
+++ b/modules/demux/smooth/mp4/IndexReader.hpp
@@ -41,7 +41,7 @@ namespace smooth
         {
             public:
                 IndexReader(vlc_object_t *);
-                bool parseIndex(block_t *, BaseRepresentation *);
+                bool parseIndex(block_t *, BaseRepresentation *, uint64_t);
         };
     }
 }
diff --git a/modules/demux/smooth/playlist/SmoothSegment.cpp b/modules/demux/smooth/playlist/SmoothSegment.cpp
index e04bdefc0a..273d86ef16 100644
--- a/modules/demux/smooth/playlist/SmoothSegment.cpp
+++ b/modules/demux/smooth/playlist/SmoothSegment.cpp
@@ -49,7 +49,7 @@ void SmoothSegmentChunk::onDownload(block_t **pp_block)
         return;
 
     IndexReader br(rep->getPlaylist()->getVLCObject());
-    br.parseIndex(*pp_block, rep);
+    br.parseIndex(*pp_block, rep, sequence);
 
     /* If timeshift depth is present, we use it for expiring segments
        as we never update playlist itself */



More information about the vlc-commits mailing list