After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 767979 - GstBufferPool: acquire_buffer has unsafe GstPoll usage
GstBufferPool: acquire_buffer has unsafe GstPoll usage
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
Other All
: Normal critical
: 1.9.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on: 750397
Reported: 2016-06-23 14:59 UTC by Sebastian Dröge (slomo)
Modified: 2016-06-29 20:51 UTC
See Also:
GNOME target: ---
GNOME version: ---

bufferpool: Fix handling of the GstPoll (5.37 KB, patch)
2016-06-29 13:09 UTC, Sebastian Dröge (slomo)
committed Details | Review

Description Sebastian Dröge (slomo) 2016-06-23 14:59:05 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.
Comment 1 Sebastian Dröge (slomo) 2016-06-27 15:25:03 UTC
Comment 2 Sebastian Dröge (slomo) 2016-06-29 13:09:30 UTC
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
actually happened.
Comment 3 Sebastian Dröge (slomo) 2016-06-29 20:50:02 UTC
Attachment 330573 [details] pushed as 60a2087 - bufferpool: Fix handling of the GstPoll