<div dir="ltr"><div dir="ltr">since the previous log shows gst bin/pipeline reset clock to GstSystemClock after I called gst_pipeline_set_clock(),<div>I tried to call gst_pipeline_set_clock() after pipeline reach PLAYING state.</div><div><br></div><div>then the clock seems take effect, (my func to generate clock time is called); but playback stuck after several frame.</div><div>seems time mismatch between element base_time and new clock time</div><div><div><br></div><div>18283 0:00:01.159746000 26457 0xffffa80060f0 DEBUG               basesink gstbasesink.c:2603:gst_base_sink_do_sync:<my_sink> possibly waiting for clock to reach 0:00:01.000000000, adjusted 0:00:01.           000000000</div><div>18284 0:00:01.159788500 26457     0x203b60a0 LOG                  adapter gstadapter.c:974:gst_adapter_get_buffer:<GstAdapter@0x203a3000> getting buffer of 950 bytes</div><div>18285 0:00:01.159843250 26457 0xffffa80060f0 LOG                 basesink gstbasesink.c:2177:gst_base_sink_wait_clock:<my_sink> time 0:00:01.000000000, base_time 1:51:09.499730750</div></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Halley Zhao <<a href="mailto:aihua.halley.zhao@gmail.com">aihua.halley.zhao@gmail.com</a>> 于2019年5月20日周一 上午10:23写道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br><div class="gmail_quote"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Expert:<div>  I created my customized pipeline as "appsrc-->h264parse-->v4l2h264dec-->waylandsink".</div><div>  then I try to use my customized clock to control the video playback (in fact, I used the above pipeline inside a bigger/complete pipeline). however, I found gst_pipeline_set_clock() doens't work for me.</div><div>  </div><div>  I call gst_pipeline_set_clock() before setting the pipeline to PLAYING state, and gst logs shows it take effect (the clock is set to each element); but when the pipeline changed state to PAUSED, gst_bin_provide_clock_func() return NULL (it is strange), and gst_system_clock_obtain() is called to update the clock.</div><div><br></div><div>  I'm not sure whether there is something wrong in my code, or potential mistake in gst base code.</div><div>here is my sample code and gst logs(GST_DEBUG=*:6).</div><div>I filtered the log with 'clock' as key word as attachment since it is big.</div><div>the piece log with context is as following:</div><div><div>17526 0:00:00.750638375  8744 0xffffa4002580 DEBUG                GST_BUS gstbus.c:839:gst_bus_source_dispatch:<bus1> source 0x3d21dc00 calling dispatch with state-changed message: 0xffff9c003400, time 99:99:99.999999999, seq-num 43, element 'my_pipeline',                    GstMessageStateChanged, old-state=(GstState)GST_STATE_READY, new-state=(GstState)GST_STATE_PAUSED, pending-state=(GstState)GST_STATE_PLAYING;</div><div>17527 (bus_call, 87)my_pipeline state change, old state: READY, new state: PAUSED</div><div>17528 0:00:00.750744875  8744     0x3d233770 DEBUG                GST_BUS gstbus.c:360:gst_bus_post:<bus1> [msg 0xffff9c003380] pushed on async queue</div><div>17529 0:00:00.750781500  8744 0xffffa4002580 LOG              GST_MESSAGE gstmessage.c:208:_gst_message_free: finalize message 0xffff9c003400, state-changed from my_pipeline</div><div>17530 0:00:00.750810750  8744     0x3d233770 DEBUG                    bin gstbin.c:3484:bin_handle_async_done:<my_pipeline> all async-done, starting state continue</div><div>17531 0:00:00.750875750  8744 0xffffa4002580 DEBUG                GST_BUS gstbus.c:844:gst_bus_source_dispatch:<bus1> source 0x3d21dc00 handler returns 1</div><div>17532 0:00:00.750890750  8744     0x3d233770 DEBUG                    bin gstbin.c:3289:bin_push_state_continue:<my_pipeline> pushing continue on thread pool</div><div>17533 0:00:00.750950875  8744 0xffffa4002580 LOG                  GST_BUS gstbus.c:522:gst_bus_timed_pop_filtered:<bus1> have 1 messages</div><div>17534 0:00:00.750982000  8744 0xffffa4002580 LOG                 GST_POLL gstpoll.c:314:release_wakeup: 0x3d154a30: release</div><div>17535 0:00:00.751025375  8744 0xffffa4002580 DEBUG                GST_BUS gstbus.c:546:gst_bus_timed_pop_filtered:<bus1> got message 0xffff9c003380, async-done from my_pipeline, type mask is 4294967295</div><div>17536 0:00:00.751072625  8744 0xffffa4002580 DEBUG                GST_BUS gstbus.c:839:gst_bus_source_dispatch:<bus1> source 0x3d21dc00 calling dispatch with async-done message: 0xffff9c003380, time 99:99:99.999999999, seq-num 42, element 'my_pipeline',                       GstMessageAsyncDone, running-time=(guint64)18446744073709551615;</div><div>17537 0:00:00.751152000  8744 0xffffa4002580 LOG              GST_MESSAGE gstmessage.c:208:_gst_message_free: finalize message 0xffff9c003380, async-done from my_pipeline</div><div>17538 0:00:00.751184000  8744     0x3d233770 DEBUG                GST_BUS gstbus.c:353:gst_bus_post:<bus0> [msg 0xffff9c003300] dropped</div><div>17539 0:00:00.751197000  8744 0xffffa4002580 DEBUG                GST_BUS gstbus.c:844:gst_bus_source_dispatch:<bus1> source 0x3d21dc00 handler returns 1</div><div>17540 0:00:00.751258000  8744     0x3d233770 DEBUG               basesink gstbasesink.c:2265:gst_base_sink_wait_preroll:<my_sink> waiting in preroll for flush or PLAYING</div><div>17541 0:00:00.751328500  8744 0xffff9c007680 DEBUG                    bin gstbin.c:3224:gst_bin_continue_func:<my_pipeline> waiting for state lock</div><div>17542 0:00:00.751413500  8744 0xffff9c007680 DEBUG                    bin gstbin.c:3227:gst_bin_continue_func:<my_pipeline> doing state continue</div><div>17543 0:00:00.751454875  8744 0xffff9c007680 INFO              GST_STATES gstbin.c:3248:gst_bin_continue_func:<my_pipeline> continue state change PAUSED to PLAYING, final PLAYING</div><div>17544 0:00:00.751511250  8744 0xffff9c007680 DEBUG               pipeline gstpipeline.c:412:gst_pipeline_change_state:<my_pipeline> selecting clock and base_time</div><div>17545 0:00:00.751552375  8744 0xffff9c007680 DEBUG               pipeline gstpipeline.c:433:gst_pipeline_change_state:<my_pipeline> Need to update start_time</div><div>17546 0:00:00.751589625  8744 0xffff9c007680 DEBUG               pipeline gstpipeline.c:438:gst_pipeline_change_state:<my_pipeline> Need to update clock.</div><div>17547 0:00:00.751628875  8744 0xffff9c007680 DEBUG                    bin gstbin.c:837:gst_bin_provide_clock_func:<my_pipeline> returning old clock (nil)</div><div>17548 0:00:00.751669875  8744 0xffff9c007680 DEBUG              GST_CLOCK gstsystemclock.c:353:gst_system_clock_obtain: creating new static system clock</div><div>17549 0:00:00.751782500  8744 0xffff9c007680 DEBUG               GST_POLL gstpoll.c:681:gst_poll_new: 0xffffa0003c00: new controllable : 1</div><div>17550 0:00:00.751897750  8744 0xffff9c007680 DEBUG               GST_POLL gstpoll.c:848:gst_poll_add_fd_unlocked: 0xffffa0003c00: fd (fd:120, idx:0)</div><div>17551 0:00:00.751948625  8744 0xffff9c007680 DEBUG               GST_POLL gstpoll.c:1015:gst_poll_fd_ctl_read_unlocked: 0xffffa0003c00: fd (fd:120, idx:0), active : 1</div><div>17552 0:00:00.752028625  8744 0xffff9c007680 DEBUG              GST_CLOCK gstpipeline.c:732:gst_pipeline_provide_clock_func: pipeline obtained system clock: 0xffffa0002160 (GstSystemClock)</div><div>17553 0:00:00.752084500  8744 0xffff9c007680 DEBUG              GST_CLOCK gstclock.c:1046:gst_clock_get_internal_time:<GstSystemClock> internal time 0:15:45.099030375</div></div></div></div></div></div></div>
</div></div></div>
</blockquote></div>