[vlc-commits] demux: mp4: move moov check outside of GetRoot

Francois Cartegnie git at videolan.org
Fri Nov 16 14:55:47 CET 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Nov 16 13:41:37 2018 +0100| [c7534157b57760b847a91cab46746b65334e37c7] | committer: Francois Cartegnie

demux: mp4: move moov check outside of GetRoot

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

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

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index dda4555858..eaf8246cc8 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -5354,7 +5354,7 @@ MP4_Box_t *MP4_BoxGetRoot( stream_t *p_stream )
     }
 
     if( !i_result )
-        goto error;
+        return p_vroot;
 
     /* If there is a mvex box, it means fragmented MP4, and we're done */
     if( MP4_BoxCount( p_vroot, "moov/mvex" ) > 0 )
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 0619f8ab74..61c9be01ec 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -461,11 +461,15 @@ static int LoadInitFrag( demux_t *p_demux )
     demux_sys_t *p_sys = p_demux->p_sys;
 
     /* Load all boxes ( except raw data ) */
-    if( ( p_sys->p_root = MP4_BoxGetRoot( p_demux->s ) ) == NULL )
+    MP4_Box_t *p_root = MP4_BoxGetRoot( p_demux->s );
+    if( p_root == NULL || !MP4_BoxGet( p_root, "/moov" ) )
     {
+        MP4_BoxFree( p_root );
         goto LoadInitFragError;
     }
 
+    p_sys->p_root = p_root;
+
     return VLC_SUCCESS;
 
 LoadInitFragError:



More information about the vlc-commits mailing list