зеркало из https://github.com/mozilla/gecko-dev.git
b=938450 process all input samples in decodeAudioData r=padenot
--HG-- extra : transplant_source : %01%B2%FE%DA%BE%2CcX%B9%A7%60%15%FB%08%C5%2AS%99%B28
This commit is contained in:
Родитель
3d689d137a
Коммит
b56423c2be
|
@ -346,15 +346,11 @@ MediaDecodeTask::Decode()
|
|||
(audioData->mAudioBuffer->Data());
|
||||
|
||||
if (sampleRate != destSampleRate) {
|
||||
const uint32_t expectedOutSamples = static_cast<uint32_t>(
|
||||
static_cast<uint64_t>(destSampleRate) *
|
||||
static_cast<uint64_t>(audioData->mFrames) /
|
||||
static_cast<uint64_t>(sampleRate)
|
||||
);
|
||||
const uint32_t maxOutSamples = resampledFrames - mDecodeJob.mWriteIndex;
|
||||
|
||||
for (uint32_t i = 0; i < audioData->mChannels; ++i) {
|
||||
uint32_t inSamples = audioData->mFrames;
|
||||
uint32_t outSamples = expectedOutSamples;
|
||||
uint32_t outSamples = maxOutSamples;
|
||||
|
||||
WebAudioUtils::SpeexResamplerProcess(
|
||||
resampler, i, &bufferData[i * audioData->mFrames], &inSamples,
|
||||
|
@ -364,6 +360,7 @@ MediaDecodeTask::Decode()
|
|||
if (i == audioData->mChannels - 1) {
|
||||
mDecodeJob.mWriteIndex += outSamples;
|
||||
MOZ_ASSERT(mDecodeJob.mWriteIndex <= resampledFrames);
|
||||
MOZ_ASSERT(inSamples == audioData->mFrames);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -380,11 +377,11 @@ MediaDecodeTask::Decode()
|
|||
}
|
||||
|
||||
if (sampleRate != destSampleRate) {
|
||||
int inputLatency = speex_resampler_get_input_latency(resampler);
|
||||
int outputLatency = speex_resampler_get_output_latency(resampler);
|
||||
uint32_t inputLatency = speex_resampler_get_input_latency(resampler);
|
||||
const uint32_t maxOutSamples = resampledFrames - mDecodeJob.mWriteIndex;
|
||||
for (uint32_t i = 0; i < channelCount; ++i) {
|
||||
uint32_t inSamples = inputLatency;
|
||||
uint32_t outSamples = outputLatency;
|
||||
uint32_t outSamples = maxOutSamples;
|
||||
|
||||
WebAudioUtils::SpeexResamplerProcess(
|
||||
resampler, i, (AudioDataValue*)nullptr, &inSamples,
|
||||
|
@ -394,6 +391,7 @@ MediaDecodeTask::Decode()
|
|||
if (i == channelCount - 1) {
|
||||
mDecodeJob.mWriteIndex += outSamples;
|
||||
MOZ_ASSERT(mDecodeJob.mWriteIndex <= resampledFrames);
|
||||
MOZ_ASSERT(inSamples == inputLatency);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче