mpeg2dec: Flushing during seek breaks libmpeg2 decoding
Submitted by Andrew Eikum
Link to original bug (#759976)
Description
(Possibly a duplicate of https://bugzilla.gnome.org/show_bug.cgi?id=723603 ?)
OS: Arch Linux (up to date as of yesterday)
libmpeg2 package version 0.5.1-5
I have two mpg files that fail to seek in Totem. They are distributed with the Steam version of Grand Theft Auto: Vice City.
[aeikum@aeikum movies]$ file *
GTAtitles.mpg: MPEG sequence, v1, system multiplex
Logo.mpg: MPEG sequence, v1, system multiplex
[aeikum@aeikum movies]$ md5sum *
d469239863d8dd5d27a758ec407d3e5a GTAtitles.mpg
5d5ff3db65ba37a0d5f0474a96ac51ea Logo.mpg
Totem successfully plays the videos. However, if you try to seek any length, Totem will display a dialog saying, "No valid frames decoded before end of stream" and quit playing the video. Seeking is possible with VLC.
A little extra debug printing in gst-plugins-ugly shows the problem occurs after executing gst_mpeg2dec_flush during the seek operation:
mpeg2dec gstmpeg2dec.c:1103:gst_mpeg2dec_handle_frame:<mpeg2dec1>
parse state 0
mpeg2dec gstmpeg2dec.c:1103:gst_mpeg2dec_handle_frame:<mpeg2dec1>
parse state 7
mpeg2dec gstmpeg2dec.c:1103:gst_mpeg2dec_handle_frame:<mpeg2dec1>
parse state 4
mpeg2dec gstmpeg2dec.c:974:handle_picture:<mpeg2dec1>
stride
mpeg2dec gstmpeg2dec.c:1103:gst_mpeg2dec_handle_frame:<mpeg2dec1>
parse state 0
mpeg2dec gstmpeg2dec.c:246:gst_mpeg2dec_flush:<mpeg2dec1>
flushing decoder
mpeg2dec gstmpeg2dec.c:246:gst_mpeg2dec_flush:<mpeg2dec1>
flushing decoder
mpeg2dec gstmpeg2dec.c:246:gst_mpeg2dec_flush:<mpeg2dec1>
flushing decoder
mpeg2dec gstmpeg2dec.c:246:gst_mpeg2dec_flush:<mpeg2dec1>
flushing decoder
mpeg2dec gstmpeg2dec.c:1103:gst_mpeg2dec_handle_frame:<mpeg2dec1>
parse state 0
mpeg2dec gstmpeg2dec.c:1103:gst_mpeg2dec_handle_frame:<mpeg2dec1>
parse state 0
mpeg2dec gstmpeg2dec.c:1103:gst_mpeg2dec_handle_frame:<mpeg2dec1>
parse state 0
mpeg2dec gstmpeg2dec.c:1103:gst_mpeg2dec_handle_frame:<mpeg2dec1>
parse state 0
mpeg2dec gstmpeg2dec.c:1103:gst_mpeg2dec_handle_frame:<mpeg2dec1>
parse state 0
States {0,7,4} are normal operation. After flushing, mpeg2_parse always returns STATE_BUFFER(== 0) no matter how much data is fed to mpeg2_buffer. gst_mpeg2dec_flush executes mpeg2_reset and mpeg2_skip.
Attached is a GST_DEBUG=9 log of the Totem session, trimmed to the first 600000 lines (expands to 112 MB).
Version: 1.6.2