@@ -139,32 +139,25 @@ bool InputAudio::readNextFrame( Frame& frameBuffer, const size_t subStreamIndex
139
139
if ( ! getNextFrame () )
140
140
return false ;
141
141
142
- size_t decodedSize = av_samples_get_buffer_size ( NULL , 1 ,
143
- _frame-> nb_samples ,
144
- _codecContext->sample_fmt , 1 );
142
+ const int output_nbChannels = 1 ;
143
+ const int output_align = 1 ;
144
+ size_t decodedSize = av_samples_get_buffer_size ( NULL , output_nbChannels, _frame-> nb_samples , _codecContext->sample_fmt , output_align );
145
145
146
146
size_t nbChannels = _codecContext->channels ;
147
147
size_t bytePerSample = av_get_bytes_per_sample ( (AVSampleFormat)_frame->format );
148
148
149
149
AudioFrame& audioBuffer = static_cast <AudioFrame&>( frameBuffer );
150
-
151
- // std::cout << "needed size " << audioBuffer.desc().getDataSize() << std::endl;
152
-
153
- // std::cout << _frame->nb_samples * bytePerSample << std::endl;
154
- // audioBuffer.getBuffer().resize( _frame->nb_samples * bytePerSample );
155
150
audioBuffer.setNbSamples ( _frame->nb_samples );
156
151
157
152
if ( decodedSize )
158
153
{
159
154
if ( audioBuffer.getSize () != decodedSize )
160
155
audioBuffer.getBuffer ().resize ( decodedSize, 0 );
161
156
162
- unsigned char * src = *_frame->data ;
157
+ // @todo manage cases with data of frame not only on data[0] (use _frame.linesize)
158
+ unsigned char * src = _frame->data [0 ];
163
159
unsigned char * dst = audioBuffer.getPtr ();
164
160
165
- // std::cout << "frame samples count " << _frame->nb_samples << std::endl;
166
- // std::cout << "frame data size " << audioBuffer.getSize() << std::endl;
167
-
168
161
// @todo check little / big endian
169
162
// offset for little endian
170
163
src += ( nbChannels - 1 - subStreamIndex ) * bytePerSample;
0 commit comments