GNOME Bugzilla – Bug 775351
multihandlesink: buffers-queued is off by one
Last modified: 2016-12-05 09:12:00 UTC
Created attachment 340988 [details] [review] [PATCH] multihandlesink: Fix buffers-queued being off by one Diving into multifdsink/multihandlesink's code convinced me that the buffers-queued property is off by one, since max_buffer_usage is actually the index of the oldest buffer, not the number of buffers queued. find_limits returns the index of the oldest buffer that satisfies the limits in its min_idx parameter, not the number of buffers needed. Fix this use too in order to keep passing the tests that read buffers-queued. Leave the starting value of max_buffer_usage alone, as find_limits will raise it to 0 anyway, ensuring at least one buffer in the queue. I don't know whether always keeping one buffer is desirable.
commit 58be3093449583d413e94233b27e4b1009b17704 Author: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com> Date: Tue Nov 29 15:30:43 2016 +0100 multihandlesink: Fix buffers-queued being off by one max_buffer_usage is the index of the oldest buffer in the queue, starting at zero, not the number of buffers queued. find_limits returns the index of the oldest buffer that satisfies the limits in its min_idx parameter, not the number of buffers needed. Fix this use too in order to keep passing the tests that read buffers-queued. https://bugzilla.gnome.org/show_bug.cgi?id=775351