summaryrefslogtreecommitdiffstats
path: root/gst/dtmf
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
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')
-rw-r--r--gst/dtmf/gstdtmfsrc.c14
-rw-r--r--gst/dtmf/gstdtmfsrc.h3
-rw-r--r--gst/dtmf/gstrtpdtmfsrc.c17
-rw-r--r--gst/dtmf/gstrtpdtmfsrc.h3
4 files changed, 31 insertions, 6 deletions
diff --git a/gst/dtmf/gstdtmfsrc.c b/gst/dtmf/gstdtmfsrc.c
index 1dd123f4..0c137753 100644
--- a/gst/dtmf/gstdtmfsrc.c
+++ b/gst/dtmf/gstdtmfsrc.c
@@ -554,6 +554,16 @@ gst_dtmf_src_stop (GstDTMFSrc *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;
@@ -768,6 +778,10 @@ gst_dtmf_src_push_next_tone_packet (GstDTMFSrc *dtmfsrc)
event->packet_count = 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->packet_count * dtmfsrc->interval >=
MIN_DUTY_CYCLE) {
diff --git a/gst/dtmf/gstdtmfsrc.h b/gst/dtmf/gstdtmfsrc.h
index 5a942702..15a16758 100644
--- a/gst/dtmf/gstdtmfsrc.h
+++ b/gst/dtmf/gstdtmfsrc.h
@@ -52,7 +52,8 @@ typedef struct _GstDTMFSrcClass GstDTMFSrcClass;
enum _GstDTMFEventType {
DTMF_EVENT_TYPE_START,
- DTMF_EVENT_TYPE_STOP
+ DTMF_EVENT_TYPE_STOP,
+ DTMF_EVENT_TYPE_PAUSE_TASK
};
typedef enum _GstDTMFEventType GstDTMFEventType;
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){
diff --git a/gst/dtmf/gstrtpdtmfsrc.h b/gst/dtmf/gstrtpdtmfsrc.h
index c5e2b11b..66225bac 100644
--- a/gst/dtmf/gstrtpdtmfsrc.h
+++ b/gst/dtmf/gstrtpdtmfsrc.h
@@ -61,7 +61,8 @@ typedef struct _GstRTPDTMFSrcClass GstRTPDTMFSrcClass;
enum _GstRTPDTMFEventType {
RTP_DTMF_EVENT_TYPE_START,
- RTP_DTMF_EVENT_TYPE_STOP
+ RTP_DTMF_EVENT_TYPE_STOP,
+ RTP_DTMF_EVENT_TYPE_PAUSE_TASK
};
typedef enum _GstRTPDTMFEventType GstRTPDTMFEventType;