diff --git a/lib/mp4/transmuxer.js b/lib/mp4/transmuxer.js index ca41fe0d..877ce585 100644 --- a/lib/mp4/transmuxer.js +++ b/lib/mp4/transmuxer.js @@ -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(); diff --git a/test/transmuxer.test.js b/test/transmuxer.test.js index 91e515d7..2a6d7c08 100644 --- a/test/transmuxer.test.js +++ b/test/transmuxer.test.js @@ -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', @@ -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', @@ -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', @@ -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', @@ -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', @@ -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'); @@ -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'); @@ -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');