[0.11] gstreamer: inputselector: Hold the selector lock while reading properties of the active pad

Edward Hervey bilboed at kemper.freedesktop.org
Wed Mar 30 12:33:36 PDT 2011


Module: gstreamer
Branch: 0.11
Commit: c8ecd6e9ebc6529d1cabc60d75bb30c392b2a82d
URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=c8ecd6e9ebc6529d1cabc60d75bb30c392b2a82d

Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date:   Thu Mar 17 14:21:17 2011 +0100

inputselector: Hold the selector lock while reading properties of the active pad

---

 plugins/elements/gstinputselector.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/plugins/elements/gstinputselector.c b/plugins/elements/gstinputselector.c
index dbb3b22..0995e67 100644
--- a/plugins/elements/gstinputselector.c
+++ b/plugins/elements/gstinputselector.c
@@ -560,12 +560,14 @@ done:
   /* ERRORS */
 not_active:
   {
+    gboolean active_pad_pushed = GST_SELECTOR_PAD_CAST (active_sinkpad)->pushed;
+
     GST_INPUT_SELECTOR_UNLOCK (sel);
 
     /* unselected pad, perform fallback alloc or return unlinked when
      * asked */
     GST_OBJECT_LOCK (selpad);
-    if (selpad->always_ok || !GST_SELECTOR_PAD_CAST (active_sinkpad)->pushed) {
+    if (selpad->always_ok || !active_pad_pushed) {
       GST_DEBUG_OBJECT (pad, "Not selected, performing fallback allocation");
       *buf = NULL;
       result = GST_FLOW_OK;
@@ -707,6 +709,8 @@ done:
   /* dropped buffers */
 ignore:
   {
+    gboolean active_pad_pushed = GST_SELECTOR_PAD_CAST (active_sinkpad)->pushed;
+
     GST_DEBUG_OBJECT (pad, "Pad not active, discard buffer %p", buf);
     /* when we drop a buffer, we're creating a discont on this pad */
     selpad->discont = TRUE;
@@ -715,7 +719,7 @@ ignore:
 
     /* figure out what to return upstream */
     GST_OBJECT_LOCK (selpad);
-    if (selpad->always_ok || !GST_SELECTOR_PAD_CAST (active_sinkpad)->pushed)
+    if (selpad->always_ok || !active_pad_pushed)
       res = GST_FLOW_OK;
     else
       res = GST_FLOW_NOT_LINKED;



More information about the gstreamer-commits mailing list