4b4efa03 by David LaPalomento

Bump up initial bandwidth guess

Make the default bandwidth estimate a bit less conservative. On bad connections, this may lead to slower startups but it can be overridden through options or by setting the bandwidth property early.
1 parent 3e33b1f5
...@@ -51,6 +51,9 @@ videojs.HlsHandler = videojs.extend(Component, { ...@@ -51,6 +51,9 @@ videojs.HlsHandler = videojs.extend(Component, {
51 // being downloaded or processed 51 // being downloaded or processed
52 this.pendingSegment_ = null; 52 this.pendingSegment_ = null;
53 53
54 // start playlist selection at a reasonable bandwidth for
55 // broadband internet
56 this.bandwidth = options.bandwidth || 4194304; // 0.5 Mbps
54 this.bytesReceived = 0; 57 this.bytesReceived = 0;
55 58
56 // loadingState_ tracks how far along the buffering process we 59 // loadingState_ tracks how far along the buffering process we
......
...@@ -738,8 +738,8 @@ test('buffer checks are noops when only the master is ready', function() { ...@@ -738,8 +738,8 @@ test('buffer checks are noops when only the master is ready', function() {
738 type: 'application/vnd.apple.mpegurl' 738 type: 'application/vnd.apple.mpegurl'
739 }); 739 });
740 openMediaSource(player); 740 openMediaSource(player);
741 standardXHRResponse(requests.shift()); 741 standardXHRResponse(requests.shift()); // master
742 standardXHRResponse(requests.shift()); 742 standardXHRResponse(requests.shift()); // media
743 // ignore any outstanding segment requests 743 // ignore any outstanding segment requests
744 requests.length = 0; 744 requests.length = 0;
745 745
...@@ -752,7 +752,8 @@ test('buffer checks are noops when only the master is ready', function() { ...@@ -752,7 +752,8 @@ test('buffer checks are noops when only the master is ready', function() {
752 openMediaSource(player); 752 openMediaSource(player);
753 753
754 // respond with the master playlist but don't send the media playlist yet 754 // respond with the master playlist but don't send the media playlist yet
755 standardXHRResponse(requests.shift()); 755 player.tech_.hls.bandwidth = 1; // force media1 to be requested
756 standardXHRResponse(requests.shift()); // master
756 // trigger fillBuffer() 757 // trigger fillBuffer()
757 player.tech_.hls.checkBuffer_(); 758 player.tech_.hls.checkBuffer_();
758 759
...@@ -1377,8 +1378,8 @@ test('waits to download new segments until the media playlist is stable', functi ...@@ -1377,8 +1378,8 @@ test('waits to download new segments until the media playlist is stable', functi
1377 type: 'application/vnd.apple.mpegurl' 1378 type: 'application/vnd.apple.mpegurl'
1378 }); 1379 });
1379 openMediaSource(player); 1380 openMediaSource(player);
1380 standardXHRResponse(requests.shift()); // master
1381 player.tech_.hls.bandwidth = 1; // make sure we stay on the lowest variant 1381 player.tech_.hls.bandwidth = 1; // make sure we stay on the lowest variant
1382 standardXHRResponse(requests.shift()); // master
1382 standardXHRResponse(requests.shift()); // media1 1383 standardXHRResponse(requests.shift()); // media1
1383 1384
1384 // force a playlist switch 1385 // force a playlist switch
......