16d2e872 by David LaPalomento

Adjust tfhd size for data offsets

Added 16 bytes to the tfhd to specify some default sample configuration so the data offset calculation in the trun must be adjusted to match. Audio now works for my test file. Copy Uint8Arrays used for deepEqual() tests because phantomjs considers two typed arrays with non-equal offsets to be non-equal.
1 parent 2c8f054c
......@@ -539,7 +539,7 @@ traf = function(track) {
// the data offset specifies the number of bytes from the start of
// the containing moof to the first payload byte of the associated
// mdat
dataOffset = (16 + // tfhd
dataOffset = (32 + // tfhd
16 + // tfdt
8 + // traf header
16 + // mfhd
......
......@@ -537,7 +537,7 @@ test('generates a moof for audio', function() {
deepEqual(moof[0].boxes[1].boxes.length, 3, 'generated three traf children');
trun = moof[0].boxes[1].boxes[2];
ok(trun, 'generated a trun');
deepEqual(trun.dataOffset, data.byteLength + 8, 'calculated the data offset');
equal(trun.dataOffset, data.byteLength + 8, 'calculated the data offset');
deepEqual(trun.samples, [{
duration: 9000,
size: 10
......
......@@ -997,7 +997,9 @@ test('generates AAC frame events from ADTS bytes', function() {
});
equal(frames.length, 1, 'generated one frame');
deepEqual(frames[0].data, new Uint8Array([0x12, 0x34]), 'extracted AAC frame');
deepEqual(new Uint8Array(frames[0].data),
new Uint8Array([0x12, 0x34]),
'extracted AAC frame');
equal(frames[0].channelcount, 2, 'parsed channelcount');
equal(frames[0].samplerate, 44100, 'parsed samplerate');
......@@ -1036,7 +1038,7 @@ test('parses across packets', function() {
});
equal(frames.length, 2, 'parsed two frames');
deepEqual(frames[1].data,
deepEqual(new Uint8Array(frames[1].data),
new Uint8Array([0x9a, 0xbc]),
'extracted the second AAC frame');
});
......