[vlc-commits] demux: mp4: Fix the post_mdat_offset for mdats with a 64 bit length
Martin Storsjö
git at videolan.org
Fri Apr 27 11:00:20 CEST 2018
vlc | branch: master | Martin Storsjö <martin at martin.st> | Fri Apr 27 11:57:57 2018 +0300| [10398c4f9543559d936a6503a5a58ad603805813] | committer: Martin Storsjö
demux: mp4: Fix the post_mdat_offset for mdats with a 64 bit length
Apple/iOS writes fragmented files with such mdat lengths while writing
of the file isn't yet completed.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=10398c4f9543559d936a6503a5a58ad603805813
---
modules/demux/mp4/mp4.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 105ca72d55..e36a1676c2 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -4938,7 +4938,17 @@ static int DemuxFrag( demux_t *p_demux )
p_sys->context.i_current_box_type = VLC_FOURCC( p_peek[4], p_peek[5], p_peek[6], p_peek[7] );
if( p_sys->context.i_current_box_type == ATOM_mdat )
{
- p_sys->context.i_post_mdat_offset = vlc_stream_Tell( p_demux->s ) + GetDWBE( p_peek );
+ uint64_t size = GetDWBE( p_peek );
+ if ( size == 1 )
+ {
+ if( vlc_stream_Peek( p_demux->s, &p_peek, 16 ) != 16 )
+ {
+ i_status = VLC_DEMUXER_EOF;
+ goto end;
+ }
+ size = GetQWBE( p_peek + 8 );
+ }
+ p_sys->context.i_post_mdat_offset = vlc_stream_Tell( p_demux->s ) + size;
}
else
{
More information about the vlc-commits
mailing list