Skip to content
  • Thibault Saunier's avatar
    basesink: Fix clock synchronization running time in reverse playback · 39b9cc55
    Thibault Saunier authored and GStreamer Marge Bot's avatar GStreamer Marge Bot committed
    In reverse playback, buffers have to be displayed at buffer.stop running
    time, otherwise a same set of buffer can't be displayed in the exact opposite
    order to forward playback.
    
    For example, seeking a video stream at 1fps with start=0, stop=5s, rate=1.0
    
    will display the following buffers:
    
      b0.pts = 0s, b0.duration = 1s - at running time = 0s
      b1.pts = 1s, b1.duration = 1s - at running time = 1s
      b2.pts = 2s, b2.duration = 1s - at running time = 2s
      b3.pts = 3s, b3.duration = 1s - at running time = 3s
      b4.pts = 4s, b4.duration = 1s - at running time = 4s
      <wait at EOS for 1second>
    
    Now, playing that reverse with start=0, stop=5s, rate=1.0 has to display
    the following buffers:
    
      b0.pts = 4s, b0.duration = 1s - at running time = 0s
      b1.pts = 3s, b1.duration = 1s - at running time = 1s
      b2.pts = 2s, b2.duration = 1s - at running time = 2s
      b3.pts = 1s, b3.duration = 1s - at running time = 3s
      b4.pts = 0s, b4.duration = 1s - at running time = 4s
      <wait at EOS for 1second>
    
    With the previous code, it reproduced the following:
    
      b0.pts = 4s, b0.duration = 1s - at running time = 1s
      b1.pts = 3s, b1.duration = 1s - at running time = 2s
      b2.pts = 2s, b2.duration = 1s - at running time = 3s
      b3.pts = 1s, b3.duration = 1s - at running time = 4s
      b4.pts = 0s, b4.duration = 1s - at running time = 5s
      <NO WAIT AT EOS AND POST EOS RIGHT AWAY>
    
    This is being tested with the `validate.launch_pipeline.sink.reverse_playback_clock_waits.*`
    set of tests
    
    Part-of: <!450>
    39b9cc55