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 6, 2022
1 parent c7fae99 commit 3d6c768
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ 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 @@ -104,6 +104,7 @@ Sandra Lokshina <[email protected]>
Sanil Raut <[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 @@ -1012,7 +1012,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 @@ -1042,8 +1046,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 3d6c768

Please sign in to comment.