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 8b17c7f commit 72a119d
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 <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 @@ -104,6 +104,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 @@ -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 72a119d

Please sign in to comment.