Skip to content

flvmux: use the correct timestamp to calculate wait times

Michael Olbrich requested to merge mol/gstreamer:flvmux into main

Since c0bf793c ("flvmux: Set PTS based on running time") the timestamp of the output buffer is already in running time. So using that for 'srcpad->segment.position' does not work correctly because gst_aggregator_simple_get_next_time() will convert it again with gst_segment_to_running_time(). This means that the timestamp returned by gst_aggregator_simple_get_next_time() may be incorrect. For example, if flvmux is added to a already runinng pipeline then the timestamp is too small and gst_aggregator_wait_and_check() returns immediately. As a result, buffers may be muxed in the wrong order.

To fix this, use the PTS of the incoming buffer instead of the outgoing buffer. Also add the duration as get_next_time() is supposed to return the timestamp of the next buffer, not the current one.

Merge request reports