mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
avtpsink: Accept buffers that fall out of segment
Proper calculate running time for buffers that are out of current segment and try to honor them. A typical case is for AVTP packets coming from avtpcvfpay element, as those may have DTS that falls out of segment (which is about PTS). By using gst_segment_to_running_time_full(), avtpsink can properly calculate when to transmit those buffers. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1004>
This commit is contained in:
parent
7edaeb3fae
commit
32281ddd33
1 changed files with 7 additions and 2 deletions
|
@ -374,12 +374,17 @@ gst_avtp_sink_render (GstBaseSink * basesink, GstBuffer * buffer)
|
|||
if (G_LIKELY (basesink->sync)) {
|
||||
GstClockTime base_time, running_time;
|
||||
struct cmsghdr *cmsg = CMSG_FIRSTHDR (avtpsink->msg);
|
||||
gint ret;
|
||||
|
||||
g_assert (GST_BUFFER_DTS_OR_PTS (buffer) != GST_CLOCK_TIME_NONE);
|
||||
|
||||
ret = gst_segment_to_running_time_full (&basesink->segment,
|
||||
basesink->segment.format, GST_BUFFER_DTS_OR_PTS (buffer),
|
||||
&running_time);
|
||||
if (ret == -1)
|
||||
running_time = -running_time;
|
||||
|
||||
base_time = gst_element_get_base_time (GST_ELEMENT (avtpsink));
|
||||
running_time = gst_segment_to_running_time (&basesink->segment,
|
||||
basesink->segment.format, GST_BUFFER_DTS_OR_PTS (buffer));
|
||||
running_time = gst_avtp_sink_adjust_time (basesink, running_time);
|
||||
*(__u64 *) CMSG_DATA (cmsg) = UTC_TO_TAI (base_time + running_time);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue