Ticket #1063 (closed bug: invalid)
Quirk in bitrate switching
|Reported by:||jeroen||Owned by:||jeroen|
I was looking at the implementation of PlaylistItem.getLevel. Right now, it tries to find a level that has a bitrate that's not too high and a width that's not too high. It also ignores levels that are blacklisted. The code is clean and simple.
Unfortunately, it breaks really badly for some of our films. These days, we encode our films for our exact player size at a few bitrates and at larger widths at a few bitrates for when the user goes fullscreen. However, some of our older films are encoded at multiple bitrates, but all at 698 pixels wide. Since our player width is only 480 pixels, the currently algorithm always picks the lowest level no matter what. Hence, even if I have tons of CPU and tons of bandwidth, I'm stuck with the worst level. I suspect there are other people who may encounter this same issue, so it makes sense to apply a little bit more intelligence.
Here's the patch I wrote. It's a bit more complicated, but it's also a bit smarter. Also note that this patch assumes the levels are sorted by width, bitrate.