After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 328487 - mpegdemux loops infinitely with corrupt MPEG file
mpegdemux loops infinitely with corrupt MPEG file
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-ugly
git master
Other All
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-01-24 20:52 UTC by Fabrizio Gennari
Modified: 2009-03-06 09:18 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Fabrizio Gennari 2006-01-24 20:52:11 UTC
Steps to reproduce:
1. type "touch zero.mpg" in order to have a zero-length file
2. launch the pipeline "gst-launch-0.10 filesrc location=zero.mpg ! mpegdemux
.video_00 ! ffdec_mpeg2video ! xvimagesink"
3. all the threads get stuck 


Stack trace:


Other information:
I discovered this bug because I have some .mpg files whose first 4 bytes are 00
00 01 B3, and not 00 00 01 BA as real MPEG PS files should be. GStreamer does
not play those, and this could be right (although FFmpeg and Windows Media
Player do play them, so making GStreamer's MPEG demuxer more tolerant could be
an option).

However, what is unacceptable is that GStreamer never exits. Apparently,
gst_packetize_read tries unsuccessfully to find the sequence 00 00 01 BA, at the
end of the file it returns GST_FLOW_RESEND, and gst_mpeg_parse_chain returns
GST_FLOW_OK.
This happens for all non-MPEG files fed to the MPEG demuxer, not only with MPEG
files starting with 00 00 01 B3: even with empty files or files made of all zeros
Comment 1 Andy Wingo 2006-01-27 12:10:17 UTC
This could be related to bug #320084.
Comment 2 Wim Taymans 2006-03-24 20:41:47 UTC
related to bug #320084. In this case an element was added to the pipeline (videosink) that will never preroll since nothing is connected to it.

the proper way of creating a pipeline is to only add elements that are needed.

We could post an error message in the source if the file has a length of 0.

did not test the 000001ba cases yet. 

Comment 3 Tim-Philipp Müller 2006-05-08 10:44:53 UTC
> However, what is unacceptable is that GStreamer never exits.
> Apparently, gst_packetize_read tries unsuccessfully to find
> the sequence 00 00 01 BA, at the end of the file it returns
> GST_FLOW_RESEND, and gst_mpeg_parse_chain returns GST_FLOW_OK.
> This happens for all non-MPEG files fed to the MPEG demuxer,
> not only with MPEG files starting with 00 00 01 B3: even with
> empty files or files made of all zeros

Any suggestions on what the best way to fix this is?

Maybe the packetizer should count the number of bytes dropped since the last sync when trying to sync, and throw an error if it hasn't been able to find a sync for N bytes (and on receiving EOS if it hasn't found a single sync yet)?

Maybe it should throw an error if the file doesn't start with a clean sync (or is that too much of an assumption to make?)?
Comment 4 Wim Taymans 2006-07-10 16:05:57 UTC
In EOS, check if some stream was found, if not, post en error. This would handle the empty file and the no-sync cases.

Not sure what the max sync-byte distance is in mpeg, should not be more than a few 100K
Comment 5 Wim Taymans 2006-07-10 16:06:34 UTC
moved to normal, this applies to all demuxers.
Comment 6 Edward Hervey 2009-03-06 09:18:56 UTC
Whether with hand-crafted launch lines (like in the initial report) or with playbin/playbin2 everything exits normally now with empty files.

Closing bug.