[gst-cvs] gst-plugins-ugly: asfdemux: report initial latency due to internal preroll queue
Mark Nauwelaerts
mnauw at kemper.freedesktop.org
Tue May 5 13:47:01 PDT 2009
Module: gst-plugins-ugly
Branch: master
Commit: 0b28139203e17be6f1bf0e504cde0cbfac55e860
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-ugly/commit/?id=0b28139203e17be6f1bf0e504cde0cbfac55e860
Author: Mark Nauwelaerts <mark.nauwelaerts at collabora.co.uk>
Date: Sat May 2 13:45:22 2009 +0200
asfdemux: report initial latency due to internal preroll queue
---
gst/asfdemux/gstasfdemux.c | 32 ++++++++++++++++++++++++++++++++
gst/asfdemux/gstasfdemux.h | 1 +
2 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/gst/asfdemux/gstasfdemux.c b/gst/asfdemux/gstasfdemux.c
index f50b91f..67fed5b 100644
--- a/gst/asfdemux/gstasfdemux.c
+++ b/gst/asfdemux/gstasfdemux.c
@@ -340,6 +340,9 @@ gst_asf_demux_sink_event (GstPad * pad, GstEvent * event)
gst_asf_demux_reset_stream_state_after_discont (demux);
GST_OBJECT_UNLOCK (demux);
gst_asf_demux_send_event_unlocked (demux, event);
+ /* upon activation, latency is no longer introduced, e.g. after seek */
+ if (demux->activated_streams)
+ demux->latency = 0;
break;
default:
@@ -3429,6 +3432,35 @@ gst_asf_demux_handle_src_query (GstPad * pad, GstQuery * query)
break;
}
+ case GST_QUERY_LATENCY:
+ {
+ gboolean live;
+ GstClockTime min, max;
+
+ /* preroll delay does not matter in non-live pipeline,
+ * but we might end up in a live (rtsp) one ... */
+
+ /* first forward */
+ res = gst_pad_query_default (pad, query);
+ if (!res)
+ break;
+
+ gst_query_parse_latency (query, &live, &min, &max);
+
+ GST_DEBUG_OBJECT (demux, "Peer latency: live %d, min %"
+ GST_TIME_FORMAT " max %" GST_TIME_FORMAT, live,
+ GST_TIME_ARGS (min), GST_TIME_ARGS (max));
+
+ GST_OBJECT_LOCK (demux);
+ if (min != 1)
+ min += demux->latency;
+ if (max != 1)
+ max += demux->latency;
+ GST_OBJECT_UNLOCK (demux);
+ gst_query_set_latency (query, live, min, max);
+ break;
+ }
+
default:
res = gst_pad_query_default (pad, query);
break;
diff --git a/gst/asfdemux/gstasfdemux.h b/gst/asfdemux/gstasfdemux.h
index 96ebac1..37fd413 100644
--- a/gst/asfdemux/gstasfdemux.h
+++ b/gst/asfdemux/gstasfdemux.h
@@ -171,6 +171,7 @@ struct _GstASFDemux {
gboolean need_newsegment; /* do we need to send a new-segment event? */
gboolean segment_running; /* if we've started the current segment */
gboolean streaming; /* TRUE if we are operating chain-based */
+ GstClockTime latency;
/* Descrambler settings */
guint8 span;
More information about the Gstreamer-commits
mailing list