1
Fork 0

gst/pipewiresink: fix dts_offset

GStreamer uses a time stamp for the decoding time, but PipeWire uses an
offset to the presentation time. Thus, the pipewiresink must not use the
DTS as dts_offset, but has to calculate the offset.

If the buffer's DTS is invalid, assume that dts is pts.
This commit is contained in:
Michael Tretter 2023-12-21 11:12:39 +01:00
parent 10d3c547d1
commit 03173530da
1 changed files with 4 additions and 1 deletions

View File

@ -461,7 +461,10 @@ do_send_buffer (GstPipeWireSink *pwsink, GstBuffer *buffer)
if (data->header) {
data->header->seq = GST_BUFFER_OFFSET (buffer);
data->header->pts = GST_BUFFER_PTS (buffer);
data->header->dts_offset = GST_BUFFER_DTS (buffer);
if (GST_BUFFER_DTS(buffer) != GST_CLOCK_TIME_NONE)
data->header->dts_offset = GST_BUFFER_DTS (buffer) - GST_BUFFER_PTS (buffer);
else
data->header->dts_offset = 0;
}
if (data->crop) {
GstVideoCropMeta *meta = gst_buffer_get_video_crop_meta (buffer);