Skip to content

livesync: Fix queueing

The logic of the element requires the next buffer to be available immediately after we are done pushing the previous, otherwise we insert a repeat.

Making the src loop handle events and queries broke this, as upstream is almost guaranteed not to deliver a buffer in time if we allow non-buffer items to block upstream's push.

To fix this, replace our single-item Option with a VecDeque that we allow to hold an unlimited number of events or queries, but only one buffer at a time.

In addition, the code was confused about the current caps and segment.

This wasn't an issue before making the src loop handle events and queries, as only the sinkpad cared about the current segment, using it to buffers received, and only the srcpad cared about the current caps, sending it just before sending the next received buffer.

Now the sinkpad cares about caps (through update_fallback_duration) and the srcpad cares about the segment (when not in single-segment mode).

Fix this by

  • making in_caps always hold the current caps of the sinkpad,
  • adding pending_caps, which is used by the srcpad to store caps to be sent with the next received buffer,
  • adding in_segment, holding the current segment of the sinkpad,
  • adding pending_segment, which is used by the srcpad to store the segment to be sent with the next received buffer,
  • adding out_segment, holding the current segment of the srcpad.

Maybe a fix for #298 (closed).

Merge request reports