<div dir="ltr">thanks,<div>yes, appsrc is not suitable for seek;</div><div>so, I want to know which additional work should be done to support seek. for example, how to manage pipeline clock, element base_time.</div><div>however, I got confused after read gst doc and code.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Mathieu Duponchelle <<a href="mailto:mathieu@centricular.com">mathieu@centricular.com</a>> 于2019年6月14日周五 下午11:55写道:<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 bgcolor="#FFFFFF">
As far as I remember, appsrc is not really well suited for seeking,
you<br>
may want to consider writing a GstBaseSrc subclass.<br>
<br>
<div class="gmail-m_-1285896508268715347moz-cite-prefix">On 6/14/19 1:09 PM, Halley Zhao wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hi expert:
<div>I have special pipeline:
appsrc-->h264parse-->h264dec-->videosink</div>
<div>and use a customized clock to control the pipeline.</div>
<div><br>
</div>
<div>when I want to do some seek operation, it doesn't work
well. I tried to dig into gstbasesink, but still not a
workable solution yet.</div>
<div><br>
</div>
<div>after play 3 seconds, I try to seek to 0 (file start)</div>
<div><br>
</div>
<div>approach 1: I also reset my clock time to restart from 0.</div>
<div>but, I found, the first buffer (pts=0) and other buffer
before 3 second timestamp are dropped. and after no video
update for 3 seconds, video playback continues with 3s+
frames.</div>
<div>I added some debug log to gstbasesink, and found that video
frames before 3s are treated as 'too late' and are dropped. </div>
<div>I tried to compare it with seek of a normal pipeline
(filesrc-->qtdemux-->h264parse-->h264dec-->videosink),
and found that the base_time of gstbasesink is updated to the
previous played time. </div>
<div>so I try to gst_element_set_base_time() for the elements of
my appsrc pipeline.</div>
<div>then the first video frame isn't dropped,
but gst_base_sink_wait_clock() from gst_base_sink_do_sync() is
blocked for 3 seconds. then the first video frame is rendered.</div>
<div><br>
</div>
<div>approach 2: I tried to create a new clock for the pipeline</div>
<div>after seek, I tried to use a new clock start from zero. it
doesn't work well either, because element base_time keeps big
number, gst_base_sink_wait_clock() is blocked for 3 seconds as
well</div>
<div><br>
</div>
<div>to be honest, I don't know what's the correct way to seek a
pipeline.</div>
<div>could anyone educate me on it?</div>
<div>maybe some segment event is required for seek, where is
some reference code?</div>
<div>my test code see attachment.</div>
<div><br>
</div>
</div>
<br>
<fieldset class="gmail-m_-1285896508268715347mimeAttachmentHeader"></fieldset>
<pre class="gmail-m_-1285896508268715347moz-quote-pre">_______________________________________________
gstreamer-devel mailing list
<a class="gmail-m_-1285896508268715347moz-txt-link-abbreviated" href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a>
<a class="gmail-m_-1285896508268715347moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a></pre>
</blockquote>
</div>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a></blockquote></div>