summaryrefslogtreecommitdiff
path: root/gst/rtpmanager/gstrtpdtmfmux.c
diff options
context:
space:
mode:
authorOlivier Crête <olivier.crete@collabora.co.uk>2011-04-14 14:34:26 -0400
committerTim-Philipp Müller <tim@centricular.net>2012-12-16 16:35:22 +0000
commitaa3607ef5c8b9e9cd99b74c49d8ef39319c3c775 (patch)
treef20f287fc4f3e0bd47d666e1a976ef511c31f8c2 /gst/rtpmanager/gstrtpdtmfmux.c
parentd137482fe50d645d0eca49d5a6f20a8aa9850d5b (diff)
rtpdtmfmux: Add last-stop to dtmf-event upstream events
Add the running time of the last outputted buffer to the upstream "dtmf-event" events so that the dtmf source does not leave a gap.
Diffstat (limited to 'gst/rtpmanager/gstrtpdtmfmux.c')
-rw-r--r--gst/rtpmanager/gstrtpdtmfmux.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gst/rtpmanager/gstrtpdtmfmux.c b/gst/rtpmanager/gstrtpdtmfmux.c
index f62c6263d..97ffacd2f 100644
--- a/gst/rtpmanager/gstrtpdtmfmux.c
+++ b/gst/rtpmanager/gstrtpdtmfmux.c
@@ -64,6 +64,8 @@ static GstStateChangeReturn gst_rtp_dtmf_mux_change_state (GstElement * element,
static gboolean gst_rtp_dtmf_mux_accept_buffer_locked (GstRTPMux * rtp_mux,
GstRTPMuxPadPrivate * padpriv, GstBuffer * buffer);
+static gboolean gst_rtp_dtmf_mux_src_event (GstRTPMux * rtp_mux,
+ GstEvent * event);
GST_BOILERPLATE (GstRTPDTMFMux, gst_rtp_dtmf_mux, GstRTPMux, GST_TYPE_RTP_MUX);
@@ -100,6 +102,7 @@ gst_rtp_dtmf_mux_class_init (GstRTPDTMFMuxClass * klass)
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_rtp_dtmf_mux_change_state);
gstrtpmux_class->accept_buffer_locked = gst_rtp_dtmf_mux_accept_buffer_locked;
+ gstrtpmux_class->src_event = gst_rtp_dtmf_mux_src_event;
}
static gboolean
@@ -173,6 +176,28 @@ gst_rtp_dtmf_mux_request_new_pad (GstElement * element, GstPadTemplate * templ,
return pad;
}
+static gboolean
+gst_rtp_dtmf_mux_src_event (GstRTPMux * rtp_mux, GstEvent * event)
+{
+ if (GST_EVENT_TYPE (event) == GST_EVENT_CUSTOM_UPSTREAM) {
+ const GstStructure *s = gst_event_get_structure (event);
+
+ if (s && gst_structure_has_name (s, "dtmf-event")) {
+ GST_OBJECT_LOCK (rtp_mux);
+ if (GST_CLOCK_TIME_IS_VALID (rtp_mux->last_stop)) {
+ event = (GstEvent *)
+ gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (event));
+ s = gst_event_get_structure (event);
+ gst_structure_set ((GstStructure *) s,
+ "last-stop", G_TYPE_UINT64, rtp_mux->last_stop, NULL);
+ }
+ GST_OBJECT_UNLOCK (rtp_mux);
+ }
+ }
+
+ return GST_RTP_MUX_CLASS (parent_class)->src_event (rtp_mux, event);
+}
+
static GstStateChangeReturn
gst_rtp_dtmf_mux_change_state (GstElement * element, GstStateChange transition)