Description
[We were planning on submitting this as a PR, as we implemented this in our fork and found it useful in reducing rebuffering; but seems that it may be worth waiting for the refactoring to land. Thought it might be useful just to raise it now]
When changing bitrates, the player currently starts buffering at the new bitrate as soon as it can (based on an estimate on how far to offset the segment index based on the current bandwidth etc). This makes sense for upgrading bitrates, as you want the user to get the better quality bitrate as soon as possible.
But for downgrading bitrate, we may as well let the user watch all of the higher-quality media currently in the buffer, i.e. set the offset at the end of the current buffer. This was probably more noticeable for us as we set a relatively large buffer - 2 minutes - so if the buffer is full, we want to let that media play out.
As a side effect, it reduces the pressure on the buffer, as any bandwidth fluctuations that occur just after a bitrate switch are then less likely to cause a rebuffer, which I think is why we saw an improvement in our stats after adding the behaviour.