mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
parent
dd8f7ff09a
commit
4ba485002c
3 changed files with 10 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue