Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(HLS): Fix seek on LL streams when using segments mode #5283

Merged
merged 1 commit into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions lib/media/media_source_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -1030,8 +1030,8 @@ shaka.media.MediaSourceEngine = class {
* @param {number} appendWindowEnd The timestamp to set the append window end
* to. For future appends, frames/samples with timestamps greater than this
* value will be dropped.
* @param {boolean} sequenceMode If true, the timestampOffset will not be
* applied in this step.
* @param {boolean} ignoreTimestampOffset If true, the timestampOffset will
* not be applied in this step.
* @param {shaka.extern.Stream} stream The current stream.
* @param {!Map.<shaka.util.ManifestParserUtils.ContentType,
* shaka.extern.Stream>} streamsByType
Expand All @@ -1042,10 +1042,10 @@ shaka.media.MediaSourceEngine = class {
*/
async setStreamProperties(
contentType, timestampOffset, appendWindowStart, appendWindowEnd,
sequenceMode, stream, streamsByType) {
ignoreTimestampOffset, stream, streamsByType) {
const ContentType = shaka.util.ManifestParserUtils.ContentType;
if (contentType == ContentType.TEXT) {
if (!sequenceMode) {
if (!ignoreTimestampOffset) {
this.textEngine_.setTimestampOffset(timestampOffset);
}
this.textEngine_.setAppendWindow(appendWindowStart, appendWindowEnd);
Expand All @@ -1066,10 +1066,7 @@ shaka.media.MediaSourceEngine = class {
hasChangedCodecs ? Promise.resolve() : this.enqueueOperation_(
contentType,
() => this.abort_(contentType)),
// Don't set the timestampOffset here when in sequenceMode, since we
// use timestampOffset for a different purpose in that mode (e.g. to
// indicate where the current segment is).
sequenceMode ? Promise.resolve() : this.enqueueOperation_(
ignoreTimestampOffset ? Promise.resolve() : this.enqueueOperation_(
contentType,
() => this.setTimestampOffset_(contentType, timestampOffset)),
this.enqueueOperation_(
Expand Down
7 changes: 5 additions & 2 deletions lib/media/streaming_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -1717,9 +1717,12 @@ shaka.media.StreamingEngine = class {
mediaState.lastMimeType = mimeType;
mediaState.lastTimestampOffset = timestampOffset;

const ignoreTimestampOffset = this.manifest_.sequenceMode ||
this.manifest_.type == shaka.media.ManifestParser.HLS;

await this.playerInterface_.mediaSourceEngine.setStreamProperties(
mediaState.type, timestampOffset, appendWindowStart,
appendWindowEnd, this.manifest_.sequenceMode,
appendWindowEnd, ignoreTimestampOffset,
mediaState.stream, streamsByType);
} catch (error) {
mediaState.lastAppendWindowStart = null;
Expand Down Expand Up @@ -1790,7 +1793,7 @@ shaka.media.StreamingEngine = class {
operations.push(this.playerInterface_.mediaSourceEngine.resync(
mediaState.type, reference.startTime));
}
} else {
} else if (this.manifest_.ignoreManifestTimestampsInSegmentsMode) {
// In segments mode, we need to resync to set the timestampOffset
// to the start of the current discontinuity sequence. This is
// because individual discontinuity sequences may have internal
Expand Down