c2e5f4b4 by Jon-Carlos Rivera Committed by GitHub

Changes to the underflow-detection in the gap-skipper to be less restrictive abo…

…ut the size of the gaps it is able to skip when an underflow is detected (#822)
1 parent 2ee05f74
...@@ -165,7 +165,7 @@ export default class GapSkipper { ...@@ -165,7 +165,7 @@ export default class GapSkipper {
165 // (13 seconds), at which point it stops as well. Since current time is past the 165 // (13 seconds), at which point it stops as well. Since current time is past the
166 // gap, findNextRange will return no ranges. 166 // gap, findNextRange will return no ranges.
167 // 167 //
168 // To check for this issue, we see if there is a small gap that is somewhere within 168 // To check for this issue, we see if there is a gap that starts somewhere within
169 // a 3 second range (3 seconds +/- 1 second) back from our current time. 169 // a 3 second range (3 seconds +/- 1 second) back from our current time.
170 let gaps = Ranges.findGaps(buffered); 170 let gaps = Ranges.findGaps(buffered);
171 171
...@@ -173,10 +173,8 @@ export default class GapSkipper { ...@@ -173,10 +173,8 @@ export default class GapSkipper {
173 let start = gaps.start(i); 173 let start = gaps.start(i);
174 let end = gaps.end(i); 174 let end = gaps.end(i);
175 175
176 // gap is small 176 // gap is starts no more than 4 seconds back
177 if (end - start < 1 && 177 if (currentTime - start < 4 && currentTime - start > 2) {
178 // gap is 3 seconds back +/- 1 second
179 currentTime - start < 4 && currentTime - end > 2) {
180 return { 178 return {
181 start, 179 start,
182 end 180 end
......
...@@ -174,20 +174,14 @@ QUnit.test('skips gap from video underflow', function() { ...@@ -174,20 +174,14 @@ QUnit.test('skips gap from video underflow', function() {
174 'returns null when gap is after current time'); 174 'returns null when gap is after current time');
175 QUnit.equal( 175 QUnit.equal(
176 this.gapSkipper.gapFromVideoUnderflow_( 176 this.gapSkipper.gapFromVideoUnderflow_(
177 videojs.createTimeRanges([[0, 10], [11.1, 20]]), 13), 177 videojs.createTimeRanges([[0, 10.1], [10.2, 20]]), 12.1),
178 null, 178 null,
179 'returns null when gap is too large'); 179 'returns null when time is less than or equal to 2 seconds ahead');
180 QUnit.equal(
181 this.gapSkipper.gapFromVideoUnderflow_(
182 videojs.createTimeRanges([[0, 10], [10.1, 20]]), 12.1),
183 null,
184 'returns null when time is less than or euqal to 2 seconds ahead');
185 QUnit.equal( 180 QUnit.equal(
186 this.gapSkipper.gapFromVideoUnderflow_( 181 this.gapSkipper.gapFromVideoUnderflow_(
187 videojs.createTimeRanges([[0, 10], [10.1, 20]]), 14.1), 182 videojs.createTimeRanges([[0, 10], [10.1, 20]]), 14.1),
188 null, 183 null,
189 'returns null when time is greater than or equal to 4 seconds ahead'); 184 'returns null when time is greater than or equal to 4 seconds ahead');
190
191 QUnit.deepEqual( 185 QUnit.deepEqual(
192 this.gapSkipper.gapFromVideoUnderflow_( 186 this.gapSkipper.gapFromVideoUnderflow_(
193 videojs.createTimeRanges([[0, 10], [10.1, 20]]), 12.2), 187 videojs.createTimeRanges([[0, 10], [10.1, 20]]), 12.2),
......