From 1d7e96d4873847d24d29d694b25f167929682bde Mon Sep 17 00:00:00 2001 From: gemstone Date: Thu, 26 Sep 2024 12:22:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20(xgplayer-transmuxer)=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Dflv=E7=9B=B4=E6=92=AD=E6=8E=A8=E6=B5=81?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=95=B0=E6=8D=AE=E5=BC=82=E5=B8=B8=E7=9A=84?= =?UTF-8?q?=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/xgplayer-transmuxer/src/flv/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/xgplayer-transmuxer/src/flv/index.js b/packages/xgplayer-transmuxer/src/flv/index.js index f952bc8f0..4074f570e 100644 --- a/packages/xgplayer-transmuxer/src/flv/index.js +++ b/packages/xgplayer-transmuxer/src/flv/index.js @@ -296,12 +296,22 @@ export class FlvDemuxer { } } + /** + * @param {Uint8Array} data + * @param {number} pts + * @param {import('./soundFormat').FlvSoundFormat} format + */ _parseG711 (data, pts, format) { const track = this.audioTrack + const audioData = data.subarray(1) + + if (audioData.byteLength < 1) return + + const sample = new AudioSample(pts, audioData) track.codecType = format === 7 ? AudioCodecType.G711PCMA : AudioCodecType.G711PCMU track.sampleRate = 8000 track.codec = track.codecType - track.samples.push(new AudioSample(pts, data.subarray(1))) + track.samples.push(sample) } _parseAac (data, pts) {