tsdemux: Report latency (700ms)
authorEdward Hervey <edward.hervey@collabora.co.uk>
Tue, 8 Nov 2011 19:12:50 +0000 (20:12 +0100)
committerEdward Hervey <edward.hervey@collabora.co.uk>
Fri, 30 Dec 2011 17:03:03 +0000 (18:03 +0100)
gst/mpegtsdemux/tsdemux.c

index 88226e4..6d331d8 100644 (file)
@@ -396,6 +396,30 @@ gst_ts_demux_srcpad_query (GstPad * pad, GstObject * parent, GstQuery * query)
         res = FALSE;
       }
       break;
+    case GST_QUERY_LATENCY:
+    {
+      GST_DEBUG ("query latency");
+      res = gst_pad_peer_query (base->sinkpad, query);
+      if (res && base->upstream_live) {
+        GstClockTime min_lat, max_lat;
+        gboolean live;
+
+        /* According to H.222.0
+           Annex D.0.3 (System Time Clock recovery in the decoder)
+           and D.0.2 (Audio and video presentation synchronization)
+
+           We can end up with an interval of up to 700ms between valid
+           PCR/SCR. We therefore allow a latency of 700ms for that.
+         */
+        gst_query_parse_latency (query, &live, &min_lat, &max_lat);
+        if (min_lat != -1)
+          min_lat += 700 * GST_MSECOND;
+        if (max_lat != -1)
+          max_lat += 700 * GST_MSECOND;
+        gst_query_set_latency (query, live, min_lat, max_lat);
+      }
+    }
+      break;
     case GST_QUERY_SEEKING:
       GST_DEBUG ("query seeking");
       gst_query_parse_seeking (query, &format, NULL, NULL, NULL);