@@ -33,7 +33,7 @@ namespace avtranscoder
33
33
34
34
AudioTransform::AudioTransform ()
35
35
: _audioConvertContext(NULL )
36
- , _nbSamplesOfPreviousFrame (0 )
36
+ , _previousNbInputSamplesPerChannel (0 )
37
37
, _isInit(false )
38
38
{
39
39
}
@@ -97,7 +97,7 @@ void AudioTransform::updateOutputFrame(const size_t nbInputSamples, Frame& dstFr
97
97
dstFrame.resize (bufferSizeNeeded);
98
98
99
99
// set nbSamples of output frame
100
- dst.setNbSamples (nbInputSamples);
100
+ dst.setNbSamplesPerChannel (nbInputSamples);
101
101
}
102
102
103
103
void AudioTransform::convert (const Frame& srcFrame, Frame& dstFrame)
@@ -106,23 +106,23 @@ void AudioTransform::convert(const Frame& srcFrame, Frame& dstFrame)
106
106
_isInit = init (srcFrame, dstFrame);
107
107
108
108
// if number of samples change from previous frame
109
- const size_t nbSamplesOfCurrentFrame = static_cast <const AudioFrame&>(srcFrame).getNbSamplesPerChannel ();
110
- if (nbSamplesOfCurrentFrame != _nbSamplesOfPreviousFrame )
109
+ const size_t nbInputSamplesPerChannel = static_cast <const AudioFrame&>(srcFrame).getNbSamplesPerChannel ();
110
+ if (nbInputSamplesPerChannel != _previousNbInputSamplesPerChannel )
111
111
{
112
- updateOutputFrame (nbSamplesOfCurrentFrame , dstFrame);
113
- _nbSamplesOfPreviousFrame = nbSamplesOfCurrentFrame ;
112
+ updateOutputFrame (nbInputSamplesPerChannel , dstFrame);
113
+ _previousNbInputSamplesPerChannel = nbInputSamplesPerChannel ;
114
114
}
115
115
116
116
const unsigned char * srcData = srcFrame.getData ();
117
117
unsigned char * dstData = dstFrame.getData ();
118
118
119
119
int nbOutputSamplesPerChannel;
120
120
#ifdef AVTRANSCODER_LIBAV_DEPENDENCY
121
- nbOutputSamplesPerChannel = avresample_convert (_audioConvertContext, (uint8_t **)&dstData, 0 , nbSamplesOfCurrentFrame ,
122
- (uint8_t **)&srcData, 0 , nbSamplesOfCurrentFrame );
121
+ nbOutputSamplesPerChannel = avresample_convert (_audioConvertContext, (uint8_t **)&dstData, 0 , nbInputSamplesPerChannel ,
122
+ (uint8_t **)&srcData, 0 , nbInputSamplesPerChannel );
123
123
#else
124
124
nbOutputSamplesPerChannel =
125
- swr_convert (_audioConvertContext, &dstData, nbSamplesOfCurrentFrame , &srcData, nbSamplesOfCurrentFrame );
125
+ swr_convert (_audioConvertContext, &dstData, nbInputSamplesPerChannel , &srcData, nbInputSamplesPerChannel );
126
126
#endif
127
127
128
128
if (nbOutputSamplesPerChannel < 0 )
0 commit comments