Skip to content

Commit

Permalink
fix(FEC-11409): many shaka warnings printed in the log (#159)
Browse files Browse the repository at this point in the history
dont call `shaka.getManifest` where is not required

Solves FEC-11409
  • Loading branch information
yairans authored Jul 19, 2021
1 parent 28e4de0 commit 51f7adf
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions src/dash-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1175,10 +1175,7 @@ export default class DashAdapter extends BaseMediaSourceAdapter {
*/
getSegmentDuration(): number {
if (this._shaka) {
const manifest = this._shaka.getManifest();
if (manifest && manifest.presentationTimeline) {
return manifest.presentationTimeline.getMaxSegmentDuration();
}
return this._shaka.getStats().maxSegmentDuration;
}
return 0;
}
Expand Down Expand Up @@ -1301,24 +1298,20 @@ export default class DashAdapter extends BaseMediaSourceAdapter {
get targetBuffer(): number {
let targetBufferVal = NaN;
if (!this._shaka) return NaN;
const manifest = this._shaka.getManifest();
if (this.isLive()) {
if (this._shaka.getManifest() && this._shaka.getManifest().presentationTimeline) {
if (manifest && manifest.presentationTimeline) {
targetBufferVal =
this._shaka.getManifest().presentationTimeline.getSegmentAvailabilityEnd() -
this._shaka.getManifest().presentationTimeline.getSeekRangeEnd() -
manifest.presentationTimeline.getSegmentAvailabilityEnd() -
this._shaka.seekRange().end -
(this._videoElement.currentTime - this._getLiveEdge());
}
} else {
// consideration of the end of the playback in the target buffer calc
targetBufferVal = this._videoElement.duration - this._videoElement.currentTime;
}

if (this._shaka.getManifest() && this._shaka.getManifest().presentationTimeline) {
targetBufferVal = Math.min(
targetBufferVal,
this._shaka.getConfiguration().streaming.bufferingGoal + this._shaka.getManifest().presentationTimeline.getMaxSegmentDuration()
);
}
targetBufferVal = Math.min(targetBufferVal, this._shaka.getConfiguration().streaming.bufferingGoal + this._shaka.getStats().maxSegmentDuration);
return targetBufferVal;
}
}

0 comments on commit 51f7adf

Please sign in to comment.