From 19e3f397512c0563f6279fbf3394fa321789f910 Mon Sep 17 00:00:00 2001 From: "zeeshan.ali@nokia.com" Date: Wed, 14 Mar 2007 17:17:56 +0000 Subject: [MOVED FROM GST-P-FARSIGHT] Request for stream lock when generating DTMF packets 20070314171756-65035-0b497dfac203ff4f579525485d5804e5f5093b3f.gz --- gst/rtpdtmf/gstrtpdtmfsrc.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'gst/rtpdtmf/gstrtpdtmfsrc.c') diff --git a/gst/rtpdtmf/gstrtpdtmfsrc.c b/gst/rtpdtmf/gstrtpdtmfsrc.c index 5d84b6ae..38e64b0e 100644 --- a/gst/rtpdtmf/gstrtpdtmfsrc.c +++ b/gst/rtpdtmf/gstrtpdtmfsrc.c @@ -449,6 +449,19 @@ gst_rtp_dtmf_src_get_property (GObject * object, guint prop_id, GValue * value, } } +static void +gst_rtp_dtmf_src_set_stream_lock (GstRTPDTMFSrc *dtmfsrc, gboolean lock) +{ + GstEvent *event; + GstStructure *structure; + + structure = gst_structure_new ("stream-lock", + "lock", G_TYPE_BOOLEAN, lock, NULL); + + event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM_OOB, structure); + gst_pad_push_event (dtmfsrc->srcpad, event); +} + static void gst_rtp_dtmf_src_start (GstRTPDTMFSrc *dtmfsrc, gint event_number, gint event_volume) @@ -490,6 +503,9 @@ gst_rtp_dtmf_src_start (GstRTPDTMFSrc *dtmfsrc, else dtmfsrc->ts_base = dtmfsrc->ts_offset; + /* Don't forget to get exclusive access to the stream */ + gst_rtp_dtmf_src_set_stream_lock (dtmfsrc, TRUE); + if (!gst_pad_start_task (dtmfsrc->srcpad, (GstTaskFunction) gst_rtp_dtmf_src_push_next_rtp_packet, dtmfsrc)) { GST_ERROR_OBJECT (dtmfsrc, "Failed to start task on src pad"); @@ -510,6 +526,9 @@ gst_rtp_dtmf_src_stop (GstRTPDTMFSrc *dtmfsrc) dtmfsrc->payload->e = 1; gst_rtp_dtmf_src_push_next_rtp_packet (dtmfsrc); + /* Don't forget to release the stream lock */ + gst_rtp_dtmf_src_set_stream_lock (dtmfsrc, FALSE); + g_free (dtmfsrc->payload); dtmfsrc->payload = NULL; } -- cgit v1.2.1