[MPlayer-dev-eng] [PATCH] Ignore 0-len packets for muxer prebuffering

Tobias Diedrich ranma+mplayer at tdiedrich.de
Thu Jun 23 22:08:08 CEST 2011


We should ignore packets of len 0, otherwise the muxer may have seen
all streams but not have enough data to properly write the header.
This fixes an issue where the libavformat muxer could not determine the
image dimensions while writing the header and subsequently crash with
a divison by zero.

Example (intentionally broken) avi file:
http://uguu.de/~ranma/muxer_bug_test.avi

Unpatched "mencoder -of lavf -ovc lavc -oac pcm -o ../test.avi
../muxer_bug_test.avi" will crash:
|[...]
|Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
|[...]
|Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
|==========================================================================
|Pos:   0.0s      1f ( 0%)  0.00fps Trem:   0min   0mb  A-V:0.000
|[0:0]
|
|1 duplicate frame(s)!
|VIDEO CODEC ID: 13
|AUDIO CODEC ID: 10000, TAG: 0
|Writing header...
|[avi @ 0xbf8840]dimensions not set
|Floating point exception

With the patch it works fine:
|[...]
|Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
|[...]
|Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
|==========================================================================
|Pos:   0.0s      1f ( 0%)  0.00fps Trem:   0min   0mb  A-V:0.000
|[0:0]
|
|1 duplicate frame(s)!
|Pos:   0.0s      2f ( 0%)  0.00fps Trem:   0min   0mb  A-V:-0.001
|[0:0]
|[...]
|Pos:   2.9s     89f ( 7%)  0.00fps Trem:   0min   0mb  A-V:-0.006
|[0:1411]
|Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
|videocodec: libavcodec (480x360 fourcc=34504d46 [FMP4])
|VIDEO CODEC ID: 13
|AUDIO CODEC ID: 10000, TAG: 0
|Writing header...
|[...]
|Pos:  10.0s    299f (101%)  0.00fps Trem:   0min   1mb  A-V:0.002
|[540:1411]
|
|Flushing video frames.
|Writing index...
|
|Video stream:  540.037 kbit/s  (67504 B/s)  size: 673469 bytes
|9.977 secs  299 frames
|
|Audio stream: 1411.200 kbit/s  (176400 B/s)  size: 1764864 bytes
|10.005 secs

-- 
Tobias						PGP: http://8ef7ddba.uguu.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: muxer_fix.patch
Type: text/x-diff
Size: 1347 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20110623/c7a664f7/attachment.bin>


More information about the MPlayer-dev-eng mailing list