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 300682 - [mpeg2dec] fails to play mpgtx -j joined files to the end
[mpeg2dec] fails to play mpgtx -j joined files to the end
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-ugly
git master
Other All
: Normal normal
: 0.10.3
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 328625 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-04-14 22:47 UTC by Jouni.Lohikoski
Modified: 2006-02-27 14:52 UTC
See Also:
GNOME target: ---
GNOME version: 2.7/2.8


Attachments
patch implementing Tim's idea (2.15 KB, patch)
2006-02-26 11:23 UTC, Luca Ognibene
committed Details | Review

Description Jouni.Lohikoski 2005-04-14 22:47:28 UTC
Please describe the problem:
When playing MPEG1 or MPEG2 video file which has been made by mpgtx 
< http://mpgtx.sourceforge.net/ >
by joining two or more movie clips together, gst-player and Totem (gstreamer)
won't play the video file to the end, but halts there where the first clip ends.
The sound is though played to the end.

Steps to reproduce:
1. Get two or more MPEG1/2 files, 1.mpg 2.mpg
2. Join them with mpgtx: mpgtx -j 1.mpg 2.mpg -o test.mpg
3. gst-player test.mpg


Actual results:
gst-player ends showing video to the last frame of 1.mpg, stalls, sound
continues.


Expected results:
To play it to the end of 2.mpg. ffplay does this. So does xine.
So does "mplayer -vc ffmpeg12"


Does this happen every time?
Yes.

Other information:
Seems like a bug is also in libmpeg2, its dev mailing list has been
informed.
One mpgtx -j joined test video file can be found in
<
ftp://mplayerhq.hu/MPlayer/incoming/mpgtx_-j_-o_test.mpg_1.mpg_2.mpg_3.mpg-video_fails_in_mplayer_works_in_xine.mpg
>
Comment 1 Luca Ognibene 2005-09-19 18:40:21 UTC
Does the problem still exist? Can you provide another link? The link that you
have posted doesn't exist anymore..
Comment 2 Jouni.Lohikoski 2006-02-20 19:42:53 UTC
Sorry not to report this earlier, but I am not currently practically possible to update to the latest version of gstreamer to test.

With FC3 and gstreamer v0.8.10 (and Totem v1.0.1) the problem still does exist.
I use gstreamer binaries from
http://gstreamer.freedesktop.org/pkg/fedora/3/i386/yum/gst/RPMS/

If someone makes FC3 rpm packages of v0.8.12 or I upgrade to FC4, I'll tell what happens with v0.8.12 (or v0.8.11)

Before 'mplayer -vc mpeg12' failed the same way to play these kind of (broken) files and 'mplayer -vc ffmpeg' succeeded. But now later also 'mplayer -vc mpeg12' succees to play fine. (MPlayer 1.0pre7-3.4.3, libmpeg2-v0.4.0b)

So I guess if later gstreamer uses newer libmpeg2, the problem would be fixed.

(the example video attachment I tried to include was too big ~4MiB to be accepted here)
Comment 3 Luca Ognibene 2006-02-21 20:48:19 UTC
Can you please upload the file somewhere ? If you can't upload it feel free to mail me (luogni at tin dot it), i'll setup a ftp server on my pc so you can upload it! thanks for your report!
Comment 4 Luca Ognibene 2006-02-25 11:55:19 UTC
Thanks for the file! 
I can replicate the bug with current cvs and also in mpeg2dec (the program) so it seems an upstream issue. Using ffdec_mpeg2video instead mpeg2dec make it works fine.
I've only seen a problem:
 - in gstmpeg2dec.c mpeg2_parse returns STATE_INVALID and mpeg2dec creates a warning and return GST_FLOW_ERROR.. 
I think this is wrong, it should:
or return GST_FLOW_ERROR and call GST_ELEMENT_ERROR
or return GST_FLOW_OK and call GST_OBJECT_WARNING 

The problem is that: ... ! mpegdemux ! mpeg2dec ! fakesink works fine (just some warnings) but ... ! mpegdemux name=m m.video_00 ! queue ! mpeg2dec ! fakesink fails because queue fails if the ret value is different than GST_FLOW_OK.

Changing "return GST_FLOW_ERROR" to "return GST_FLOW_OK" make this file works fine. Should i commit? 
Comment 5 Tim-Philipp Müller 2006-02-25 14:19:58 UTC
But then it wouldn't error out if there is a real error, would it?

Maybe we could keep a counter somewhere and try and restart once or twice when we get STATE_INVALID and only error out after getting three STATE_INVALID in a row, or something like that?
Comment 6 Luca Ognibene 2006-02-26 11:23:58 UTC
Created attachment 60145 [details] [review]
patch implementing Tim's idea
Comment 7 Luca Ognibene 2006-02-26 11:28:57 UTC
btw, i've also looked at other users of libmpeg2 and a lot of them(mplayer, vlc, ..) don't think STATE_INVALID is a fatal error. 
Comment 8 Christian Fredrik Kalager Schaller 2006-02-27 10:34:59 UTC
*** Bug 328625 has been marked as a duplicate of this bug. ***
Comment 9 Tim-Philipp Müller 2006-02-27 14:52:07 UTC
Committed to CVS with some minor modifications (style/indentation changes; throw GST_ELEMENT_ERROR when we return GST_FLOW_ERROR, so a meaningful error messages is posted on the bus; reset dec->error_count in gst_mpeg2dec_reset()):

2006-02-27  Luca Ognibene  <luogni at tin dot it>

        * ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_init),
        (gst_mpeg2dec_reset), (gst_mpeg2dec_chain):
        * ext/mpeg2dec/gstmpeg2dec.h:
          Don't treat STATE_INVALID as fatal error; throw an error
          only after five consecutive decoding errors. Makes decoding
          mpeg streams more robust and fixes playback of joined clips
          (#300682).