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 7e2c7d6 commit 951aaea
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 @@ -66,6 +66,8 @@ Rostislav Hejduk <Ross-cz@users.noreply.github.com>
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 @@ -99,6 +99,7 @@ Sander Saares <sander@saares.eu>
Sandra Lokshina <ismena@google.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 @@ -980,7 +980,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 @@ -1010,8 +1014,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 951aaea

Please sign in to comment.