[vlc-commits] demux: mp4: fix TRUN composition time signedness

Francois Cartegnie git at videolan.org
Tue May 27 23:08:51 CEST 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue May 27 23:05:01 2014 +0200| [3ff38b860a5bd13273568a478ee33efe205db688] | committer: Francois Cartegnie

demux: mp4: fix TRUN composition time signedness

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

 modules/demux/mp4/libmp4.h |    2 +-
 modules/demux/mp4/mp4.c    |    6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index 30f0f87..6850b2b 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -953,7 +953,7 @@ typedef struct MP4_descriptor_trun_sample_t
     uint32_t i_duration;
     uint32_t i_size;
     uint32_t i_flags;
-    uint32_t i_composition_time_offset;
+    uint32_t i_composition_time_offset; /* version == 0 ? signed : unsigned */
 } MP4_descriptor_trun_sample_t;
 
 typedef struct MP4_Box_data_trun_s
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 71d2d8e..a365992 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -3933,8 +3933,10 @@ static int MP4_frg_GetChunk( demux_t *p_demux, MP4_Box_t *p_chunk, unsigned *i_t
 
         if( ret->p_sample_offset_pts )
         {
-            ret->p_sample_offset_pts[i] =
-                        p_trun_data->p_samples[i].i_composition_time_offset;
+            if ( p_trun_data->i_version == 0 )
+                ret->p_sample_offset_pts[i] = (int32_t) p_trun_data->p_samples[i].i_composition_time_offset;
+            else
+                ret->p_sample_offset_pts[i] = __MIN( INT32_MAX, p_trun_data->p_samples[i].i_composition_time_offset );
         }
 
         if( p_trun_data->i_flags & MP4_TRUN_SAMPLE_SIZE )



More information about the vlc-commits mailing list