Don't downshift in smart shifting.
Showing
1 changed file
with
5 additions
and
3 deletions
... | @@ -109,7 +109,7 @@ videojs.Hls.prototype.handleSourceOpen = function() { | ... | @@ -109,7 +109,7 @@ videojs.Hls.prototype.handleSourceOpen = function() { |
109 | this.playlists = new videojs.Hls.PlaylistLoader(this.src_, settings.withCredentials); | 109 | this.playlists = new videojs.Hls.PlaylistLoader(this.src_, settings.withCredentials); |
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, oldBitrate, newBitrate, segmentDuration, |
113 | segmentDlTime, setupEvents, threshold; | 113 | segmentDlTime, setupEvents, threshold; |
114 | 114 | ||
115 | setupEvents = function() { | 115 | setupEvents = function() { |
... | @@ -127,8 +127,10 @@ videojs.Hls.prototype.handleSourceOpen = function() { | ... | @@ -127,8 +127,10 @@ videojs.Hls.prototype.handleSourceOpen = function() { |
127 | oldMediaPlaylist = this.playlists.media(); | 127 | oldMediaPlaylist = this.playlists.media(); |
128 | this.bandwidth = this.playlists.bandwidth; | 128 | this.bandwidth = this.playlists.bandwidth; |
129 | selectedPlaylist = this.selectPlaylist(); | 129 | selectedPlaylist = this.selectPlaylist(); |
130 | oldBitrate = oldMediaPlaylist.attributes && | ||
131 | oldMediaPlaylist.attributes.BANDWIDTH || 0; | ||
130 | newBitrate = selectedPlaylist.attributes && | 132 | newBitrate = selectedPlaylist.attributes && |
131 | selectedPlaylist.attributes.BANDWIDTH; | 133 | selectedPlaylist.attributes.BANDWIDTH || 0; |
132 | segmentDuration = oldMediaPlaylist.segments && | 134 | segmentDuration = oldMediaPlaylist.segments && |
133 | oldMediaPlaylist.segments[this.mediaIndex].duration || | 135 | oldMediaPlaylist.segments[this.mediaIndex].duration || |
134 | oldMediaPlaylist.targetDuration; | 136 | oldMediaPlaylist.targetDuration; |
... | @@ -143,7 +145,7 @@ videojs.Hls.prototype.handleSourceOpen = function() { | ... | @@ -143,7 +145,7 @@ videojs.Hls.prototype.handleSourceOpen = function() { |
143 | // request which is a somewhat small file. | 145 | // request which is a somewhat small file. |
144 | threshold = 10; | 146 | threshold = 10; |
145 | 147 | ||
146 | if (segmentDlTime <= threshold) { | 148 | if (newBitrate > oldBitrate && segmentDlTime <= threshold) { |
147 | this.playlists.media(selectedPlaylist); | 149 | this.playlists.media(selectedPlaylist); |
148 | loaderHandler = videojs.bind(this, function() { | 150 | loaderHandler = videojs.bind(this, function() { |
149 | setupEvents.call(this); | 151 | setupEvents.call(this); | ... | ... |
-
Please register or sign in to post a comment