Skip to content

Commit

Permalink
fix: 🐛 (xgplayer-transmuxer) 修复flv直播推流启动数据异常的情况
Browse files Browse the repository at this point in the history
  • Loading branch information
gemxx committed Sep 26, 2024
1 parent 81ffebc commit 1d7e96d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/xgplayer-transmuxer/src/flv/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 1d7e96d

Please sign in to comment.