Backed out changeset 0442a3ecb494 (bug 1400674) for failing mda tests dom/media/mediasource/test/test_BufferingWait_mp4.html and test_WaitingOnMissingData_mp4.html. r=backout

--HG--
extra : amend_source : 260df77d213debe033fef9a110fe665f180e50cc
This commit is contained in:
Sebastian Hengst 2017-10-16 10:18:06 +02:00
Родитель f0471958e1
Коммит caa3760fb4
1 изменённых файлов: 22 добавлений и 15 удалений

Просмотреть файл

@ -424,21 +424,28 @@ AudioSink::NotifyAudioNeeded()
missingFrames = std::min<int64_t>(INT32_MAX, missingFrames.value());
mFramesParsed += missingFrames.value();
RefPtr<AudioData> silenceData;
AlignedAudioBuffer silenceBuffer(missingFrames.value() * data->mChannels);
if (!silenceBuffer) {
NS_WARNING("OOM in AudioSink");
mErrored = true;
return;
}
if (mConverter->InputConfig() != mConverter->OutputConfig()) {
AlignedAudioBuffer convertedData =
mConverter->Process(AudioSampleBuffer(Move(silenceBuffer))).Forget();
silenceData = CreateAudioFromBuffer(Move(convertedData), data);
} else {
silenceData = CreateAudioFromBuffer(Move(silenceBuffer), data);
// We need to calculate how many frames are missing at the output rate.
missingFrames =
SaferMultDiv(missingFrames.value(), mOutputRate, data->mRate);
if (!missingFrames.isValid()) {
NS_WARNING("Int overflow in AudioSink");
mErrored = true;
return;
}
// We need to insert silence, first use drained frames if any.
missingFrames -= DrainConverter(missingFrames.value());
// Insert silence if still needed.
if (missingFrames.value()) {
AlignedAudioBuffer silenceData(missingFrames.value() * mOutputChannels);
if (!silenceData) {
NS_WARNING("OOM in AudioSink");
mErrored = true;
return;
}
RefPtr<AudioData> silence = CreateAudioFromBuffer(Move(silenceData), data);
PushProcessedAudio(silence);
}
PushProcessedAudio(silenceData);
}
mLastEndTime = data->GetEndTime();
@ -479,7 +486,7 @@ AudioSink::PushProcessedAudio(AudioData* aData)
already_AddRefed<AudioData>
AudioSink::CreateAudioFromBuffer(AlignedAudioBuffer&& aBuffer,
AudioData* aReference)
AudioData* aReference)
{
uint32_t frames = aBuffer.Length() / mOutputChannels;
if (!frames) {