Skip to content

Commit

Permalink
Warn when observing "seeked" event with empty buffer
Browse files Browse the repository at this point in the history
Related to #5274
  • Loading branch information
robwalch committed Mar 11, 2023
1 parent 6ba098d commit 9d33020
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/controller/gap-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export default class GapController {
// Clear stalled state when beginning or finishing seeking so that we don't report stalls coming out of a seek
if (beginSeek || seeked) {
this.stalled = null;
return;
}

// The playhead should not be moving
Expand Down
11 changes: 11 additions & 0 deletions src/controller/stream-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,17 @@ export default class StreamController
this.log(`Media seeked to ${(currentTime as number).toFixed(3)}`);
}

// If seeked was issued before buffer was appended do not tick immediately
const bufferInfo = this.getMainFwdBufferInfo();
if (bufferInfo === null || bufferInfo.len === 0) {
this.warn(
`Main forward buffer length on "seeked" event ${
bufferInfo ? bufferInfo.len : 'empty'
})`
);
return;
}

// tick to speed up FRAG_CHANGED triggering
this.tick();
}
Expand Down

0 comments on commit 9d33020

Please sign in to comment.