gstelement: protect async state changes against spurious wake ups
When a pipeline is pre-rolling, it waits for all sink elements to report they have received a buffer before completing the transition to paused. This async wait is done using a state condition variable. The way this waits are currently implemented do not protect against spurious conditional wake ups, which may happen due to external factors in the kernel.
This change implements the wait within a loop that iterates over the protected variable to reinitiates the wait if the wakeup was spurious. More details in the GCond docs.