Bug 1042672 - s/aSamples/aFrames/ in AudioOutputObserver::InsertFarEnd so it's consistent with the rest of the media code. r=jesup

In Gecko (and everywhere else, but sometimes not in the WebRTC code), a "frame"
or "sample-frames" is the set of all sample that will play at the same time on
all channels, whereas a "sample" is a single value on a specific channel.
This commit is contained in:
Paul Adenot 2014-07-23 16:02:34 +02:00
parent 02f16281e5
commit 27cb259315
2 changed files with 6 additions and 6 deletions

View File

@ -27,7 +27,7 @@ public:
virtual ~AudioOutputObserver();
void Clear();
void InsertFarEnd(const AudioDataValue *aBuffer, uint32_t aSamples, bool aOverran,
void InsertFarEnd(const AudioDataValue *aBuffer, uint32_t aFrames, bool aOverran,
int aFreq, int aChannels, AudioSampleFormat aFormat);
uint32_t PlayoutFrequency() { return mPlayoutFreq; }
uint32_t PlayoutChannels() { return mPlayoutChannels; }

View File

@ -92,7 +92,7 @@ AudioOutputObserver::Size()
// static
void
AudioOutputObserver::InsertFarEnd(const AudioDataValue *aBuffer, uint32_t aSamples, bool aOverran,
AudioOutputObserver::InsertFarEnd(const AudioDataValue *aBuffer, uint32_t aFrames, bool aOverran,
int aFreq, int aChannels, AudioSampleFormat aFormat)
{
if (mPlayoutChannels != 0) {
@ -126,7 +126,7 @@ AudioOutputObserver::InsertFarEnd(const AudioDataValue *aBuffer, uint32_t aSampl
// Rechunk to 10ms.
// The AnalyzeReverseStream() and WebRtcAec_BufferFarend() functions insist on 10ms
// samples per call. Annoying...
while (aSamples) {
while (aFrames) {
if (!mSaved) {
mSaved = (FarEndAudioChunk *) moz_xmalloc(sizeof(FarEndAudioChunk) +
(mChunkSize * aChannels - 1)*sizeof(int16_t));
@ -135,8 +135,8 @@ AudioOutputObserver::InsertFarEnd(const AudioDataValue *aBuffer, uint32_t aSampl
aOverran = false;
}
uint32_t to_copy = mChunkSize - mSamplesSaved;
if (to_copy > aSamples) {
to_copy = aSamples;
if (to_copy > aFrames) {
to_copy = aFrames;
}
int16_t *dest = &(mSaved->mData[mSamplesSaved * aChannels]);
@ -147,7 +147,7 @@ AudioOutputObserver::InsertFarEnd(const AudioDataValue *aBuffer, uint32_t aSampl
fwrite(&(mSaved->mData[mSamplesSaved * aChannels]), to_copy * aChannels, sizeof(int16_t), fp);
}
#endif
aSamples -= to_copy;
aFrames -= to_copy;
mSamplesSaved += to_copy;
aBuffer += to_copy * aChannels;