title: GStreamer: Dynamically removing mixer src element freezes pipeline
body: <p>I am trying to mix audio using gstaudiomixer from two source elements that I add and remove dynamically.</p>
  
  <pre><code>+---------+    +------------+
  | source1 |---&gt;|            |
  +---------+    |            |    +-----------+
                 | audiomixer |---&gt;| audiosink |
  +---------+    |            |    +-----------+
  | source2 |---&gt;|            |
  +---------+    +------------+
  </code></pre>
  
  <p>Dynamically adding elements (using request pads and pad templates) seems to work as intended.
  However, when dynamically removing a pad causes the pipeline to freeze.</p>
  
  <p>This was the code I used to remove the element:</p>
  
  <pre><code>public void remove(Gst.Element? element)
  {
      /* Removes the element from the pipeline */
      if (element == null) return;
  
      element.set_state(Gst.State.NULL);  // Stop it from streaming data
      element.unlink(this.mixer);
      this.pipeline.remove(element);
  }
  </code></pre>
  
  <p>This is my second attempt, trying to block the pad:</p>
  
  <pre><code>public void remove(Gst.Element? element)
  {
      /* Removes the element from the pipeline */
      if (element == null) return;
  
      element.get_static_pad("src").get_peer().add_probe(Gst.PadProbeType.IDLE, (pad, info) =&gt; {
          element.set_state(Gst.State.NULL);  // Stop it from streaming data
          element.unlink(this.mixer);
          this.pipeline.remove(element);
          return Gst.PadProbeReturn.REMOVE;
      });
  }
  </code></pre>
  
  <p>What is the correct way to do this?</p>