@@ -88,21 +88,21 @@ void AudioTransform::convert( const Frame& srcFrame, Frame& dstFrame )
88
88
_isInit = init ( srcFrame, dstFrame );
89
89
90
90
// if number of samples change from previous frame
91
- const AudioFrame& srcAudioFrame = static_cast <const AudioFrame&>( srcFrame );
92
- if ( srcAudioFrame. getNbSamples () != _nbSamplesOfPreviousFrame )
91
+ const size_t nbSamplesOfCurrentFrame = static_cast <const AudioFrame&>( srcFrame ). getNbSamples ( );
92
+ if ( nbSamplesOfCurrentFrame != _nbSamplesOfPreviousFrame )
93
93
{
94
- updateOutputFrame ( srcAudioFrame. getNbSamples () , dstFrame );
95
- _nbSamplesOfPreviousFrame = srcAudioFrame. getNbSamples () ;
94
+ updateOutputFrame ( nbSamplesOfCurrentFrame , dstFrame );
95
+ _nbSamplesOfPreviousFrame = nbSamplesOfCurrentFrame ;
96
96
}
97
97
98
98
const unsigned char * srcData = srcFrame.getData ();
99
99
unsigned char * dstData = dstFrame.getData ();
100
100
101
101
int nbOutputSamplesPerChannel;
102
102
#ifdef AV_RESAMPLE_LIBRARY
103
- nbOutputSamplesPerChannel = avresample_convert ( _audioConvertContext, (uint8_t **)&dstData, 0 , _nbSamplesOfPreviousFrame , (uint8_t **)&srcData, 0 , _nbSamplesOfPreviousFrame );
103
+ nbOutputSamplesPerChannel = avresample_convert ( _audioConvertContext, (uint8_t **)&dstData, 0 , nbSamplesOfCurrentFrame , (uint8_t **)&srcData, 0 , nbSamplesOfCurrentFrame );
104
104
#else
105
- nbOutputSamplesPerChannel = swr_convert ( _audioConvertContext, &dstData, _nbSamplesOfPreviousFrame , &srcData, _nbSamplesOfPreviousFrame );
105
+ nbOutputSamplesPerChannel = swr_convert ( _audioConvertContext, &dstData, nbSamplesOfCurrentFrame , &srcData, nbSamplesOfCurrentFrame );
106
106
#endif
107
107
108
108
if ( nbOutputSamplesPerChannel < 0 )
0 commit comments