<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" 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="moz-cite-prefix">On 6/14/19 1:09 PM, Halley Zhao wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAJ1_6NDdv7RJTADygv1RAj3SkpkDSke0M13hwYEC61VjnmRKgQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <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="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
gstreamer-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a></pre>
    </blockquote>
  </body>
</html>