<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Thanks for the help<br>
    </p>
    <p><br>
    </p>
    <p>I have set the offset on the src pads of the decoders (for both
      audio and video) and I got some progress but still have some
      issues.</p>
    <p>From what I can see it relies on the Segment event? I seem to see
      a new segment (with a base equal to the offset value) event when I
      set the pad offset.</p>
    <p><br>
    </p>
    <p>So I think the problems I still have might be on the pipeline
      decoupling element (interpipesrc/sink) I'm using not handling the
      Segment correctly.</p>
    <p>I have founds some problems in their code and corrected that, but
      might still be missing something.</p>
    <p><br>
    </p>
    <p>Specifically my problem is like this: I'm listening to the live
      source but want to change to a replay sequence.</p>
    <p>The replay sequence is a short transition video, then the replay
      stream itself, followed by the transition video again and then
      back to live.</p>
    <p><br>
    </p>
    <p>A simplification of the topology:<br>
    </p>
    <p>v4l2src -> interpipesink name=vlive</p>
    <p>pulsesrc -> interpipesink name=alive</p>
    <p>filesrc location=transition.ts -> tsdemux -> h264_dec ->
      interpipesink name=vtransition</p>
    <p>                                 ->  acc_dec ->
      interpipesink name=atransition</p>
    <p>filesrc location=cam.ts -> tsdemux -> h264_dec ->
      interpipesink name=vreplay</p>
    <p>                             ->  aac_dec -> interpipesink
      name=areplay</p>
    <p>interpipesrc name=vselect listen-to=vlive -> h264_enc ->
      tsmux -> rtpmp2tpay -> udpsink<br>
    </p>
    <p>interpipesrc name=aselect listen-to=alive -> aac_enc  -> <br>
    </p>
    <p><br>
    </p>
    <p>So when I want to do a replay I start by preparing the replay
      file pipeline stream by playing, seeking and then pausing (because
      I found out that seeking takes time and I need seamless changes).</p>
    <p>Then I play the transition file pipeline, set the pad offset on
      the decoders::src and set the interpipesrc to listen-to
      vtranstion/atransition.</p>
    <p>When I get the EOS I play the replay file pipeline, set the pad
      offset on the decoders::src and set the interpipesrc to listen-to
      vreplay/areplay.</p>
    <p>When I get next the EOS I set the transition file pipeline to
      NULL, then to PLAYING, set the pad offset on the decoders::src and
      set the interpipesrc to listen-to vtranstion/atransition.</p>
    <p>On this final EOS I just set the interpipesrc to listen-to
      vlive/alive again.</p>
    <p><br>
    </p>
    <p>And the problem is that I see a new segment when I play the
      transition file pipeline the 1st time and also when I play the
      replay file pipeline, but not when I play the transition file
      pipeline the 2nd time.</p>
    <p>So the tsmux accepts the frames of the 1st transition and the
      replay itself, but complains about backwards DTS for the end
      transition (because there is no new Segment with a proper offset).</p>
    <p><br>
    </p>
    <p>So, is there something wrong going on the interpipe, or do I need
      to "reset" the transition file pipeline on a different manner than
      setting to NULL in order to be able to get the new Segment?</p>
    <p><br>
    </p>
    <div class="moz-cite-prefix"> On 24.09.2021 13.23, Sebastian Dröge
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:54d3d337d94b4fba559e797700dfc09a8bcfcf21.camel@centricular.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div>On Fri, 2021-09-24 at 13:17 +0200, Marianna Smidth Buschle
        wrote:</div>
      <blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px
        #729fcf solid;padding-left:1ex">
        <div> On 24.09.2021 13.05, Sebastian Dröge wrote:<br>
          <meta http-equiv="content-type" content="text/html;
            charset=UTF-8">
        </div>
        <div>On Fri, 2021-09-24 at 12:59 +0200, Marianna Smidth Buschle
          via gstreamer-devel wrote:</div>
        <div> <br>
        </div>
        <blockquote type="cite" style="margin:0 0 0 .8ex;
          border-left:2px #729fcf solid;padding-left:1ex">
          <div>I have a use case where I have N live sources (v4l2src)
            from which I can <br>
          </div>
          <div>select to be the output.<br>
          </div>
          <div><br>
          </div>
          <div>I also need to be able to make a replay (seek from a
            filesrc).<br>
          </div>
          <div><br>
          </div>
          <div>My question is how to properly handle the mixing of the
            live and <br>
          </div>
          <div>non-live sources since the timestamps don't match.<br>
          </div>
          <div><br>
          </div>
          <div>The filesrc starts from zero (or the seeking point) and
            the live sources <br>
          </div>
          <div>have a running-time based on the clock.</div>
        </blockquote>
        <div><br>
        </div>
        <div>This is actually simpler than what you wrote. What you
          would do is to call gst_pad_set_offset() on the source pad of
          the non-live streams that you want to connect to the mixer.</div>
        <div>That would then make sure to update the running time
          accordingly.</div>
        <p>Can I do that directly on the filesrc (the MPEG-TS) stream?</p>
        <p>Or should it be on the tsdemux pads, or later on the
          audio/video decoder pads?</p>
      </blockquote>
      <div>filesrc doesn't know anything about time, so that won't have
        any effect.</div>
      <div>I would do it directly on the source pads that you connect to
        compositor/audiomixer/etc.</div>
      <div><br>
      </div>
      <div><span>
          <pre>-- 
</pre>
          <div data-evo-paragraph="" class="" style="width: 71ch;"
            data-evo-signature-plain-text-mode="">Sebastian Dröge,
            Centricular Ltd · <a href="http://www.centricular.com"
              moz-do-not-send="true">https://www.centricular.com</a></div>
          <div data-evo-paragraph="" class="" style="width: 71ch;"><br>
          </div>
        </span></div>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Best regards / Med venlig hilsen
“Marianna Smidth Buschle”</pre>
  </body>
</html>