86457417 by Justin Sanford

avoid lowest bitrate to be returned as the best fallback for resolution checking

1 parent 1670a237
...@@ -459,6 +459,10 @@ videojs.Hls.prototype.selectPlaylist = function () { ...@@ -459,6 +459,10 @@ videojs.Hls.prototype.selectPlaylist = function () {
459 // sort variants by resolution 459 // sort variants by resolution
460 bandwidthPlaylists.sort(videojs.Hls.comparePlaylistResolution); 460 bandwidthPlaylists.sort(videojs.Hls.comparePlaylistResolution);
461 461
462 // forget our old variant from above, or we might choose that in high-bandwidth scenarios
463 // (this could be the lowest bitrate rendition as we go through all of them above)
464 variant = null;
465
462 // iterate through the bandwidth-filtered playlists and find 466 // iterate through the bandwidth-filtered playlists and find
463 // best rendition by player dimension 467 // best rendition by player dimension
464 while (i--) { 468 while (i--) {
...@@ -485,7 +489,7 @@ videojs.Hls.prototype.selectPlaylist = function () { ...@@ -485,7 +489,7 @@ videojs.Hls.prototype.selectPlaylist = function () {
485 } else if (variant.attributes.RESOLUTION.width < player.width() && 489 } else if (variant.attributes.RESOLUTION.width < player.width() &&
486 variant.attributes.RESOLUTION.height < player.height()) { 490 variant.attributes.RESOLUTION.height < player.height()) {
487 // if we don't have an exact match, see if we have a good higher quality variant to use 491 // if we don't have an exact match, see if we have a good higher quality variant to use
488 if (oldvariant.attributes && oldvariant.attributes.RESOLUTION && 492 if (oldvariant && oldvariant.attributes && oldvariant.attributes.RESOLUTION &&
489 oldvariant.attributes.RESOLUTION.width && oldvariant.attributes.RESOLUTION.height) { 493 oldvariant.attributes.RESOLUTION.width && oldvariant.attributes.RESOLUTION.height) {
490 resolutionPlusOne = oldvariant; 494 resolutionPlusOne = oldvariant;
491 } 495 }
......