GNOME Bugzilla – Bug 623860
mpegpsdemux: sends segment and gap events with invalid time after seek
Last modified: 2016-05-15 09:34:30 UTC
Created attachment 165494 [details] sample mpg file that show inconsistent seeking behavior. Given the attached file (xylophone.mpg), creating a gstreamer pipeline using playbin or decodebin has the following issues: 1) Seeking is either unsupported or invalid 2) Sporadically pipeline creation fails This causes issues for applications that need better frame accuracy for MPEG-1 files. You can see this behavior in totem by simply open in the file in totem and using the transport bar to seek around. Often the file will seek backwards and forwards randomly. This can be reproduced at the command line using gst-launch-0.10: gst-launch-0.10 -tm filesrc location=xylophone.mpg ! decodebin name=decoder decoder. ! ffmpegcolorspace ! 'video/x-raw-rgb, bpp=(int)24, depth=(int)24,endianness=(int)BIG_ENDIAN,red_mask=(int)16711680,green_mask=(int)65280,blue_mask=(int)255' ! fakesink decoder. ! fakesink Reproduced this issue in both Debian 5 (lenny) and Ubuntu 10.04
Pipeline creation works always with 1.0 here, but seeking fails: (totem:23212): GStreamer-CRITICAL **: gst_event_new_gap: assertion 'GST_CLOCK_TIME_IS_VALID (timestamp)' failed Program received signal SIGTRAP, Trace/breakpoint trap.
+ Trace 232413
Thread 140736308041472 (LWP 23224)
917 gst_flups_demux_send_segment (demux, stream, GST_CLOCK_TIME_NONE); 918 919 GST_LOG_OBJECT (demux, 920 "Sending gap update to pad %s time %" GST_TIME_FORMAT, 921 GST_PAD_NAME (stream->pad), GST_TIME_ARGS (new_start)); 922 event = 923 gst_event_new_gap (stream->last_ts, new_start - stream->last_ts); 924 gst_pad_push_event (stream->pad, event); 925 stream->last_ts = new_start; 926 }
*** Bug 686301 has been marked as a duplicate of this bug. ***
Created attachment 327789 [details] [review] mpegdemux: don't do bogus adjustments on seek if we have no first_pts Immediate reason is that demux->first_pts is -1 which gets us GST_CLOCK_TIME_NONE as first_pts which we then use in adjustment calculations. Not sure why first_pts is not set later though if we didn't find it initially.
Created attachment 327920 [details] [review] mpegdemux: Handle system header when scanning for timestamps. When scanning for SCR / PTS / DTS, handle the case where the pack header is followed by the optional system header, so we can correctly collect timestamps in such cases.
We should apply both patches - the guard still makes sense in the case of a braindead file that has no PTS in the first / last 4MB for whatever reason.