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 committed Oct 3, 2022
1 parent 8c198df commit 19a4842
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 @@ -70,6 +70,7 @@ SameGoal Inc. <*@samegoal.com>
Sanborn Hilland <sanbornh@rogers.com>
Sander Saares <sander@saares.eu>
Sanil Raut <sr1990003@gmail.com>
Seongryun Jo <ocipap0531@gmail.com>
Swank Motion Pictures Inc. <*@swankmp.com>
TalkTalk Plc <*@talktalkplc.com>
Tatsiana Gelahova <tatsiana.gelahova@gmail.com>
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ Sandra Lokshina <ismena@google.com>
Sanil Raut <sr1990003@gmail.com>
Satheesh Velmurugan <satheesh@philo.com>
Semih Gokceoglu <semih.gkcoglu@gmail.com>
Seongryun Jo <ocipap0531@gmail.com>
Seth Madison <seth@philo.com>
Tatsiana Gelahova <tatsiana.gelahova@gmail.com>
Theodore Abshire <theodab@google.com>
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 @@ -1015,7 +1015,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 @@ -1045,8 +1049,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 19a4842

Please sign in to comment.