45749f62 by Gary Katsevman

Add a fudge factor to smart upshift

1 parent 46460d84
...@@ -110,7 +110,7 @@ videojs.Hls.prototype.handleSourceOpen = function() { ...@@ -110,7 +110,7 @@ videojs.Hls.prototype.handleSourceOpen = function() {
110 110
111 this.playlists.on('loadedmetadata', videojs.bind(this, function() { 111 this.playlists.on('loadedmetadata', videojs.bind(this, function() {
112 var selectedPlaylist, loaderHandler, newBitrate, segmentDuration, 112 var selectedPlaylist, loaderHandler, newBitrate, segmentDuration,
113 segmentDlTime, setupEvents; 113 segmentDlTime, setupEvents, threshold;
114 114
115 setupEvents = function() { 115 setupEvents = function() {
116 this.fillBuffer(); 116 this.fillBuffer();
...@@ -133,7 +133,11 @@ videojs.Hls.prototype.handleSourceOpen = function() { ...@@ -133,7 +133,11 @@ videojs.Hls.prototype.handleSourceOpen = function() {
133 133
134 segmentDlTime = (segmentDuration * newBitrate) / this.bandwidth; 134 segmentDlTime = (segmentDuration * newBitrate) / this.bandwidth;
135 135
136 if (segmentDlTime <= 1) { 136 // this threshold is to account for having a high latency on the manifest
137 // request which is a somewhat small file.
138 threshold = 10;
139
140 if (segmentDlTime <= threshold) {
137 this.playlists.media(selectedPlaylist); 141 this.playlists.media(selectedPlaylist);
138 loaderHandler = videojs.bind(this, function() { 142 loaderHandler = videojs.bind(this, function() {
139 setupEvents.call(this); 143 setupEvents.call(this);
......