<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Dear who may it concerns,<br>
    <br>
    I'm Hyunwoo Park.<br>
    We are working on gstreamer and found some problem on gstreamer base
    sink element. We set a "render_delay" on our video and audio sink
    element through gst_base_sink_set_render_delay function. But, the
    setting values are not working correctly on the base sink element.<br>
    <br>
    As an example, fallowing test command shows that the "render_delay"
    value not working correctly. I have used no “render_delay” on a
    first fakesink and a second of “render_delay” on a second fakesink.<br>
    <br>
    <blockquote type="cite"><tt>GST_DEBUG_NO_COLOR=1
        GST_DEBUG=basesink:5 gst-launch-0.10 videotestsrc pattern=4 !
        video/x-raw-yuv, width=1, height=1, framerate=1/5 ! tee name=t
        t.src0 ! queue ! fakesink sync=true dump=true t.src1 ! queue !
        fakesink sync=true render-delay=1000000000 dump=true &gt;
        render-delay.log 2&gt;&amp;</tt><br>
    </blockquote>
    <br>
    I executed above command on gstreamer 0.10.32. Followings are some
    part of debug log on gstreamer 0.10.32.<br>
    <br>
    <blockquote type="cite"><tt>0:00:04.579000000   776   0x191938
        DEBUG               basesink
        gstbasesink.c:3519:gst_base_sink_chain_unlocked:&lt;fakesink1&gt;
        got times start: 0:00:10.000000000, end: 0:00:15.000000000<br>
        0:00:04.579000000   776   0x191938 DEBUG               basesink
        gstbasesink.c:1928:gst_base_sink_get_sync_times:&lt;fakesink1&gt;

        got times start: 0:00:10.000000000, stop: 0:00:15.000000000,
        do_sync 1<br>
        0:00:04.579000000   776   0x191938 DEBUG               <font
          color="#ff0000">basesink
          gstbasesink.c:2460:gst_base_sink_do_sync:&lt;fakesink1&gt;
          possibly waiting for clock to reach 0:00:10.000000000,
          adjusted 0:00:09.000000000</font><br>
        0:00:04.579000000   776   0x191938 LOG                 basesink
        gstbasesink.c:2105:gst_base_sink_wait_clock:&lt;fakesink1&gt;
        time 0:00:09.000000000, base_time 0:22:55.857000002<br>
        0:00:06.580000000   776 0x2ca005e8 DEBUG               basesink
        gstbasesink.c:2467:gst_base_sink_do_sync:&lt;fakesink0&gt; clock
        returned 0, jitter -0:00:04.999000000<br>
        0:00:06.580000000   776 0x2ca005e8 DEBUG               basesink
        gstbasesink.c:2755:gst_base_sink_is_too_late:&lt;fakesink0&gt;
        object was scheduled in time<br>
        0:00:06.580000000   776 0x2ca005e8 DEBUG               basesink
        gstbasesink.c:2860:gst_base_sink_render_object:&lt;fakesink0&gt;
        rendering object 0x4fed8<br>
        0:00:06.580000000   776 0x2ca005e8 DEBUG               basesink
        gstbasesink.c:980:gst_base_sink_set_last_buffer_unlocked:&lt;fakesink0&gt;


        setting last buffer to 0x4fed8<br>
        00000000 (0x1918f0): 51 5a 00
        f0                                      QZ..<br>
        0:00:06.580000000   776 0x2ca005e8 DEBUG               basesink
        gstbasesink.c:2974:gst_base_sink_render_object:&lt;fakesink0&gt;
        object unref after render 0x4fed8<br>
        0:00:06.580000000   776 0x2ca005e8 DEBUG               basesink
        gstbasesink.c:3519:gst_base_sink_chain_unlocked:&lt;fakesink0&gt;

        got times start: 0:00:10.000000000, end: 0:00:15.000000000<br>
        0:00:06.580000000   776 0x2ca005e8 DEBUG               basesink
        gstbasesink.c:1928:gst_base_sink_get_sync_times:&lt;fakesink0&gt;

        got times start: 0:00:10.000000000, stop: 0:00:15.000000000,
        do_sync 1<br>
        0:00:06.580000000   776 0x2ca005e8 DEBUG               <font
          color="#ff0000">basesink
          gstbasesink.c:2460:gst_base_sink_do_sync:&lt;fakesink0&gt;
          possibly waiting for clock to reach 0:00:10.000000000,
          adjusted 0:00:11.000000000</font><br>
        0:00:06.580000000   776 0x2ca005e8 LOG                 basesink
        gstbasesink.c:2105:gst_base_sink_wait_clock:&lt;fakesink0&gt;
        time 0:00:11.000000000, base_time 0:22:55.857000002<br>
        0:00:09.580000000   776   0x191938 DEBUG               basesink
        gstbasesink.c:2467:gst_base_sink_do_sync:&lt;fakesink1&gt; clock
        returned 0, jitter -0:00:04.996000000<br>
        0:00:09.580000000   776   0x191938 DEBUG               basesink
        gstbasesink.c:2755:gst_base_sink_is_too_late:&lt;fakesink1&gt;
        object was scheduled in time<br>
        0:00:09.580000000   776   0x191938 DEBUG               basesink
        gstbasesink.c:2860:gst_base_sink_render_object:&lt;fakesink1&gt;
        rendering object 0x4ff30<br>
        0:00:09.580000000   776   0x191938 DEBUG               basesink
        gstbasesink.c:980:gst_base_sink_set_last_buffer_unlocked:&lt;fakesink1&gt;


        setting last buffer to 0x4ff30<br>
        00000000 (0x191928): 51 5a 00
        f0                                      QZ..<br>
        0:00:09.580000000   776   0x191938 DEBUG               basesink
        gstbasesink.c:2974:gst_base_sink_render_object:&lt;fakesink1&gt;
        object unref after render 0x4ff30<br>
        0:00:09.580000000   776   0x191938 DEBUG               basesink
        gstbasesink.c:3519:gst_base_sink_chain_unlocked:&lt;fakesink1&gt;

        got times start: 0:00:15.000000000, end: 0:00:20.000000000<br>
        0:00:09.580000000   776   0x191938 DEBUG               basesink
        gstbasesink.c:1928:gst_base_sink_get_sync_times:&lt;fakesink1&gt;

        got times start: 0:00:15.000000000, stop: 0:00:20.000000000,
        do_sync 1<br>
        0:00:09.580000000   776   0x191938 DEBUG               basesink
        gstbasesink.c:2460:gst_base_sink_do_sync:&lt;fakesink1&gt;
        possibly waiting for clock to reach 0:00:15.000000000, adjusted
        0:00:14.000000000<br>
        0:00:09.580000000   776   0x191938 LOG                 basesink
        gstbasesink.c:2105:gst_base_sink_wait_clock:&lt;fakesink1&gt;
        time 0:00:14.000000000, base_time 0:22:55.857000002<br>
        0:00:11.580000000   776 0x2ca005e8 DEBUG               basesink
        gstbasesink.c:2467:gst_base_sink_do_sync:&lt;fakesink0&gt; clock
        returned 0, jitter -0:00:04.995000000<br>
        0:00:11.580000000   776 0x2ca005e8 DEBUG               basesink
        gstbasesink.c:2755:gst_base_sink_is_too_late:&lt;fakesink0&gt;
        object was scheduled in time<br>
        0:00:11.580000000   776 0x2ca005e8 DEBUG               basesink
        gstbasesink.c:2860:gst_base_sink_render_object:&lt;fakesink0&gt;
        rendering object 0x4ff30<br>
        0:00:11.580000000   776 0x2ca005e8 DEBUG               basesink
        gstbasesink.c:980:gst_base_sink_set_last_buffer_unlocked:&lt;fakesink0&gt;


        setting last buffer to 0x4ff30<br>
        00000000 (0x191928): 51 5a 00
        f0                                      QZ..<br>
        0:00:11.580000000   776 0x2ca005e8 DEBUG               basesink
        gstbasesink.c:2974:gst_base_sink_render_object:&lt;fakesink0&gt;
        object unref after render 0x4ff30</tt><br>
    </blockquote>
    <br>
    According to the red part of the above log message, a video buffer
    that has timestamp 10 second rendered at 9 second and 11 second,
    which supposed to be at 10 second and 11 second.<br>
    And I found that gst_base_sink_do_sync function subtract
    render_delay from “stime” was already subtracted from
    gst_base_sink_adjust_time function.<br>
    <br>
    See a relevant patch that cause this problem,
    <a class="moz-txt-link-freetext"
href="http://cgit.freedesktop.org/gstreamer/gstreamer/commit/libs/gst/base/gstbasesink.c?id=54a587143454320ed63ce82b052e07050ed6a584">http://cgit.freedesktop.org/gstreamer/gstreamer/commit/libs/gst/base/gstbasesink.c?id=54a587143454320ed63ce82b052e07050ed6a584</a><br>
    <br>
    Regards.<br>
    Hyunwoo Park.<br>
    <br>
  </body>
</html>