From 0e06450bdfc3a7759e1fbe24b2dd5df0e9fddc34 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 25 May 2005 12:55:50 +0000 Subject: [PATCH] ext/amrnb/: Core already took the lock. Original commit message from CVS: * ext/amrnb/amrnbdec.c: (gst_amrnbdec_init), (gst_amrnbdec_chain), (gst_amrnbdec_state_change): * ext/amrnb/amrnbenc.c: (gst_amrnbenc_base_init), (gst_amrnbenc_finalize), (gst_amrnbenc_chain), (gst_amrnbenc_state_change): * ext/amrnb/amrnbparse.c: (gst_amrnbparse_init), (gst_amrnbparse_query), (gst_amrnbparse_chain), (gst_amrnbparse_read_header), (gst_amrnbparse_loop), (gst_amrnbparse_sink_activate), (gst_amrnbparse_state_change): Core already took the lock. --- ChangeLog | 13 ++++++++++++ ext/amrnb/amrnbdec.c | 4 ---- ext/amrnb/amrnbenc.c | 4 ---- ext/amrnb/amrnbparse.c | 45 ++++++++++-------------------------------- 4 files changed, 23 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4dd6070bd2..da2ba928c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2005-05-25 Wim Taymans + + * ext/amrnb/amrnbdec.c: (gst_amrnbdec_init), (gst_amrnbdec_chain), + (gst_amrnbdec_state_change): + * ext/amrnb/amrnbenc.c: (gst_amrnbenc_base_init), + (gst_amrnbenc_finalize), (gst_amrnbenc_chain), + (gst_amrnbenc_state_change): + * ext/amrnb/amrnbparse.c: (gst_amrnbparse_init), + (gst_amrnbparse_query), (gst_amrnbparse_chain), + (gst_amrnbparse_read_header), (gst_amrnbparse_loop), + (gst_amrnbparse_sink_activate), (gst_amrnbparse_state_change): + Core already took the lock. + 2005-05-19 Ronald S. Bultje * configure.ac: diff --git a/ext/amrnb/amrnbdec.c b/ext/amrnb/amrnbdec.c index dbb7e1d02d..345a006e84 100644 --- a/ext/amrnb/amrnbdec.c +++ b/ext/amrnb/amrnbdec.c @@ -173,8 +173,6 @@ gst_amrnbdec_chain (GstPad * pad, GstBuffer * buffer) amrnbdec = GST_AMRNBDEC (GST_PAD_PARENT (pad)); - GST_STREAM_LOCK (pad); - if (amrnbdec->rate == 0 || amrnbdec->channels == 0) goto not_negotiated; @@ -219,13 +217,11 @@ gst_amrnbdec_chain (GstPad * pad, GstBuffer * buffer) /* play */ ret = gst_pad_push (amrnbdec->srcpad, out); } - GST_STREAM_UNLOCK (pad); return ret; not_negotiated: { - GST_STREAM_UNLOCK (pad); return GST_FLOW_NOT_NEGOTIATED; } } diff --git a/ext/amrnb/amrnbenc.c b/ext/amrnb/amrnbenc.c index abe6d9fad0..294fc33fc9 100644 --- a/ext/amrnb/amrnbenc.c +++ b/ext/amrnb/amrnbenc.c @@ -192,7 +192,6 @@ gst_amrnbenc_chain (GstPad * pad, GstBuffer * buffer) amrnbenc = GST_AMRNBENC (GST_PAD_PARENT (pad)); - GST_STREAM_LOCK (pad); if (amrnbenc->rate == 0 || amrnbenc->channels == 0) goto not_negotiated; @@ -230,13 +229,10 @@ gst_amrnbenc_chain (GstPad * pad, GstBuffer * buffer) ret = gst_pad_push (amrnbenc->srcpad, out); } - GST_STREAM_UNLOCK (pad); - return ret; not_negotiated: { - GST_STREAM_UNLOCK (pad); return GST_FLOW_NOT_NEGOTIATED; } } diff --git a/ext/amrnb/amrnbparse.c b/ext/amrnb/amrnbparse.c index 6e651d4ba1..a1c942155f 100644 --- a/ext/amrnb/amrnbparse.c +++ b/ext/amrnb/amrnbparse.c @@ -266,8 +266,6 @@ gst_amrnbparse_chain (GstPad * pad, GstBuffer * buffer) amrnbparse = GST_AMRNBPARSE (GST_PAD_PARENT (pad)); - GST_STREAM_LOCK (pad); - gst_adapter_push (amrnbparse->adapter, buffer); res = GST_FLOW_OK; @@ -317,7 +315,6 @@ gst_amrnbparse_chain (GstPad * pad, GstBuffer * buffer) gst_adapter_flush (amrnbparse->adapter, block); } done: - GST_STREAM_UNLOCK (pad); return res; } @@ -373,7 +370,6 @@ gst_amrnbparse_loop (GstPad * pad) amrnbparse = GST_AMRNBPARSE (GST_PAD_PARENT (pad)); - GST_STREAM_LOCK (pad); /* init */ if (amrnbparse->need_header) { gboolean got_header; @@ -424,23 +420,19 @@ gst_amrnbparse_loop (GstPad * pad) if (ret != GST_FLOW_OK) goto need_pause; - GST_STREAM_UNLOCK (pad); - return; need_pause: { GST_LOG_OBJECT (amrnbparse, "pausing task"); - gst_task_pause (GST_RPAD_TASK (pad)); - GST_STREAM_UNLOCK (pad); + gst_pad_pause_task (pad); return; } eos: { GST_LOG_OBJECT (amrnbparse, "pausing task"); gst_pad_push_event (amrnbparse->srcpad, gst_event_new (GST_EVENT_EOS)); - gst_task_pause (GST_RPAD_TASK (pad)); - GST_STREAM_UNLOCK (pad); + gst_pad_pause_task (pad); return; } } @@ -459,37 +451,20 @@ gst_amrnbparse_sink_activate (GstPad * sinkpad, GstActivateMode mode) result = TRUE; break; case GST_ACTIVATE_PULL: - /* if we have a scheduler we can start the task */ - if (GST_ELEMENT_SCHEDULER (amrnbparse)) { - gst_pad_peer_set_active (sinkpad, mode); - GST_STREAM_LOCK (sinkpad); - GST_RPAD_TASK (sinkpad) = - gst_scheduler_create_task (GST_ELEMENT_SCHEDULER (amrnbparse), - (GstTaskFunction) gst_amrnbparse_loop, sinkpad); + gst_pad_peer_set_active (sinkpad, mode); - amrnbparse->need_header = TRUE; - amrnbparse->seekable = TRUE; - amrnbparse->ts = 0; - gst_task_start (GST_RPAD_TASK (sinkpad)); - GST_STREAM_UNLOCK (sinkpad); - result = TRUE; - } + amrnbparse->need_header = TRUE; + amrnbparse->seekable = TRUE; + amrnbparse->ts = 0; + + result = gst_pad_start_task (sinkpad, + (GstTaskFunction) gst_amrnbparse_loop, sinkpad); break; case GST_ACTIVATE_NONE: /* step 1, unblock clock sync (if any) */ /* step 2, make sure streaming finishes */ - GST_STREAM_LOCK (sinkpad); - - /* step 3, stop the task */ - if (GST_RPAD_TASK (sinkpad)) { - gst_task_stop (GST_RPAD_TASK (sinkpad)); - gst_object_unref (GST_OBJECT (GST_RPAD_TASK (sinkpad))); - GST_RPAD_TASK (sinkpad) = NULL; - } - GST_STREAM_UNLOCK (sinkpad); - - result = TRUE; + result = gst_pad_stop_task (sinkpad); break; } return result;