[pitivi] SmartAdderBin: Reorganize request pad removal to avoid errors.



commit bf7d7386bb0d02f9df667c6074634993ec7049ea
Author: Edward Hervey <bilboed bilboed com>
Date:   Sun Jul 19 19:28:41 2009 +0200

    SmartAdderBin: Reorganize request pad removal to avoid errors.
    
    There is a corner case by which the streaming thread will currently
    be doing caps negotiation downstream (which is not aborted by the
    flush start/stop events that went through from gnonlin).
    In order to avoid the streaming thread from returning with GST_FLOW_NOT_LINKED
    once it has finished its business downstream, we deactivate the source pad
    of audioresample so that the streaming thread will return GST_FLOW_WRONG_STATE.

 pitivi/elements/mixer.py |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/elements/mixer.py b/pitivi/elements/mixer.py
index 610333b..78080b6 100644
--- a/pitivi/elements/mixer.py
+++ b/pitivi/elements/mixer.py
@@ -85,13 +85,19 @@ class SmartAdderBin(gst.Bin):
         name = pad.get_name()
         if name in self.inputs.keys():
             sinkpad, aconv, aresample, adderpad = self.inputs.pop(name)
-            self.remove_pad(sinkpad)
-            aconv.unlink(aresample)
-            aresample.get_pad("src").unlink(adderpad)
+            # we deactivate this pad to make sure that if ever the streaming
+            # thread was doing something downstream (like getting caps) it will
+            # return with GST_FLOW_WRONG_STATE and not GST_FLOW_NOT_LINKED (which is
+            # a fatal return flow).
+            aresample.get_pad("src").set_active(False)
+
             self.adder.release_request_pad(adderpad)
+            aresample.get_pad("src").unlink(adderpad)
+            aconv.unlink(aresample)
             aconv.set_state(gst.STATE_NULL)
             aresample.set_state(gst.STATE_NULL)
             self.remove(aconv, aresample)
+            self.remove_pad(sinkpad)
         self.debug("done")
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]