[vlc-commits] demux: libmp4: set root container size before probing

Francois Cartegnie git at videolan.org
Wed Sep 9 11:46:29 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Sep  8 14:08:44 2015 +0200| [6bff31b4c3d180174d3f672526369884dc2bfdfc] | committer: Francois Cartegnie

demux: libmp4: set root container size before probing

avoids late failures

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

 modules/demux/mp4/libmp4.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 56dab62..4bd76e0 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -4118,10 +4118,9 @@ MP4_Box_t *MP4_BoxGetNextChunk( stream_t *s )
  *  The first box is a virtual box "root" and is the father for all first
  *  level boxes for the file, a sort of virtual contener
  *****************************************************************************/
-MP4_Box_t *MP4_BoxGetRoot( stream_t *s )
+MP4_Box_t *MP4_BoxGetRoot( stream_t *p_stream )
 {
     MP4_Box_t *p_root;
-    stream_t *p_stream;
     int i_result;
 
     p_root = calloc( 1, sizeof( MP4_Box_t ) );
@@ -4130,11 +4129,13 @@ MP4_Box_t *MP4_BoxGetRoot( stream_t *s )
 
     p_root->i_type = ATOM_root;
     p_root->i_shortsize = 1;
+    int64_t i_size = stream_Size( p_stream );
+    if( i_size > 0 )
+        p_root->i_size = i_size;
+
     /* could be a DASH stream for exemple, 0 means unknown or infinite size */
     CreateUUID( &p_root->i_uuid, p_root->i_type );
 
-    p_stream = s;
-
     /* First get the moov */
     i_result = MP4_ReadBoxContainerChildren( p_stream, p_root, ATOM_moov );
 
@@ -4144,8 +4145,7 @@ MP4_Box_t *MP4_BoxGetRoot( stream_t *s )
     else if( MP4_BoxCount( p_root, "moov/mvex" ) > 0 )
         return p_root;
 
-    p_root->i_size = stream_Size( s );
-    if( stream_Tell( s ) + 8 < stream_Size( s ) )
+    if( stream_Tell( p_stream ) + 8 < (uint64_t) stream_Size( p_stream ) )
     {
         /* Get the rest of the file */
         i_result = MP4_ReadBoxContainerChildren( p_stream, p_root, 0 );



More information about the vlc-commits mailing list