avtpcvfpay: Warn about timestamp issues on non-flushing seek

Seek events will cause new segments to be sent to avtpcvfpay, and for
flushing seeks, a pipeline running time reset. This running time
reset, which effectively changes pipeline base time, will cause
avtpcvfpay element to generate incorrect DTS for the initial set of
buffers sent after FLUSH_STOP.

This happens due the fact that base time change happens only when the
sink gets the first buffer after the FLUSH_STOP - so avtpcvfpay used
the wrong base time to do its calculations.

However, if the pipeline is paused before the seek, sink will update
base time when pipeline state goes to PLAYING again, before avtpcvfpay
gets the first buffers after the flush. Then avtpcvfpay element will be
able to normally calculate DTS for the outgoing packets.

This patch simply adds a warning message in case a flushing seek is
performed on a playing pipeline.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1004>
This commit is contained in:
Ederson de Souza 2020-04-03 10:41:04 -07:00 committed by GStreamer Merge Bot
parent 12838af353
commit 7edaeb3fae

View file

@ -744,6 +744,20 @@ gst_avtp_cvf_pay_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
ret = gst_avtp_cvf_pay_new_caps (avtpcvfpay, caps);
gst_event_unref (event);
return ret;
case GST_EVENT_FLUSH_STOP:
if (GST_ELEMENT (avtpcvfpay)->current_state == GST_STATE_PLAYING) {
/* After a flush, the sink will reset pipeline base_time, but only
* after it gets the first buffer. So, here, we used the wrong
* base_time to calculate DTS. We'll just notice base_time changed
* when we get the next buffer. So, we'll basically mess with
* timestamps of two frames, which is bad. Known workaround is
* to pause the pipeline before a flushing seek - so that we'll
* be up to date to new pipeline base_time */
GST_WARNING_OBJECT (avtpcvfpay,
"Flushing seek performed while pipeline is PLAYING, "
"AVTP timestamps will be incorrect!");
}
break;
default:
break;
}