summaryrefslogtreecommitdiffstats
path: root/gst/dtmf
diff options
context:
space:
mode:
authorYouness Alaoui <youness.alaoui@collabora.co.uk>2007-09-04 22:57:53 +0000
committerEdward Hervey <bilboed@bilboed.com>2009-02-21 17:48:02 +0100
commit4eab02230d062ecd9aab842aa088e089d99af844 (patch)
treee596edb5604e1eed27da1257ded439baf1d0c4c1 /gst/dtmf
parent9c5331b7474b2d435c813dc481bd7e868421800b (diff)
downloadgst-plugins-bad-4eab02230d062ecd9aab842aa088e089d99af844.tar.gz
gst-plugins-bad-4eab02230d062ecd9aab842aa088e089d99af844.tar.bz2
gst-plugins-bad-4eab02230d062ecd9aab842aa088e089d99af844.zip
[MOVED FROM GST-P-FARSIGHT] Add another fix for a possible race condition
20070904225753-4f0f6-5ba8c4260c002bb27eb98e9faba3c15799357b57.gz
Diffstat (limited to 'gst/dtmf')
-rw-r--r--gst/dtmf/gstdtmfsrc.c11
-rw-r--r--gst/dtmf/gstdtmfsrc.h1
-rw-r--r--gst/dtmf/gstrtpdtmfsrc.c10
-rw-r--r--gst/dtmf/gstrtpdtmfsrc.h1
4 files changed, 19 insertions, 4 deletions
diff --git a/gst/dtmf/gstdtmfsrc.c b/gst/dtmf/gstdtmfsrc.c
index 7f224820..94987de8 100644
--- a/gst/dtmf/gstdtmfsrc.c
+++ b/gst/dtmf/gstdtmfsrc.c
@@ -334,6 +334,7 @@ gst_dtmf_src_init (GstDTMFSrc * dtmfsrc, gpointer g_class)
dtmfsrc->last_event = NULL;
dtmfsrc->clock_id = NULL;
+ dtmfsrc->task_paused = TRUE;
GST_DEBUG_OBJECT (dtmfsrc, "init done");
}
@@ -536,7 +537,7 @@ gst_dtmf_src_start (GstDTMFSrc *dtmfsrc)
GST_DEBUG_OBJECT (dtmfsrc,
"caps %" GST_PTR_FORMAT " set on src pad", caps);
-
+ dtmfsrc->task_paused = FALSE;
if (!gst_pad_start_task (dtmfsrc->srcpad,
(GstTaskFunction) gst_dtmf_src_push_next_tone_packet, dtmfsrc)) {
GST_ERROR_OBJECT (dtmfsrc, "Failed to start task on src pad");
@@ -548,6 +549,7 @@ gst_dtmf_src_stop (GstDTMFSrc *dtmfsrc)
{
GstDTMFSrcEvent *event = NULL;
+ dtmfsrc->task_paused = TRUE;
GST_OBJECT_LOCK (dtmfsrc);
if (dtmfsrc->clock_id != NULL) {
gst_clock_id_unschedule(dtmfsrc->clock_id);
@@ -684,7 +686,12 @@ gst_dtmf_src_wait_for_buffer_ts (GstDTMFSrc *dtmfsrc, GstBuffer * buf)
GST_OBJECT_LOCK (dtmfsrc);
dtmfsrc->clock_id = clock_id;
GST_OBJECT_UNLOCK (dtmfsrc);
- clock_ret = gst_clock_id_wait (dtmfsrc->clock_id, NULL);
+
+ if (dtmfsrc->task_paused) {
+ clock_ret = GST_CLOCK_UNSCHEDULED;
+ } else {
+ clock_ret = gst_clock_id_wait (dtmfsrc->clock_id, NULL);
+ }
GST_OBJECT_LOCK (dtmfsrc);
dtmfsrc->clock_id = NULL;
diff --git a/gst/dtmf/gstdtmfsrc.h b/gst/dtmf/gstdtmfsrc.h
index 15a16758..27e91a00 100644
--- a/gst/dtmf/gstdtmfsrc.h
+++ b/gst/dtmf/gstdtmfsrc.h
@@ -75,6 +75,7 @@ struct _GstDTMFSrc {
GAsyncQueue* event_queue;
GstDTMFSrcEvent* last_event;
GstClockID clock_id;
+ gboolean task_paused;
guint16 interval;
GstClockTime timestamp;
diff --git a/gst/dtmf/gstrtpdtmfsrc.c b/gst/dtmf/gstrtpdtmfsrc.c
index ba061f62..1a03da66 100644
--- a/gst/dtmf/gstrtpdtmfsrc.c
+++ b/gst/dtmf/gstrtpdtmfsrc.c
@@ -338,7 +338,7 @@ gst_rtp_dtmf_src_init (GstRTPDTMFSrc * dtmfsrc, gpointer g_class)
dtmfsrc->clock_rate = DEFAULT_CLOCK_RATE;
dtmfsrc->interval = DEFAULT_PACKET_INTERVAL;
dtmfsrc->packet_redundancy = DEFAULT_PACKET_REDUNDANCY;
-
+ dtmfsrc->task_paused = TRUE;
dtmfsrc->event_queue = g_async_queue_new ();
dtmfsrc->last_event = NULL;
@@ -594,6 +594,7 @@ gst_rtp_dtmf_src_start (GstRTPDTMFSrc *dtmfsrc)
{
gst_rtp_dtmf_src_set_caps (dtmfsrc);
+ dtmfsrc->task_paused = FALSE;
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");
@@ -606,6 +607,7 @@ gst_rtp_dtmf_src_stop (GstRTPDTMFSrc *dtmfsrc)
GstRTPDTMFSrcEvent *event = NULL;
+ dtmfsrc->task_paused = TRUE;
GST_OBJECT_LOCK (dtmfsrc);
if (dtmfsrc->clock_id != NULL) {
gst_clock_id_unschedule(dtmfsrc->clock_id);
@@ -690,7 +692,11 @@ gst_rtp_dtmf_src_wait_for_buffer_ts (GstRTPDTMFSrc *dtmfsrc, GstBuffer * buf)
dtmfsrc->clock_id = clock_id;
GST_OBJECT_UNLOCK (dtmfsrc);
- clock_ret = gst_clock_id_wait (dtmfsrc->clock_id, NULL);
+ if (dtmfsrc->task_paused) {
+ clock_ret = GST_CLOCK_UNSCHEDULED;
+ } else {
+ clock_ret = gst_clock_id_wait (dtmfsrc->clock_id, NULL);
+ }
GST_OBJECT_LOCK (dtmfsrc);
dtmfsrc->clock_id = NULL;
diff --git a/gst/dtmf/gstrtpdtmfsrc.h b/gst/dtmf/gstrtpdtmfsrc.h
index 66225bac..89511508 100644
--- a/gst/dtmf/gstrtpdtmfsrc.h
+++ b/gst/dtmf/gstrtpdtmfsrc.h
@@ -89,6 +89,7 @@ struct _GstRTPDTMFSrc {
GAsyncQueue* event_queue;
GstRTPDTMFSrcEvent* last_event;
GstClockID clock_id;
+ gboolean task_paused;
GstClockTime timestamp;
gboolean first_packet;