summaryrefslogtreecommitdiffstats
path: root/gst/dtmf/gstrtpdtmfsrc.c
diff options
context:
space:
mode:
authorYouness Alaoui <youness.alaoui@collabora.co.uk>2007-08-31 23:44:13 +0000
committerEdward Hervey <bilboed@bilboed.com>2009-02-21 17:48:01 +0100
commit886a695daab54642243608852919ac8e56682479 (patch)
treeb12d67d254524add4f17079089bd4e1985f662e1 /gst/dtmf/gstrtpdtmfsrc.c
parent102570fe4d8ebe71cf2f80177055cb9d15abc4ec (diff)
downloadgst-plugins-bad-886a695daab54642243608852919ac8e56682479.tar.gz
gst-plugins-bad-886a695daab54642243608852919ac8e56682479.tar.bz2
gst-plugins-bad-886a695daab54642243608852919ac8e56682479.zip
[MOVED FROM GST-P-FARSIGHT] Fixes the deadlock when pausing the dtmfsrc and rtpdtmfsrc. Had to push something on the async queue to release the blocking async_queue_pop(). Thanks to Olivier for the solution.
20070831234413-4f0f6-793cf35fc43636e7275258cc7063fc068f5efa0a.gz
Diffstat (limited to 'gst/dtmf/gstrtpdtmfsrc.c')
-rw-r--r--gst/dtmf/gstrtpdtmfsrc.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/gst/dtmf/gstrtpdtmfsrc.c b/gst/dtmf/gstrtpdtmfsrc.c
index c2a6d1f2..ff3f05b4 100644
--- a/gst/dtmf/gstrtpdtmfsrc.c
+++ b/gst/dtmf/gstrtpdtmfsrc.c
@@ -612,11 +612,20 @@ gst_rtp_dtmf_src_stop (GstRTPDTMFSrc *dtmfsrc)
dtmfsrc->clock_id = NULL;
}
+ g_async_queue_lock (dtmfsrc->event_queue);
+ event = g_malloc (sizeof(GstRTPDTMFSrcEvent));
+ event->event_type = RTP_DTMF_EVENT_TYPE_PAUSE_TASK;
+ g_async_queue_push_unlocked (dtmfsrc->event_queue, event);
+ g_async_queue_unlock (dtmfsrc->event_queue);
+
+ event = NULL;
+
if (!gst_pad_pause_task (dtmfsrc->srcpad)) {
GST_ERROR_OBJECT (dtmfsrc, "Failed to pause task on src pad");
return;
}
+
if (dtmfsrc->last_event) {
/* Don't forget to release the stream lock */
gst_rtp_dtmf_src_set_stream_lock (dtmfsrc, FALSE);
@@ -632,10 +641,6 @@ gst_rtp_dtmf_src_stop (GstRTPDTMFSrc *dtmfsrc)
event = g_async_queue_try_pop (dtmfsrc->event_queue);
}
- if (dtmfsrc->last_event) {
- g_free (dtmfsrc->last_event);
- dtmfsrc->last_event = NULL;
- }
}
@@ -813,6 +818,10 @@ gst_rtp_dtmf_src_push_next_rtp_packet (GstRTPDTMFSrc *dtmfsrc)
event->sent_packets = 0;
dtmfsrc->last_event = event;
+ } else if (event->event_type == RTP_DTMF_EVENT_TYPE_PAUSE_TASK) {
+ g_free (event);
+ g_async_queue_unref (dtmfsrc->event_queue);
+ return;
}
} else if (dtmfsrc->last_event->sent_packets * dtmfsrc->interval >=
MIN_PULSE_DURATION){