summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorYouness Alaoui <youness.alaoui@collabora.co.uk>2007-09-13 19:20:53 +0000
committerEdward Hervey <bilboed@bilboed.com>2009-02-21 17:48:02 +0100
commit4a11ad9df0e8357031a5a2834d61625b0ab00626 (patch)
treec5d0970dc1daf831219813972f22e3d9f031b5c6 /gst
parent854773d724f5c4ff2e750f311c6de28d5a820ab7 (diff)
downloadgst-plugins-bad-4a11ad9df0e8357031a5a2834d61625b0ab00626.tar.gz
gst-plugins-bad-4a11ad9df0e8357031a5a2834d61625b0ab00626.tar.bz2
gst-plugins-bad-4a11ad9df0e8357031a5a2834d61625b0ab00626.zip
[MOVED FROM GST-P-FARSIGHT] Make sure to unlock the thread when going to ready and to flush the queue when moving to paused or playing
20070913192053-4f0f6-76c3925380d1a30988286170535a65dea64a5583.gz
Diffstat (limited to 'gst')
-rw-r--r--gst/dtmf/gstdtmfsrc.c54
1 files changed, 35 insertions, 19 deletions
diff --git a/gst/dtmf/gstdtmfsrc.c b/gst/dtmf/gstdtmfsrc.c
index f6425587..06fc5027 100644
--- a/gst/dtmf/gstdtmfsrc.c
+++ b/gst/dtmf/gstdtmfsrc.c
@@ -715,9 +715,25 @@ gst_dtmf_src_change_state (GstElement * element, GstStateChange transition)
GstDTMFSrc *dtmfsrc;
GstStateChangeReturn result;
gboolean no_preroll = FALSE;
+ GstDTMFSrcEvent *event = NULL;
dtmfsrc = GST_DTMF_SRC (element);
+ switch (transition) {
+ case GST_STATE_CHANGE_READY_TO_PAUSED:
+ case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
+ /* Flushing the event queue */
+ event = g_async_queue_try_pop (dtmfsrc->event_queue);
+
+ while (event != NULL) {
+ g_free (event);
+ event = g_async_queue_try_pop (dtmfsrc->event_queue);
+ }
+ break;
+ default:
+ break;
+ }
+
if ((result =
GST_ELEMENT_CLASS (parent_class)->change_state (element,
transition)) == GST_STATE_CHANGE_FAILURE)
@@ -725,30 +741,30 @@ gst_dtmf_src_change_state (GstElement * element, GstStateChange transition)
switch (transition) {
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- {
- GstDTMFSrcEvent *event = NULL;
-
- /* TODO lock the element */
+ if (dtmfsrc->last_event) {
+ /* Don't forget to release the stream lock */
+ gst_dtmf_src_set_stream_lock (dtmfsrc, FALSE);
+ g_free (dtmfsrc->last_event);
+ dtmfsrc->last_event = NULL;
+ }
- if (dtmfsrc->last_event) {
- /* Don't forget to release the stream lock */
- gst_dtmf_src_set_stream_lock (dtmfsrc, FALSE);
- g_free (dtmfsrc->last_event);
- dtmfsrc->last_event = NULL;
- }
+ /* Flushing the event queue */
+ event = g_async_queue_try_pop (dtmfsrc->event_queue);
- /* Flushing the event queue */
+ while (event != NULL) {
+ g_free (event);
event = g_async_queue_try_pop (dtmfsrc->event_queue);
+ }
- while (event != NULL) {
- g_free (event);
- event = g_async_queue_try_pop (dtmfsrc->event_queue);
- }
+ /* Indicate that we don't do PRE_ROLL */
+ no_preroll = TRUE;
+ break;
+ case GST_STATE_CHANGE_PAUSED_TO_READY:
+ event = g_malloc (sizeof(GstDTMFSrcEvent));
+ event->event_type = DTMF_EVENT_TYPE_PAUSE_TASK;
+ g_async_queue_push (dtmfsrc->event_queue, event);
- /* Indicate that we don't do PRE_ROLL */
- no_preroll = TRUE;
- break;
- }
+ event = NULL;
default:
break;
}