GNOME Bugzilla – Bug 767979
GstBufferPool: acquire_buffer has unsafe GstPoll usage
Last modified: 2016-06-29 20:51:37 UTC
+++ This bug was initially created as a clone of Bug #750397 +++
The order of the GstPoll usage is to first push an object to the queue, then write the GstPoll control. When getting the object, we first dequeue and if it is successful read the GstPoll control, and otherwise wait.
This could cause the read to happen before the write, which is not allowed by GstPoll.
There is also the problem that there is always one control left for flushing, but if multiple threads get into acquire_buffer and have to wait, two of them will remove that one control.
Created attachment 330573 [details] [review]
bufferpool: Fix handling of the GstPoll
Especially if multiple threads are waiting for buffers to be available again,
the current code was wrong. Fix this and document clearly how the GstPoll is
supposed to be used.
Also fix some potential races with reading from the GstPoll before writing
Attachment 330573 [details] pushed as 60a2087 - bufferpool: Fix handling of the GstPoll