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 787621 - adaptivedemux: Pre-rolling problem after seeks on HLS streams
adaptivedemux: Pre-rolling problem after seeks on HLS streams
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.12.2
Other Linux
: Normal critical
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-09-13 12:10 UTC by rland
Modified: 2018-11-03 14:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Reproduce unit test code (12.92 KB, application/x-bzip)
2017-09-13 12:10 UTC, rland
Details

Description rland 2017-09-13 12:10:14 UTC
Created attachment 359702 [details]
Reproduce unit test code

gstplayer in pause state, seek to a specific point, will cause the pipeline to hangs.
Attached unit_test  will perform a seek to user specified position in PAUSED state,
such as:./gst-play http://10.9.44.116/seek_issure/index.m3u8 90000

The HLS file for reproduction is here:
https://drive.google.com/file/d/0B8t5E5lSOxhHOEo2akNZQW9MX2s/view?usp=sharing

The seek location set to 90000, 100% will hangs, audio seems unable to preroll success, and the video has been preroll completed.

backtrace:
---

Thread 24 (Thread 0x7fff8ef7f700 (LWP 24629))

  • #0 syscall
    at ../sysdeps/unix/sysv/linux/x86_64/syscall.S line 38
  • #1 g_cond_wait
    at gthread-posix.c line 1395
  • #2 gst_queue_loop
    at gstqueue.c line 1505
  • #3 gst_task_func
    at gsttask.c line 335
  • #4 default_func
    at gsttaskpool.c line 69
  • #5 g_thread_pool_thread_proxy
    at gthreadpool.c line 307
  • #6 g_thread_proxy
    at gthread.c line 784
  • #7 start_thread
    at pthread_create.c line 333
  • #8 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 109

Thread 23 (Thread 0x7fff8fd9a700 (LWP 24628))

  • #0 syscall
    at ../sysdeps/unix/sysv/linux/x86_64/syscall.S line 38
  • #1 g_cond_wait
    at gthread-posix.c line 1395
  • #2 gst_base_sink_wait_preroll
    at gstbasesink.c line 2267
  • #3 gst_base_sink_do_preroll
    at gstbasesink.c line 2361
  • #4 gst_base_sink_do_sync
    at gstbasesink.c line 2563
  • #5 gst_base_sink_chain_unlocked
    at gstbasesink.c line 3519
  • #6 gst_base_sink_chain_main
    at gstbasesink.c line 3676
  • #7 gst_base_sink_chain
    at gstbasesink.c line 3705
  • #8 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #9 gst_pad_push_data
    at gstpad.c line 4457
  • #10 gst_pad_push
    at gstpad.c line 4576
  • #11 gst_proxy_pad_chain_default
    at gstghostpad.c line 127
  • #12 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #13 gst_pad_push_data
    at gstpad.c line 4457
  • #14 gst_pad_push
    at gstpad.c line 4576
  • #15 gst_base_transform_chain
    at gstbasetransform.c line 2312
  • #16 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #17 gst_pad_push_data
    at gstpad.c line 4457
  • #18 gst_pad_push
    at gstpad.c line 4576
  • #19 gst_base_transform_chain
    at gstbasetransform.c line 2312
  • #20 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #21 gst_pad_push_data
    at gstpad.c line 4457
  • #22 gst_pad_push
    at gstpad.c line 4576
  • #23 gst_base_transform_chain
    at gstbasetransform.c line 2312
  • #24 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #25 gst_pad_push_data
    at gstpad.c line 4457
  • #26 gst_pad_push
    at gstpad.c line 4576
  • #27 gst_base_transform_chain
    at gstbasetransform.c line 2312
  • #28 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #29 gst_pad_push_data
    at gstpad.c line 4457
  • #30 gst_pad_push
    at gstpad.c line 4576
  • #31 gst_proxy_pad_chain_default
    at gstghostpad.c line 127
  • #32 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #33 gst_pad_push_data
    at gstpad.c line 4457
  • #34 gst_pad_push
    at gstpad.c line 4576
  • #35 gst_queue_push_one
    at gstqueue.c line 1365
  • #36 gst_queue_loop
    at gstqueue.c line 1517
  • #37 gst_task_func
    at gsttask.c line 335
  • #38 default_func
    at gsttaskpool.c line 69
  • #39 g_thread_pool_thread_proxy
    at gthreadpool.c line 307
  • #40 g_thread_proxy
    at gthread.c line 784
  • #41 start_thread
    at pthread_create.c line 333
  • #42 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 109

Thread 11 (Thread 0x7fffdcf11700 (LWP 24616))

  • #0 syscall
    at ../sysdeps/unix/sysv/linux/x86_64/syscall.S line 38
  • #1 g_cond_wait
    at gthread-posix.c line 1395
  • #2 _gst_data_queue_wait_non_empty
    at gstdataqueue.c line 554
  • #3 gst_data_queue_pop
    at gstdataqueue.c line 596
  • #4 gst_multi_queue_loop
    at gstmultiqueue.c line 1766
  • #5 gst_task_func
    at gsttask.c line 335
  • #6 default_func
    at gsttaskpool.c line 69
  • #7 g_thread_pool_thread_proxy
    at gthreadpool.c line 307
  • #8 g_thread_proxy
    at gthread.c line 784
  • #9 start_thread
    at pthread_create.c line 333
  • #10 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 109

Thread 10 (Thread 0x7fffdd953700 (LWP 24615))

  • #0 syscall
    at ../sysdeps/unix/sysv/linux/x86_64/syscall.S line 38
  • #1 g_cond_wait
    at gthread-posix.c line 1395
  • #2 gst_queue_chain_buffer_or_list
    at gstqueue.c line 1228
  • #3 gst_queue_chain
    at gstqueue.c line 1326
  • #4 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #5 gst_pad_push_data
    at gstpad.c line 4457
  • #6 gst_pad_push
    at gstpad.c line 4576
  • #7 gst_proxy_pad_chain_default
    at gstghostpad.c line 127
  • #8 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #9 gst_pad_push_data
    at gstpad.c line 4457
  • #10 gst_pad_push
    at gstpad.c line 4576
  • #11 gst_proxy_pad_chain_default
    at gstghostpad.c line 127
  • #12 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #13 gst_pad_push_data
    at gstpad.c line 4457
  • #14 gst_pad_push
    at gstpad.c line 4576
  • #15 gst_deinterlace_chain
    at gstdeinterlace.c line 2095
  • #16 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #17 gst_pad_push_data
    at gstpad.c line 4457
  • #18 gst_pad_push
    at gstpad.c line 4576
  • #19 gst_base_transform_chain
    at gstbasetransform.c line 2312
  • #20 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #21 gst_pad_push_data
    at gstpad.c line 4457
  • #22 gst_pad_push
    at gstpad.c line 4576
  • #23 gst_proxy_pad_chain_default
    at gstghostpad.c line 127
  • #24 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #25 gst_pad_push_data
    at gstpad.c line 4457
  • #26 gst_pad_push
    at gstpad.c line 4576
  • #27 gst_stream_synchronizer_sink_chain
    at gststreamsynchronizer.c line 711
  • #28 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #29 gst_pad_push_data
    at gstpad.c line 4457
  • #30 gst_pad_push
    at gstpad.c line 4576
  • #31 gst_proxy_pad_chain_default
    at gstghostpad.c line 127
  • #32 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #33 gst_pad_push_data
    at gstpad.c line 4457
  • #34 gst_pad_push
    at gstpad.c line 4576
  • #35 gst_selector_pad_chain
    at gstinputselector.c line 1131
  • #36 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #37 gst_pad_push_data
    at gstpad.c line 4457
  • #38 gst_pad_push
    at gstpad.c line 4576
  • #39 gst_proxy_pad_chain_default
    at gstghostpad.c line 127
  • #40 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #41 gst_pad_push_data
    at gstpad.c line 4457
  • #42 gst_pad_push
    at gstpad.c line 4576
  • #43 gst_proxy_pad_chain_default
    at gstghostpad.c line 127
  • #44 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #45 gst_pad_push_data
    at gstpad.c line 4457
  • #46 gst_pad_push
    at gstpad.c line 4576
  • #47 gst_video_decoder_clip_and_push_buf
    at gstvideodecoder.c line 3200
  • #48 gst_video_decoder_finish_frame
    at gstvideodecoder.c line 3055
  • #49 gst_ffmpegviddec_video_frame
    at gstavviddec.c line 1679
  • #50 gst_ffmpegviddec_frame
    at gstavviddec.c line 1740
  • #51 gst_ffmpegviddec_handle_frame
    at gstavviddec.c line 1853
  • #52 gst_video_decoder_decode_frame
    at gstvideodecoder.c line 3410
  • #53 gst_video_decoder_chain_forward
    at gstvideodecoder.c line 2137
  • #54 gst_video_decoder_chain
    at gstvideodecoder.c line 2451
  • #55 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #56 gst_pad_push_data
    at gstpad.c line 4457
  • #57 gst_pad_push
    at gstpad.c line 4576
  • #58 gst_base_transform_chain
    at gstbasetransform.c line 2312
  • #59 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #60 gst_pad_push_data
    at gstpad.c line 4457
  • #61 gst_pad_push
    at gstpad.c line 4576
  • #62 gst_base_parse_push_frame
    at gstbaseparse.c line 2521
  • #63 gst_base_parse_handle_and_push_frame
    at gstbaseparse.c line 2338
  • #64 gst_base_parse_finish_frame
    at gstbaseparse.c line 2679
  • #65 gst_h264_parse_handle_frame
    at gsth264parse.c line 1275
  • #66 gst_base_parse_handle_buffer
    at gstbaseparse.c line 2146
  • #67 gst_base_parse_chain
    at gstbaseparse.c line 3228
  • #68 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #69 gst_pad_push_data
    at gstpad.c line 4457
  • #70 gst_pad_push
    at gstpad.c line 4576
  • #71 gst_single_queue_push_one
    at gstmultiqueue.c line 1608
  • #72 gst_multi_queue_loop
    at gstmultiqueue.c line 1920
  • #73 gst_task_func
    at gsttask.c line 335
  • #74 default_func
    at gsttaskpool.c line 69
  • #75 g_thread_pool_thread_proxy
    at gthreadpool.c line 307
  • #76 g_thread_proxy
    at gthread.c line 784
  • #77 start_thread
    at pthread_create.c line 333
  • #78 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 109

Thread 9 (Thread 0x7fffde7fc700 (LWP 24614))

  • #0 syscall
    at ../sysdeps/unix/sysv/linux/x86_64/syscall.S line 38
  • #1 g_cond_wait
    at gthread-posix.c line 1395
  • #2 gst_data_queue_push
    at gstdataqueue.c line 521
  • #3 gst_multi_queue_chain
    at gstmultiqueue.c line 2109
  • #4 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #5 gst_pad_push_data
    at gstpad.c line 4457
  • #6 gst_pad_push
    at gstpad.c line 4576
  • #7 gst_ts_demux_push_pending_data
    at tsdemux.c line 2756
  • #8 gst_ts_demux_handle_packet
    at tsdemux.c line 2828
  • #9 gst_ts_demux_push
    at tsdemux.c line 2897
  • #10 mpegts_base_chain
    at mpegtsbase.c line 1414
  • #11 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #12 gst_pad_push_data
    at gstpad.c line 4457
  • #13 gst_pad_push
    at gstpad.c line 4576
  • #14 gst_single_queue_push_one
    at gstmultiqueue.c line 1608
  • #15 gst_multi_queue_loop
    at gstmultiqueue.c line 1920
  • #16 gst_task_func
    at gsttask.c line 335
  • #17 default_func
    at gsttaskpool.c line 69
  • #18 g_thread_pool_thread_proxy
    at gthreadpool.c line 307
  • #19 g_thread_proxy
    at gthread.c line 784
  • #20 start_thread
    at pthread_create.c line 333
  • #21 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 109

Thread 8 (Thread 0x7fffdeffd700 (LWP 24613))

  • #0 syscall
    at ../sysdeps/unix/sysv/linux/x86_64/syscall.S line 38
  • #1 g_cond_wait
    at gthread-posix.c line 1395
  • #2 gst_data_queue_push
    at gstdataqueue.c line 521
  • #3 gst_multi_queue_chain
    at gstmultiqueue.c line 2109
  • #4 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #5 gst_pad_push_data
    at gstpad.c line 4457
  • #6 gst_pad_push
    at gstpad.c line 4576
  • #7 gst_adaptive_demux_stream_push_buffer
    at gstadaptivedemux.c line 2354
  • #8 gst_hls_demux_handle_buffer
    at gsthlsdemux.c line 893
  • #9 gst_hls_demux_data_received
    at gsthlsdemux.c line 1004
  • #10 _src_chain
    at gstadaptivedemux.c line 2499
  • #11 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #12 gst_pad_push_data
    at gstpad.c line 4457
  • #13 gst_pad_push
    at gstpad.c line 4576
  • #14 gst_proxy_pad_chain_default
    at gstghostpad.c line 127
  • #15 gst_pad_chain_data_unchecked
    at gstpad.c line 4205
  • #16 gst_pad_push_data
    at gstpad.c line 4457
  • #17 gst_pad_push
    at gstpad.c line 4576
  • #18 gst_queue_push_one
    at gstqueue.c line 1365
  • #19 gst_queue_loop
    at gstqueue.c line 1517
  • #20 gst_task_func
    at gsttask.c line 335
  • #21 default_func
    at gsttaskpool.c line 69
  • #22 g_thread_pool_thread_proxy
    at gthreadpool.c line 307
  • #23 g_thread_proxy
    at gthread.c line 784
  • #24 start_thread
    at pthread_create.c line 333
  • #25 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 109

Thread 7 (Thread 0x7fffdf7fe700 (LWP 24612))

  • #0 syscall
    at ../sysdeps/unix/sysv/linux/x86_64/syscall.S line 38
  • #1 g_cond_wait
    at gthread-posix.c line 1395
  • #2 gst_adaptive_demux_stream_download_uri
    at gstadaptivedemux.c line 3056
  • #3 gst_adaptive_demux_stream_download_fragment
    at gstadaptivedemux.c line 3274
  • #4 gst_adaptive_demux_stream_download_loop
    at gstadaptivedemux.c line 3588
  • #5 gst_task_func
    at gsttask.c line 335
  • #6 default_func
    at gsttaskpool.c line 69
  • #7 g_thread_pool_thread_proxy
    at gthreadpool.c line 307
  • #8 g_thread_proxy
    at gthread.c line 784
  • #9 start_thread
    at pthread_create.c line 333
  • #10 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 109

Thread 6 (Thread 0x7fffdffff700 (LWP 24611))

  • #0 syscall
    at ../sysdeps/unix/sysv/linux/x86_64/syscall.S line 38
  • #1 g_cond_wait
    at gthread-posix.c line 1395
  • #2 gst_task_func
    at gsttask.c line 320
  • #3 default_func
    at gsttaskpool.c line 69
  • #4 g_thread_pool_thread_proxy
    at gthreadpool.c line 307
  • #5 g_thread_proxy
    at gthread.c line 784
  • #6 start_thread
    at pthread_create.c line 333
  • #7 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 109

Thread 3 (Thread 0x7fffee096700 (LWP 24608))

  • #0 syscall
    at ../sysdeps/unix/sysv/linux/x86_64/syscall.S line 38
  • #1 g_cond_wait
    at gthread-posix.c line 1395
  • #2 gst_task_func
    at gsttask.c line 320
  • #3 default_func
    at gsttaskpool.c line 69
  • #4 g_thread_pool_thread_proxy
    at gthreadpool.c line 307
  • #5 g_thread_proxy
    at gthread.c line 784
  • #6 start_thread
    at pthread_create.c line 333
  • #7 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 109

Comment 1 rland 2017-09-14 02:09:09 UTC
Both playbin2 and playbin3 fail.

Anybody can help verify that this bug is the same as Bug https://bugzilla.gnome.org/show_bug.cgi?id=736655(basesink: preroll issue for some clips which audio is shorter than video)?

I'm not sure because it was seeking to 90000 (1 minute 30 seconds), exactly fragment 8.ts , but 8.ts video duration = 10.680s, audio duration = 10.581s, their diff is really small.
Comment 2 rland 2017-09-14 09:55:50 UTC
I looked into it further and found that it seems that the queue behind the demux module has a relationship,the demux component pauses once the audio/video pipeline is filled up with data. This means that now the transport stream is no longer processed and required amount of a/v data is not passed on. The audio chain does not get a complete buffer so is stuck in prerolling. 

default queue size:5s,which filled up with < 1min25sec 'data,but we want > 1min30sec data(SEGMENT time segment start=0:01:30.000000000 )  

default gstsegment.c:835:gst_segment_to_running_time: position(84600000000) < start(90000000000)
default gstsegment.c:835:gst_segment_to_running_time: position(84600000000) < start(90000000000)
...

So the situation is ,undecoded queue data filled with garbage data, and blocked the demux component, but vqueue / aqueue  no valid data to complete preroll.

I verified, if the queue is set to <(default_size=5s) + (1min30sec-1min25sec=5s)= 10s>, preroll ok.

My question is, since we already have a new segment, why not drop most of data < newsegment.start to avoid the above situation?

Such as queue max_size = 5s, we make sure that the new data enqueue  meets following requirements: 
* newdata.position + 1s < segment.start ,drop (1s is just an example, perhaps a value between 1 and 5 s?) 

Above is only my personal understanding, please do not hesitate to correct me. -)
Comment 3 Sebastian Dröge (slomo) 2017-09-14 10:08:50 UTC
Your analysis sounds plausible, and this seems to be completely unrelated to GstPlayer indeed.

It might be related to how adaptivedemux is doing things though, so let's move it there for now.
Comment 4 rland 2017-09-15 05:36:17 UTC
(In reply to Sebastian Dröge (slomo) from comment #3)
> Your analysis sounds plausible, and this seems to be completely unrelated to
> GstPlayer indeed.
> 
Yes,just used to write the test code using Gstplayer.

> It might be related to how adaptivedemux is doing things though, so let's
> move it there for now.

gstadaptivedemux.c gst_adaptive_demux_prepare_streams()'s code annotation, seems to have dealt with this situation?
-----------------
 /* The demuxer segment is just built from seek events, but for each stream
     * we have to adjust segments according to the current period and the
     * stream specific presentation time offset.
     *
     * For each period, buffer timestamps start again from 0. Additionally the
     * buffer timestamps are shifted by the stream specific presentation time
     * offset, so the first buffer timestamp of a period is 0 + presentation
     * time offset. If the stream contains timestamps itself, this is also
     * supposed to be the presentation time stored inside the stream.
     *
     * The stream time over periods is supposed to be continuous, that is the
     * buffer timestamp 0 + presentation time offset should map to the start
     * time of the current period.
     *
     *
     * The adjustment of the stream segments as such works the following.
     *
     * If the demuxer segment start is bigger than the period start, this
     * means that we have to drop some media at the beginning of the current
     * period, e.g. because a seek into the middle of the period has
     * happened. The amount of media to drop is the difference between the
     * period start and the demuxer segment start, and as each period starts
     * again from 0, this difference is going to be the actual stream's
     * segment start. As all timestamps of the stream are shifted by the
     * presentation time offset, we will also have to move the segment start
     * by that offset.
     *
     * Likewise, the demuxer segment stop value is adjusted in the same
     * fashion.
     *
     * Now the running time and stream time at the stream's segment start has
     * to be the one that is stored inside the demuxer's segment, which means
     * that segment.base and segment.time have to be copied over (done just
     * above)
-----------------
Comment 5 GStreamer system administrator 2018-11-03 14:13:25 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/609.