Skip to content

Commit

Permalink
fix: Fix hang when seeking to the last segment (#4537)
Browse files Browse the repository at this point in the history
The fetchAndAppend_ function was not running on the last segment.
  • Loading branch information
ocipap authored and JulianDomingo committed Oct 7, 2022
1 parent 26be040 commit 2868e12
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ Rostislav Hejduk <[email protected]>
SameGoal Inc. <*@samegoal.com>
Sanborn Hilland <[email protected]>
Sander Saares <[email protected]>
Sanil Raut <[email protected]>
Seongryun Jo <[email protected]>
Swank Motion Pictures Inc. <*@swankmp.com>
TalkTalk Plc <*@talktalkplc.com>
Tatsiana Gelahova <[email protected]>
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Sander Saares <[email protected]>
Sandra Lokshina <[email protected]>
Satheesh Velmurugan <[email protected]>
Semih Gokceoglu <[email protected]>
Seongryun Jo <[email protected]>
Seth Madison <[email protected]>
Tatsiana Gelahova <[email protected]>
Theodore Abshire <[email protected]>
Expand Down
8 changes: 5 additions & 3 deletions lib/media/streaming_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,11 @@ shaka.media.StreamingEngine = class {
const timeUntilEnd =
this.manifest_.presentationTimeline.getDuration() - timeNeeded;
const oneMicrosecond = 1e-6;
if (timeUntilEnd < oneMicrosecond) {

const bufferEnd =
this.playerInterface_.mediaSourceEngine.bufferEnd(mediaState.type);

if (timeUntilEnd < oneMicrosecond && !!bufferEnd) {
// We shouldn't rebuffer if the playhead is close to the end of the
// presentation.
shaka.log.debug(logPrefix, 'buffered to end of presentation');
Expand Down Expand Up @@ -1021,8 +1025,6 @@ shaka.media.StreamingEngine = class {
return this.config_.updateIntervalSeconds / 2;
}

const bufferEnd =
this.playerInterface_.mediaSourceEngine.bufferEnd(mediaState.type);
const reference = this.getSegmentReferenceNeeded_(
mediaState, presentationTime, bufferEnd);
if (!reference) {
Expand Down

0 comments on commit 2868e12

Please sign in to comment.