Skip to content

Commit

Permalink
fix: Avoid unnecessary timestampOffset updates when using HLS segment…
Browse files Browse the repository at this point in the history
…s mode (shaka-project#5270)

With this change, we are changing the minimum timestampOffsetDifference
to 0.1 to prevent unnecessary timestampOffset updates
  • Loading branch information
avelad committed Jun 8, 2023
1 parent ec8804d commit 9059944
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/media/media_source_engine.js
Expand Up @@ -691,7 +691,7 @@ shaka.media.MediaSourceEngine = class {
Math.round(metadataTimestamp.data) / 1000;
const timestampOffsetDifference =
Math.abs(timestampOffset - calculatedTimestampOffset);
if (timestampOffsetDifference >= 0.01 || seeked || adaptation) {
if (timestampOffsetDifference >= 0.1 || seeked || adaptation) {
timestampOffset = calculatedTimestampOffset;
this.enqueueOperation_(contentType, () =>
this.abort_(contentType));
Expand Down Expand Up @@ -741,7 +741,7 @@ shaka.media.MediaSourceEngine = class {
const calculatedTimestampOffset = reference.startTime - startTime;
const timestampOffsetDifference =
Math.abs(timestampOffset - calculatedTimestampOffset);
if (timestampOffsetDifference >= 0.01 || seeked || adaptation) {
if (timestampOffsetDifference >= 0.1 || seeked || adaptation) {
timestampOffset = calculatedTimestampOffset;
this.enqueueOperation_(contentType, () => this.abort_(contentType));
this.enqueueOperation_(
Expand All @@ -757,7 +757,7 @@ shaka.media.MediaSourceEngine = class {
const calculatedTimestampOffset = reference.startTime - startTime;
const timestampOffsetDifference =
Math.abs(timestampOffset - calculatedTimestampOffset);
if (timestampOffsetDifference >= 0.01 || seeked || adaptation) {
if (timestampOffsetDifference >= 0.1 || seeked || adaptation) {
timestampOffset = calculatedTimestampOffset;
// The SourceBuffer timestampOffset may or may not be set yet,
// so this is the timestamp offset that would eventually compute
Expand Down

0 comments on commit 9059944

Please sign in to comment.