shaka-player 4.7.9 → 4.7.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -755,16 +755,10 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
755
755
 
756
756
  this.evict(this.periodStart_);
757
757
 
758
- if (timeline.length === 0) {
759
- return;
760
- }
761
-
762
- if (this.periodEnd_ !== Infinity) {
763
- // Adjust the last timeline entry to match the period end
764
- const lastTimePeriod = timeline[timeline.length - 1];
765
- // NOTE: end should be relative to period start
766
- lastTimePeriod.end = this.periodEnd_ - this.periodStart_;
767
- }
758
+ // Do NOT adjust last range to match period end! With high precision
759
+ // timestamps several recalculations may give wrong results on less precise
760
+ // platforms. To mitigate that, we're using cached |periodEnd_| value in
761
+ // find/get() methods whenever possible.
768
762
  }
769
763
 
770
764
  /**
@@ -784,7 +778,7 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
784
778
  const timeline = this.templateInfo_.timeline;
785
779
 
786
780
  // Early exit if the time isn't within this period
787
- if (time < this.periodStart_ || time > this.periodEnd_) {
781
+ if (time < this.periodStart_ || time >= this.periodEnd_) {
788
782
  return null;
789
783
  }
790
784
 
@@ -797,10 +791,14 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
797
791
  // the references by a fraction of a second. To account for this, we use
798
792
  // the start of the next segment as /end/, unless this is the last
799
793
  // reference, in which case we use the period end as the /end/
800
- let end = range.end + this.periodStart_;
794
+ let end;
801
795
 
802
796
  if (i < lastIndex) {
803
797
  end = timeline[i + 1].start + this.periodStart_;
798
+ } else if (this.periodEnd_ === Infinity) {
799
+ end = range.end + this.periodStart_;
800
+ } else {
801
+ end = this.periodEnd_;
804
802
  }
805
803
 
806
804
  if ((time >= start) && (time < end)) {
@@ -831,6 +829,12 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
831
829
  .unscaledPresentationTimeOffset + range.unscaledStart;
832
830
  const timestampOffset = this.periodStart_ -
833
831
  this.templateInfo_.scaledPresentationTimeOffset;
832
+ const trueSegmentEnd = this.periodStart_ + range.end;
833
+ let segmentEnd = trueSegmentEnd;
834
+ if (correctedPosition === this.getNumReferences() - 1 &&
835
+ this.periodEnd_ !== Infinity) {
836
+ segmentEnd = this.periodEnd_;
837
+ }
834
838
 
835
839
  const partialSegmentRefs = [];
836
840
 
@@ -901,7 +905,7 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
901
905
 
902
906
  ref = new shaka.media.SegmentReference(
903
907
  this.periodStart_ + range.start,
904
- this.periodStart_ + range.end,
908
+ segmentEnd,
905
909
  createUrisCb,
906
910
  /* startByte= */ 0,
907
911
  /* endByte= */ null,
@@ -916,6 +920,7 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
916
920
  shaka.media.SegmentReference.Status.AVAILABLE,
917
921
  this.aes128Key_,
918
922
  /* allPartialSegments= */ range.partialSegments > 0);
923
+ ref.trueEndTime = trueSegmentEnd;
919
924
  this.references[correctedPosition] = ref;
920
925
  }
921
926
 
@@ -2839,12 +2839,12 @@ shaka.hls.HlsParser = class {
2839
2839
  // Don't download the key object until the segment is parsed, to avoid a
2840
2840
  // startup delay for long manifests with lots of keys.
2841
2841
  keyInfo.fetchKey = async () => {
2842
- const keyUri = shaka.hls.Utils.constructSegmentUris(
2842
+ const keyUris = shaka.hls.Utils.constructSegmentUris(
2843
2843
  getUris(), drmTag.getRequiredAttrValue('URI'), variables);
2844
2844
 
2845
2845
  const requestType = shaka.net.NetworkingEngine.RequestType.KEY;
2846
2846
  const request = shaka.net.NetworkingEngine.makeRequest(
2847
- [keyUri], this.config_.retryParameters);
2847
+ keyUris, this.config_.retryParameters);
2848
2848
  const keyResponse = await this.makeNetworkRequest_(request, requestType);
2849
2849
 
2850
2850
  // keyResponse.status is undefined when URI is "data:text/plain;base64,"
@@ -129,7 +129,10 @@ shaka.media.InitSegmentReference = class {
129
129
  static equal(reference1, reference2) {
130
130
  const ArrayUtils = shaka.util.ArrayUtils;
131
131
  const BufferUtils = shaka.util.BufferUtils;
132
- if (!reference1 || !reference2) {
132
+
133
+ if (reference1 === reference2) {
134
+ return true;
135
+ } else if (!reference1 || !reference2) {
133
136
  return reference1 == reference2;
134
137
  } else {
135
138
  return reference1.getStartByte() == reference2.getStartByte() &&
@@ -2163,8 +2163,8 @@ shaka.media.StreamingEngine = class {
2163
2163
  const bufferedBehind = presentationTime - startTime;
2164
2164
 
2165
2165
  const overflow = bufferedBehind - bufferBehind;
2166
- // See: https://github.com/shaka-project/shaka-player/issues/2982
2167
- if (overflow <= 0.01) {
2166
+ // See: https://github.com/shaka-project/shaka-player/issues/6240
2167
+ if (overflow <= 1) {
2168
2168
  shaka.log.v2(logPrefix,
2169
2169
  'buffer behind okay:',
2170
2170
  'presentationTime=' + presentationTime,
package/lib/player.js CHANGED
@@ -6934,7 +6934,7 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
6934
6934
  * @export
6935
6935
  */
6936
6936
  // eslint-disable-next-line no-useless-concat
6937
- shaka.Player.version = 'v4.7.9' + '-uncompiled'; // x-release-please-version
6937
+ shaka.Player.version = 'v4.7.10' + '-uncompiled'; // x-release-please-version
6938
6938
 
6939
6939
  // Initialize the deprecation system using the version string we just set
6940
6940
  // on the player.
@@ -1215,7 +1215,18 @@ shaka.util.PeriodCombiner = class {
1215
1215
  return false;
1216
1216
  }
1217
1217
 
1218
- // If language-based differences haven't decided this, look at roles. If
1218
+ // If language-based differences haven't decided this, look at labels.
1219
+ // If available options differ, look does any matches with output stream.
1220
+ if (best.label !== candidate.label) {
1221
+ if (outputStream.label === best.label) {
1222
+ return false;
1223
+ }
1224
+ if (outputStream.label === candidate.label) {
1225
+ return true;
1226
+ }
1227
+ }
1228
+
1229
+ // If label-based differences haven't decided this, look at roles. If
1219
1230
  // the candidate has more roles in common with the output, upgrade to the
1220
1231
  // candidate.
1221
1232
  if (outputStream.roles.length) {
@@ -1410,6 +1421,17 @@ shaka.util.PeriodCombiner = class {
1410
1421
  return false;
1411
1422
  }
1412
1423
 
1424
+ // If language-based differences haven't decided this, look at labels.
1425
+ // If available options differ, look does any matches with output stream.
1426
+ if (best.label !== candidate.label) {
1427
+ if (outputStream.label === best.label) {
1428
+ return false;
1429
+ }
1430
+ if (outputStream.label === candidate.label) {
1431
+ return true;
1432
+ }
1433
+ }
1434
+
1413
1435
  // If the candidate has more roles in common with the output, upgrade to the
1414
1436
  // candidate.
1415
1437
  if (outputStream.roles.length) {
@@ -908,7 +908,7 @@ shaka.util.StreamUtils = class {
908
908
  // currently don't support 'fLaC', while 'flac' is supported by most
909
909
  // major browsers.
910
910
  // See https://bugs.chromium.org/p/chromium/issues/detail?id=1422728
911
- if (codecs === 'fLaC') {
911
+ if (codecs === 'fLaC' && !shaka.util.Platform.isSafari()) {
912
912
  return 'flac';
913
913
  }
914
914
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shaka-player",
3
3
  "description": "DASH/EME video player library",
4
- "version": "4.7.9",
4
+ "version": "4.7.10",
5
5
  "homepage": "https://github.com/shaka-project/shaka-player",
6
6
  "author": "Google",
7
7
  "maintainers": [
@@ -43,7 +43,7 @@
43
43
  "karma-coverage": "^2.2.0",
44
44
  "karma-jasmine": "^4.0.1",
45
45
  "karma-jasmine-ajax": "^0.1.13",
46
- "karma-local-wd-launcher": "^1.6.6",
46
+ "karma-local-wd-launcher": "^1.6.7",
47
47
  "karma-opera-launcher": "^1.0.0",
48
48
  "karma-sourcemap-loader": "^0.3.8",
49
49
  "karma-spec-reporter": "^0.0.34",