GNOME Bugzilla – Bug 733490
tsdemux: H264 seeking broken in push mode
Last modified: 2014-07-22 13:57:29 UTC
The patch in Bug #675132 breaks seeking in push mode in files with H264 video. Here is a log of what happens: stm0: seek to 959864ms from start tsdemux: <tsdemux0> stream PTS 0:18:02.349048482 DTS 0:18:02.229048482 tsdemux: Moving data forward by 19 bytes (packet_size:37899, have:184) tsdemux: query seeking basesrc: <source> query seeking returns 0 tsdemux: <tsdemux0:audio_0045> stream:0x74f25cd8, pid:0x0045 stream_type:15 state:2 tsdemux: <tsdemux0:audio_0045> stream->pts 0:18:01.469048482 tsdemux: <tsdemux0:audio_0045> Pushing buffer with PTS: 0:18:01.469048482 , DTS: 99:99:99.999999999 tsdemux: <tsdemux0:audio_0045> Returned ok tsdemux: <tsdemux0:video_0044> Got event seek mpegtsbase: seek event, rate: 1.000000 start: 0:15:59.864000000 stop: 99:99:99.999999999 mpegtsbase: <tsdemux0> sending flush start basesrc: <source> handle event flush-start event: 0x80932d0, time 99:99:99.999999999, seq-num 881, (NULL) basesrc: <source> flushing 1, live_play 0 tsdemux: <tsdemux0:video_0044> Got event qos souphttpsrc: <source> unlock() tsdemux: <tsdemux0:audio_0045> combined ok basesrc: <source> no sync needed basesrc: <source> buffer ok souphttpsrc: <source> unlock_stop() basesrc: <source> pausing after gst_pad_push() = flushing basesrc: <source> pausing task, reason flushing mpegtsbase: <tsdemux0> sending flush stop basesrc: <source> handle event flush-stop event: 0x80932d0, time 99:99:99.999999999, seq-num 881, GstEventFlushStop, reset-time=(boolean)true; basesrc: <source> flushing 0, live_play 1 tsdemux: flushing stream 0x74f2a570 tsdemux: flushing stream 0x74f25cd8 tsdemux: seek event, rate: 1.000000 start: 0:15:59.864000000 stop: 99:99:99.999999999 tsdemux: <tsdemux0> configuring seek mpegtsbase: <tsdemux0> sending flush stop [New Thread 0x6f8ffb40 (LWP 2998)] mpegtsbase: Pulling data from 592253403 (fbxmms:2973): GStreamer-CRITICAL **: pullrange on pad tsdemux0:sink but it was not activated in pull mode I think this happens because the h264 keyframe scanning function sets the base->mode value to SEEKING instead of PUSHING. The mpegts_base_handle_seek_event() function is then called in the wrong mode and the push mode seek specific handling is not used. IMHO the simplest solution is to disable keyframe scanning in push-mode. This is counter productive anyway since the scan triggers backwards seeking, which shouldn't be done in push mode.
Indeed, we should disable it in push-mode. Weird this one crept through
It goes into this code path without the ACCURATE seek flag ?
Yes it does
Could you provide specific steps to reproduce, ideally using gst-validate?
totem pushfile:///path/to/foo.ts
gst-validate-1.0 --set-scenario /usr/share/gstreamer-1.0/validate-scenario/seek_forward.scenario http://absolut.zogzog.org/share/samples/ts/111585096.ts ! tsdemux ! fakesink
Thanks! There were two issues there: the codepath was indeed activated when seeking without the accurate flag, and no scanning should be performed when operating in push mode. I'll attach patches.
Created attachment 281327 [details] [review] Fixes the first issue
Created attachment 281328 [details] [review] Fixes the second issue
Thanks Mathieu, those patches do fix the regressions I had.
Comment on attachment 281328 [details] [review] Fixes the second issue Shouldn't we scan for keyframes nonetheless if ACCURATE seeking was requested?
Arnaud said backwards seeking should not happen in push mode, I suppose he's got good reasons to say so, so I deactivated accurate seeking altogether as suggested.
I think it should still be done in push mode if ACCURATE seeking is requested. You'll however have to detect properly if upstream can seek.
commit ab1c328bb1544d5c9813abb31075ce52094965ba Author: Mathieu Duponchelle <mathieu.duponchelle@opencreed.com> Date: Mon Jul 21 18:22:18 2014 +0200 tsdemux: Do not scan for keyframe when in push mode. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=733490 commit 58b2d582223ba35337d226b8084737e5b2431832 Author: Mathieu Duponchelle <mathieu.duponchelle@opencreed.com> Date: Mon Jul 21 18:21:41 2014 +0200 tsdemux: Do not scan for a keyframe in non-accurate mode. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=733490 Both patches pushed on master and 1.4