summaryrefslogtreecommitdiff
path: root/gst/mpegtsdemux
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2015-04-17 13:55:26 -0600
committerOlivier CrĂȘte <olivier.crete@collabora.com>2015-04-17 13:59:08 -0600
commita1f709c2935860585dcddfdb2e7d40541db423a5 (patch)
tree9d30c34c8a55ba936301b1f7b9866f70f5ea31f6 /gst/mpegtsdemux
parent774866ad62c3a0359705ef106584be3d6b3087e4 (diff)
downloadgstreamer-plugins-bad-a1f709c2935860585dcddfdb2e7d40541db423a5.tar.gz
tsdemux: Cleanup latency query handling
The minimum latency is always 0 or more. And we should requery upstream as it may have changed.
Diffstat (limited to 'gst/mpegtsdemux')
-rw-r--r--gst/mpegtsdemux/tsdemux.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c
index ed83368d7..fdaf63a44 100644
--- a/gst/mpegtsdemux/tsdemux.c
+++ b/gst/mpegtsdemux/tsdemux.c
@@ -66,6 +66,9 @@
#define GST_FLOW_REWINDING GST_FLOW_CUSTOM_ERROR
+/* latency in nsecs */
+#define TS_LATENCY (700 * GST_MSECOND)
+
GST_DEBUG_CATEGORY_STATIC (ts_demux_debug);
#define GST_CAT_DEFAULT ts_demux_debug
@@ -507,7 +510,7 @@ gst_ts_demux_srcpad_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
GST_DEBUG ("query latency");
res = gst_pad_peer_query (base->sinkpad, query);
- if (res && base->upstream_live) {
+ if (res) {
GstClockTime min_lat, max_lat;
gboolean live;
@@ -519,10 +522,10 @@ gst_ts_demux_srcpad_query (GstPad * pad, GstObject * parent, GstQuery * query)
PTS/DTS. 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;
+ if (min_lat)
+ min_lat += TS_LATENCY;
+ if (GST_CLOCK_TIME_IS_VALID (max_lat))
+ max_lat += TS_LATENCY;
gst_query_set_latency (query, live, min_lat, max_lat);
}
break;