rtponviftimestamp: prioritize PTS over DTS for NTP timestamp
authorMathieu Duponchelle <mathieu@centricular.com>
Wed, 12 Dec 2018 14:25:45 +0000 (15:25 +0100)
committerMathieu Duponchelle <mduponchelle1@gmail.com>
Fri, 5 Apr 2019 00:28:48 +0000 (00:28 +0000)
NTP timestamps are supposed to match the expected presentation
time, prefering the DTS to compute them was incorrect.

<https://www.onvif.org/specs/stream/ONVIF-Streaming-Spec.pdf>

Section 6.3.1: NTP Timestamps

gst/onvif/gstrtponviftimestamp.c

index 08d4a3c..8c77b00 100644 (file)
@@ -518,12 +518,12 @@ handle_buffer (GstRtpOnvifTimestamp * self, GstBuffer * buf)
   }
 
   /* NTP timestamp */
-  if (GST_BUFFER_DTS_IS_VALID (buf)) {
-    time = gst_segment_to_stream_time (&self->segment, GST_FORMAT_TIME,
-        GST_BUFFER_DTS (buf));
-  } else if (GST_BUFFER_PTS_IS_VALID (buf)) {
+  if (GST_BUFFER_PTS_IS_VALID (buf)) {
     time = gst_segment_to_stream_time (&self->segment, GST_FORMAT_TIME,
         GST_BUFFER_PTS (buf));
+  } else if (GST_BUFFER_DTS_IS_VALID (buf)) {
+    time = gst_segment_to_stream_time (&self->segment, GST_FORMAT_TIME,
+        GST_BUFFER_DTS (buf));
   } else {
     GST_INFO_OBJECT (self,
         "Buffer doesn't contain any valid DTS or PTS timestamp");