Skip to content

Commit

Permalink
Fixed tests that were failing because they lacked an idr-containing f…
Browse files Browse the repository at this point in the history
…rame as the first frame
  • Loading branch information
jrivera committed Mar 2, 2016
1 parent 8fa30d1 commit 738e676
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
6 changes: 1 addition & 5 deletions lib/mp4/transmuxer.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,7 @@ VideoSegmentStream = function(track) {
currentGop,
newGops;

// Only filter leading keyframes if we have more than one frame
// This is just a concession to make tests work. Since most tests
// don't bother creating leading iframes, they would usually get
// filtered ruining the test.
if (!gops[0][0].keyFrame && gops.length > 1) {
if (!gops[0][0].keyFrame) {
// Remove the first GOP
currentGop = gops.shift();

Expand Down
35 changes: 35 additions & 0 deletions test/transmuxer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1669,6 +1669,10 @@ QUnit.test('track values from seq_parameter_set_rbsp should be cleared by a flus
data: new Uint8Array([0xFF]),
nalUnitType: 'access_unit_delimiter_rbsp',
});
videoSegmentStream.push({
data: new Uint8Array([0xFF]),
nalUnitType: 'slice_layer_without_partitioning_rbsp_idr',
});
videoSegmentStream.push({
data: new Uint8Array([0xFF]),
nalUnitType: 'seq_parameter_set_rbsp',
Expand Down Expand Up @@ -1734,6 +1738,10 @@ QUnit.test('track pps from pic_parameter_set_rbsp should be cleared by a flush',
data: new Uint8Array([0xFF]),
nalUnitType: 'access_unit_delimiter_rbsp',
});
videoSegmentStream.push({
data: new Uint8Array([0xFF]),
nalUnitType: 'slice_layer_without_partitioning_rbsp_idr',
});
videoSegmentStream.push({
data: new Uint8Array([0x01]),
nalUnitType: 'pic_parameter_set_rbsp',
Expand Down Expand Up @@ -1808,6 +1816,12 @@ QUnit.test('calculates baseMediaDecodeTime values from the first DTS ever seen a
dts: 100,
pts: 100
});
videoSegmentStream.push({
data: new Uint8Array([0x09, 0x01]),
nalUnitType: 'slice_layer_without_partitioning_rbsp_idr',
dts: 100,
pts: 100
});
videoSegmentStream.push({
data: new Uint8Array([0x09, 0x01]),
nalUnitType: 'access_unit_delimiter_rbsp',
Expand Down Expand Up @@ -1844,6 +1858,12 @@ QUnit.test('calculates baseMediaDecodeTime values relative to a customizable bas
dts: 100,
pts: 100
});
videoSegmentStream.push({
data: new Uint8Array([0x09, 0x01]),
nalUnitType: 'slice_layer_without_partitioning_rbsp_idr',
dts: 100,
pts: 100
});
videoSegmentStream.push({
data: new Uint8Array([0x09, 0x01]),
nalUnitType: 'access_unit_delimiter_rbsp',
Expand Down Expand Up @@ -1880,6 +1900,12 @@ QUnit.test('subtract the first frame\'s compositionTimeOffset from baseMediaDeco
dts: 50,
pts: 60
});
videoSegmentStream.push({
data: new Uint8Array([0x09, 0x01]),
nalUnitType: 'slice_layer_without_partitioning_rbsp_idr',
dts: 50,
pts: 60
});
videoSegmentStream.push({
data: new Uint8Array([0x09, 0x01]),
nalUnitType: 'access_unit_delimiter_rbsp',
Expand Down Expand Up @@ -2204,6 +2230,9 @@ QUnit.test('no options creates combined output', function() {
0x06, 0xb6, 0xc2, 0xb5,
0xef, 0x7c, 0x04
], false)));
transmuxer.push(packetize(videoPes([
0x05, 0x01 //slice_layer_without_partitioning_rbsp_idr
], true)));
transmuxer.flush();

QUnit.equal(segments.length, 1, 'generated a combined video and audio segment');
Expand Down Expand Up @@ -2258,6 +2287,9 @@ QUnit.test('can specify that we want to generate separate audio and video segmen
0x06, 0xb6, 0xc2, 0xb5,
0xef, 0x7c, 0x04
], false)));
transmuxer.push(packetize(videoPes([
0x05, 0x01 //slice_layer_without_partitioning_rbsp_idr
], true)));
transmuxer.flush();

QUnit.equal(segmentLengthOnDone, 2, 'emitted both segments before triggering done');
Expand Down Expand Up @@ -2310,6 +2342,9 @@ QUnit.test('generates a video init segment', function() {
0x06, 0xb6, 0xc2, 0xb5,
0xef, 0x7c, 0x04
], false)));
transmuxer.push(packetize(videoPes([
0x05, 0x01 //slice_layer_without_partitioning_rbsp_idr
], true)));
transmuxer.flush();

QUnit.equal(segments.length, 1, 'generated a segment');
Expand Down

0 comments on commit 738e676

Please sign in to comment.