fix: 🐛 (xgplayer-transmuxer) 修复flv直播推流启动数据异常的情况

This commit is contained in:
gemstone 2024-09-26 12:22:56 +08:00
parent 81ffebc5a8
commit 1d7e96d487

View File

@ -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) {