mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-23 06:26:23 +00:00
[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
This commit is contained in:
parent
102570fe4d
commit
886a695daa
4 changed files with 31 additions and 6 deletions
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue