@@ -143,10 +143,10 @@ bool InputAudio::readNextFrame( Frame& frameBuffer, const size_t subStreamIndex
143
143
const int output_align = 1 ;
144
144
size_t decodedSize = av_samples_get_buffer_size (NULL , output_nbChannels, _frame->nb_samples , _codecContext->sample_fmt , output_align);
145
145
146
- size_t nbChannels = _codecContext->channels ;
146
+ size_t nbSubStreams = _codecContext->channels ;
147
147
size_t bytePerSample = av_get_bytes_per_sample ( (AVSampleFormat)_frame->format );
148
148
149
- if ( subStreamIndex > nbChannels - 1 )
149
+ if ( subStreamIndex > nbSubStreams - 1 )
150
150
{
151
151
throw std::runtime_error ( " The subStream doesn't exist" );
152
152
}
@@ -164,7 +164,7 @@ bool InputAudio::readNextFrame( Frame& frameBuffer, const size_t subStreamIndex
164
164
unsigned char * dst = audioBuffer.getPtr ();
165
165
166
166
// offset
167
- src += ( nbChannels - 1 - subStreamIndex ) * bytePerSample;
167
+ src += ( nbSubStreams - 1 - subStreamIndex ) * bytePerSample;
168
168
169
169
for ( int sample = 0 ; sample < _frame->nb_samples ; ++sample )
170
170
{
@@ -173,7 +173,7 @@ bool InputAudio::readNextFrame( Frame& frameBuffer, const size_t subStreamIndex
173
173
// std::cout << "dst " << static_cast<void *>(dst) << std::endl;
174
174
memcpy ( dst, src, bytePerSample );
175
175
dst += bytePerSample;
176
- src += bytePerSample * nbChannels ;
176
+ src += bytePerSample * nbSubStreams ;
177
177
}
178
178
}
179
179
return true ;
0 commit comments