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 775351 - multihandlesink: buffers-queued is off by one
multihandlesink: buffers-queued is off by one
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
1.10.1
Other All
: Normal normal
: 1.10.3
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-11-29 16:30 UTC by Jan Alexander Steffens (heftig)
Modified: 2016-12-05 09:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PATCH] multihandlesink: Fix buffers-queued being off by one (1.46 KB, patch)
2016-11-29 16:30 UTC, Jan Alexander Steffens (heftig)
committed Details | Review

Description Jan Alexander Steffens (heftig) 2016-11-29 16:30:19 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.
Comment 1 Sebastian Dröge (slomo) 2016-11-29 17:15:46 UTC
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