Bug 1258567 - per comment 3, ensure volume is only applied once to the AudioSegment. r=kinetik.

MozReview-Commit-ID: Bks59JySrep
This commit is contained in:
JW Wang 2016-03-23 10:16:15 +08:00
parent 9602fa95af
commit 8be2af10c1

View File

@ -452,8 +452,7 @@ DecodedStream::SetPreservesPitch(bool aPreservesPitch)
static void
SendStreamAudio(DecodedStreamData* aStream, int64_t aStartTime,
MediaData* aData, AudioSegment* aOutput,
uint32_t aRate, double aVolume)
MediaData* aData, AudioSegment* aOutput, uint32_t aRate)
{
// The amount of audio frames that is used to fuzz rounding errors.
static const int64_t AUDIO_FUZZ_FRAMES = 1;
@ -494,7 +493,6 @@ SendStreamAudio(DecodedStreamData* aStream, int64_t aStartTime,
}
aOutput->AppendFrames(buffer.forget(), channels, audio->mFrames);
aStream->mAudioFramesWritten += audio->mFrames;
aOutput->ApplyVolume(aVolume);
aStream->mNextAudioTime = audio->GetEndTime();
}
@ -518,9 +516,11 @@ DecodedStream::SendAudio(double aVolume, bool aIsSameOrigin)
// is ref-counted.
mAudioQueue.GetElementsAfter(mData->mNextAudioTime, &audio);
for (uint32_t i = 0; i < audio.Length(); ++i) {
SendStreamAudio(mData.get(), mStartTime.ref(), audio[i], &output, rate, aVolume);
SendStreamAudio(mData.get(), mStartTime.ref(), audio[i], &output, rate);
}
output.ApplyVolume(aVolume);
if (!aIsSameOrigin) {
output.ReplaceWithDisabled();
}