GNOME Bugzilla – Bug 792595
"Race" when (de)activating pads
Last modified: 2018-11-03 12:44:29 UTC
Currently the following scenario can happen. * Thread 1 (from downstream elements) wants to reconfigure the scheduling mode of an upstream element (such as typefind) * Thread 2 (from the application or higher-level element) wants to deactivate the scheduling of that element. The following "race" happens: * T2 calls gst_pad_set_active(pad, FALSE) ** T2 calls activate_mode_internal(pad, ..., FALSE) ** T2 pad was currently active, it eventually calls pre_activate(pad, GST_PAD_MODE_NONE), which sets in_activation to TRUE and GST_PAD_MODE(pad) to GST_PAD_MODE_NONE ** T2 calls the actual activation function * T1 calls gst_pad_activate_mode(pad, ..., TRUE) ** T2 calls activate_mode_internal(pad, ...., TRUE) ** T2 has GST_PAD_MODE_NONE, so carries on to call pre_activate ** T2 in pre_activate sees that in_activation is TRUE, so waits for the other thread to finish (and set in_activation to FALSE) * T2 finished calling the actual activation function and calls post_activate ** T2 set in_activation to FALSE and resumes succesfully, i.e. telling the caller that the pad *is* deactivated * T1 can resume activation and actually activates the pad => T2 assumes the pad is deactivated .... but it's not. (Note that the exact opposite could also happen). Not entirely sure how this could be solved though.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/270.