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;
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) {
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);
event = g_async_queue_try_pop (dtmfsrc->event_queue);
}
- if (dtmfsrc->last_event) {
- g_free (dtmfsrc->last_event);
- dtmfsrc->last_event = NULL;
- }
}
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){
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;