Skip to content

Commit

Permalink
fix: Fix timestamp offset for ID3 on DAI-HLS (shaka-project#4696)
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad committed Nov 14, 2022
1 parent b06fd6a commit 386a28a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/media/media_source_engine.js
Expand Up @@ -586,11 +586,14 @@ shaka.media.MediaSourceEngine = class {
mimeType = this.transmuxers_[contentType].getOrginalMimeType();
}
if (shaka.util.TsParser.probe(uint8ArrayData)) {
const metadata = new shaka.util.TsParser().parse(uint8ArrayData)
.getMetadata();
const tsParser = new shaka.util.TsParser().parse(uint8ArrayData);
// The SourceBuffer timestampOffset may or may not be set yet, so this is
// the timestamp offset that would eventually compute for this segment
// either way.
const timestampOffset =
reference.startTime - (tsParser.getStartTime()[contentType] || 0);
const metadata = tsParser.getMetadata();
if (metadata.length) {
const timestampOffset =
this.sourceBuffers_[contentType].timestampOffset;
this.onMetadata_(metadata, timestampOffset,
reference ? reference.endTime : null);
}
Expand Down

0 comments on commit 386a28a

Please sign in to comment.