Skip to content

Commit 43f5210

Browse files
author
Clement Champetier
committed
AudioTransform: renamed _nbSamplesOfPreviousFrame to _previousNbInputSamplesPerChannel
1 parent f1ad8db commit 43f5210

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/AvTranscoder/transform/AudioTransform.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace avtranscoder
3333

3434
AudioTransform::AudioTransform()
3535
: _audioConvertContext(NULL)
36-
, _nbSamplesOfPreviousFrame(0)
36+
, _previousNbInputSamplesPerChannel(0)
3737
, _isInit(false)
3838
{
3939
}
@@ -97,7 +97,7 @@ void AudioTransform::updateOutputFrame(const size_t nbInputSamples, Frame& dstFr
9797
dstFrame.resize(bufferSizeNeeded);
9898

9999
// set nbSamples of output frame
100-
dst.setNbSamples(nbInputSamples);
100+
dst.setNbSamplesPerChannel(nbInputSamples);
101101
}
102102

103103
void AudioTransform::convert(const Frame& srcFrame, Frame& dstFrame)
@@ -106,23 +106,23 @@ void AudioTransform::convert(const Frame& srcFrame, Frame& dstFrame)
106106
_isInit = init(srcFrame, dstFrame);
107107

108108
// 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)
111111
{
112-
updateOutputFrame(nbSamplesOfCurrentFrame, dstFrame);
113-
_nbSamplesOfPreviousFrame = nbSamplesOfCurrentFrame;
112+
updateOutputFrame(nbInputSamplesPerChannel, dstFrame);
113+
_previousNbInputSamplesPerChannel = nbInputSamplesPerChannel;
114114
}
115115

116116
const unsigned char* srcData = srcFrame.getData();
117117
unsigned char* dstData = dstFrame.getData();
118118

119119
int nbOutputSamplesPerChannel;
120120
#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);
123123
#else
124124
nbOutputSamplesPerChannel =
125-
swr_convert(_audioConvertContext, &dstData, nbSamplesOfCurrentFrame, &srcData, nbSamplesOfCurrentFrame);
125+
swr_convert(_audioConvertContext, &dstData, nbInputSamplesPerChannel, &srcData, nbInputSamplesPerChannel);
126126
#endif
127127

128128
if(nbOutputSamplesPerChannel < 0)

src/AvTranscoder/transform/AudioTransform.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class AvExport AudioTransform : public ITransform
3838
private:
3939
ResampleContext* _audioConvertContext;
4040

41-
size_t _nbSamplesOfPreviousFrame; ///< To check if the number of samples change between frames
41+
size_t _previousNbInputSamplesPerChannel; ///< To check if the number of samples change between frames
4242

4343
bool _isInit;
4444
};

0 commit comments

Comments
 (0)