gstpad: Make pad (de)activation atomic
authorEdward Hervey <edward@centricular.com>
Thu, 16 Nov 2017 09:47:46 +0000 (10:47 +0100)
committerEdward Hervey <bilboed@bilboed.com>
Thu, 16 Nov 2017 09:55:36 +0000 (10:55 +0100)
commitd915dd4b20ffdcb417ea4b46a8dd9010c7ce7bf9
treeb68a3fc1d543d87d67ffc96a6b396d3861e8fd8b
parent80262013ca553fa5b35e5c638893d3512a3dd7dc
gstpad: Make pad (de)activation atomic

The following could happen previously:
* T1: calls gst_pad_set_active()
* T2: currently (de)activating it
* T1: gst_pad_set_active() returns, caller assumes that the pad has
  completed the requested (de)activation ... whereas it is not
  the case since the actual (de)activation in T2 might still be
  going on.

To ensure atomicity of pad (de)activation, we use a internal
variable (and cond) to ensure only one thread at a time goes through
the actual (de)activation block

https://bugzilla.gnome.org/show_bug.cgi?id=790431
gst/gstpad.c