diff --git a/gst/dtmf/gstdtmfsrc.c b/gst/dtmf/gstdtmfsrc.c index 7f22482057..94987de881 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 15a16758ed..27e91a0021 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 ba061f6274..1a03da66ae 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 66225baca9..895115088f 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;