diff --git a/src/config.js b/src/config.js index 512fd70..d7893ca 100644 --- a/src/config.js +++ b/src/config.js @@ -46,6 +46,7 @@ export const defaultConfig = { statisticsInfoReportInterval: 600, fixAudioTimestampGap: true, + dropSEI: false, accurateSeek: false, seekType: 'range', // [range, param, custom] diff --git a/src/demux/flv-demuxer.js b/src/demux/flv-demuxer.js index f3681e7..a533c7e 100644 --- a/src/demux/flv-demuxer.js +++ b/src/demux/flv-demuxer.js @@ -1668,10 +1668,14 @@ class FLVDemuxer { keyframe = true; } - let data = new Uint8Array(arrayBuffer, dataOffset + offset, lengthSize + naluSize); - let unit = {type: unitType, data: data}; - units.push(unit); - length += data.byteLength; + if (this._config.dropSEI && unitType === 6) { // SEI + // skip SEI Nalu + } else { + let data = new Uint8Array(arrayBuffer, dataOffset + offset, lengthSize + naluSize); + let unit = {type: unitType, data: data}; + units.push(unit); + length += data.byteLength; + } offset += lengthSize + naluSize; } @@ -1726,10 +1730,14 @@ class FLVDemuxer { keyframe = true; } - let data = new Uint8Array(arrayBuffer, dataOffset + offset, lengthSize + naluSize); - let unit = {type: unitType, data: data}; - units.push(unit); - length += data.byteLength; + if (this._config.dropSEI && (uintType === 39 || uintType === 40)) { // SEI + // drop SEI Nalu + } else { + let data = new Uint8Array(arrayBuffer, dataOffset + offset, lengthSize + naluSize); + let unit = {type: unitType, data: data}; + units.push(unit); + length += data.byteLength; + } offset += lengthSize + naluSize; }