Skip to content

Commit

Permalink
fix: emsg ie11 test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
adrums86 committed Feb 20, 2023
1 parent a8146c7 commit 528e9ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion lib/mp4/emsg.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { getUint64 } = require('../utils/numbers.js');

var uint8ToCString = require('../utils/string.js').uint8ToCString;

/**
Expand Down Expand Up @@ -40,7 +42,7 @@ var parseEmsgBox = function(boxData) {
var dv = new DataView(boxData.buffer);
timescale = dv.getUint32(offset);
offset += 4;
presentation_time = Number(dv.getBigUint64(offset));
presentation_time = getUint64(boxData.subarray(offset));
offset += 8;
event_duration = dv.getUint32(offset);
offset += 4;
Expand Down
8 changes: 4 additions & 4 deletions test/mp4-probe.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ QUnit.test('can get ID3 data from a v0 EMSG box', function(assert) {
);

var v0EmsgId3Data = mp4Helpers.generateEmsgBoxData(0, id3Data);
var emsgId3Box = new Uint8Array(box('emsg', Array.from(v0EmsgId3Data)));
var emsgId3Box = new Uint8Array(box('emsg', [].slice.call(v0EmsgId3Data)));
var emsgBoxes = probe.getEmsgID3(emsgId3Box, 10);
assert.equal(emsgBoxes[0].cueTime, 20, 'got correct emsg cueTime value from v0 emsg');
assert.equal(emsgBoxes[0].duration, 0, 'got correct emsg duration value from v0 emsg');
Expand All @@ -169,7 +169,7 @@ QUnit.test('can get ID3 data from a v1 EMSG box', function(assert) {
);

var v1EmsgId3Data = mp4Helpers.generateEmsgBoxData(1, id3Data);
var emsgId3Box = new Uint8Array(box('emsg', Array.from(v1EmsgId3Data)));
var emsgId3Box = new Uint8Array(box('emsg', [].slice.call(v1EmsgId3Data)));
var emsgBoxes = probe.getEmsgID3(emsgId3Box);
assert.equal(emsgBoxes[0].cueTime, 100, 'got correct emsg cueTime value from v1 emsg');
assert.equal(emsgBoxes[0].duration, 0.01, 'got correct emsg duration value from v1 emsg');
Expand All @@ -192,10 +192,10 @@ QUnit.test('can get ID3 data from multiple EMSG boxes', function(assert) {
);

var v1EmsgId3Data = mp4Helpers.generateEmsgBoxData(1, v1id3Data);
var v1emsgId3Box = new Uint8Array(box('emsg', Array.from(v1EmsgId3Data)));
var v1emsgId3Box = new Uint8Array(box('emsg', [].slice.call(v1EmsgId3Data)));

var v0EmsgId3Data = mp4Helpers.generateEmsgBoxData(0, v0id3Data);
var v0emsgId3Box = new Uint8Array(box('emsg', Array.from(v0EmsgId3Data)));
var v0emsgId3Box = new Uint8Array(box('emsg', [].slice.call(v0EmsgId3Data)));

var multiBoxData = new Uint8Array(v1emsgId3Box.length + v0emsgId3Box.length);
multiBoxData.set(v1emsgId3Box);
Expand Down

0 comments on commit 528e9ed

Please sign in to comment.