Skip to content
  • Matthew Waters's avatar
    queue2: avoid ping-pong between 0% and 100% buffering messages · c4ccff78
    Matthew Waters authored and Edward Hervey's avatar Edward Hervey committed
    If upstream is pushing buffers larger than our limits, only 1 buffer
    is ever in the queue at a time.  Once that single buffer has left the
    queue, a 0% buffering message would be posted followed immediately by a
    100% buffering message when the next buffer was inserted into the queue
    a very short time later.  As per the recommendations, This would result
    in the application pausing for a short while causing the appearance of
    a short stutter.
    
    The first step of a solution involves not posting a buffering message if
    there is still data waiting on the sink pad for insertion into the queue.
    This successfully drops the 0% messages from being posted however a
    message is still posted on each transition to 100% when the new buffer
    arrives resulting in a string of 100% buffering messages.  We silence
    these by storing the last posted buffering percentage and only posting a
    new message when it is different from or last posted message.
    c4ccff78