Skip to content

Commit

Permalink
fix: Fix missing EMSG events (#7839)
Browse files Browse the repository at this point in the history
Fixes #7761
  • Loading branch information
avelad authored Jan 7, 2025
1 parent 34b69fa commit e6ca059
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions lib/media/media_source_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -941,14 +941,18 @@ shaka.media.MediaSourceEngine = class {
.box('moof', Mp4Parser.children)
.box('traf', Mp4Parser.children)
.fullBox('tfdt', (box) => {
goog.asserts.assert(
box.version == 0 || box.version == 1,
'TFDT version can only be 0 or 1');
const parsed = shaka.util.Mp4BoxParsers.parseTFDTInaccurate(
box.reader, box.version);
startTime = parsed.baseMediaDecodeTime / timescale;
parsedMedia = true;
box.parser.stop();
if (!parsedMedia) {
goog.asserts.assert(
box.version == 0 || box.version == 1,
'TFDT version can only be 0 or 1');
const parsed = shaka.util.Mp4BoxParsers.parseTFDTInaccurate(
box.reader, box.version);
startTime = parsed.baseMediaDecodeTime / timescale;
parsedMedia = true;
if (!hasEmsg) {
box.parser.stop();
}
}
}).parse(data, /* partialOkay= */ true);
if (parsedMedia && reference.timestampOffset == 0) {
timestamp = startTime;
Expand Down

0 comments on commit e6ca059

Please sign in to comment.