[vlc-commits] demux: mp4: optionally store sample desc as extradata

Francois Cartegnie git at videolan.org
Wed Jan 24 16:28:24 CET 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Jan 22 21:30:33 2018 +0100| [b17790e5aa58ed0ee780aed00faf41702a6f91a0] | committer: Francois Cartegnie

demux: mp4: optionally store sample desc as extradata

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

 modules/demux/mp4/libmp4.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index bd7b82a742..e3e43b64b8 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -2784,15 +2784,14 @@ static int MP4_ReadBox_sample_text( stream_t *p_stream, MP4_Box_t *p_box )
 
     MP4_GET2BYTES( p_box->data.p_sample_text->i_data_reference_index );
 
-    if( i_read < 32 )
-        MP4_READBOX_EXIT( 0 );
-
-    p_box->data.p_sample_text->p_data = malloc( i_read );
-    if( !p_box->data.p_sample_text->p_data )
-        MP4_READBOX_EXIT( 0 );
-
+    if( i_read )
+    {
+        p_box->data.p_sample_text->p_data = malloc( i_read );
+        if( !p_box->data.p_sample_text->p_data )
+            MP4_READBOX_EXIT( 0 );
+        memcpy( p_box->data.p_sample_text->p_data, p_peek, i_read );
+    }
     p_box->data.p_sample_text->i_data = i_read;
-    memcpy( p_box->data.p_sample_text->p_data, p_peek, i_read );
 
 #ifdef MP4_VERBOSE
     msg_Dbg( p_stream, "read box: \"text\" in stsd text" );



More information about the vlc-commits mailing list