1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Fix #2106, #2011, RTMP/AAC transcode to Opus bug. 4.0.81

This commit is contained in:
Pieere Pi 2021-03-03 20:40:51 +08:00 committed by winlin
parent dd8f7ff09a
commit 4ba485002c
3 changed files with 10 additions and 5 deletions

View file

@ -130,10 +130,11 @@ srs_error_t SrsAudioDecoder::decode(SrsSample *pkt, char *buf, int &size)
return srs_error_new(ERROR_RTC_RTP_MUXER, "Failed to calculate data size");
}
for (int i = 0; i < frame_->nb_samples; i++) {
if (size + pcm_size * codec_ctx_->channels <= max) {
memcpy(buf + size,frame_->data[0] + pcm_size*codec_ctx_->channels * i, pcm_size * codec_ctx_->channels);
size += pcm_size * codec_ctx_->channels;
// @see https://github.com/ossrs/srs/pull/2011/files
for (int i = 0; i < codec_ctx_->channels; i++) {
if (size + pcm_size * frame_->nb_samples <= max) {
memcpy(buf + size,frame_->data[i],pcm_size * frame_->nb_samples);
size += pcm_size * frame_->nb_samples;
}
}
}