[vlc-commits] demux: mp4: compute cts_shift when missing

Francois Cartegnie git at videolan.org
Tue Feb 9 19:41:54 UTC 2021


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Feb  4 20:24:36 2021 +0100| [93a07137d95528c25472af76cfcba4caefd723b6] | committer: Francois Cartegnie

demux: mp4: compute cts_shift when missing

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

 modules/demux/mp4/mp4.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 382aaaea00..d982590cdf 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -2707,6 +2707,14 @@ static int TrackCreateSamplesIndex( demux_t *p_demux,
                     i_cts_shift = -ctts->pi_sample_offset[i];
             }
         }
+        else if( ctts->i_entry_count ) /* Compute for Quicktime */
+        {
+            for( uint32_t i = 0; i < ctts->i_entry_count; i++ )
+            {
+                if( ctts->pi_sample_offset[i] < 0 && ctts->pi_sample_offset[i] < -i_cts_shift )
+                    i_cts_shift = -ctts->pi_sample_offset[i];
+            }
+        }
 
         /* Create pts-dts table per chunk */
         uint32_t i_index = 0;



More information about the vlc-commits mailing list