зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1754006) for mda failures on test_bug1113600.html CLOSED TREE
Backed out changeset f22af4b15704 (bug 1754006) Backed out changeset 078521a5c82b (bug 1754006)
This commit is contained in:
Родитель
e81e5f0c57
Коммит
0541c7f30f
|
@ -16,7 +16,6 @@
|
|||
#include "mozilla/StaticPrefs_media.h"
|
||||
#include "mozilla/StaticPrefs_dom.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "Tracing.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -31,6 +30,9 @@ extern LazyLogModule gMediaDecoderLog;
|
|||
// The amount of audio frames that is used to fuzz rounding errors.
|
||||
static const int64_t AUDIO_FUZZ_FRAMES = 1;
|
||||
|
||||
// Amount of audio frames we will be processing ahead of use
|
||||
static const int32_t LOW_AUDIO_USECS = 300000;
|
||||
|
||||
using media::TimeUnit;
|
||||
|
||||
AudioSink::AudioSink(AbstractThread* aThread,
|
||||
|
@ -52,11 +54,9 @@ AudioSink::AudioSink(AbstractThread* aThread,
|
|||
StaticPrefs::dom_media_silence_duration_for_audibility()),
|
||||
mIsAudioDataAudible(false),
|
||||
mProcessedQueueFinished(false),
|
||||
mAudioQueue(aAudioQueue),
|
||||
mProcessedQueueThresholdMS(
|
||||
StaticPrefs::media_audio_audiosink_threshold_ms()) {
|
||||
mAudioQueue(aAudioQueue) {
|
||||
// Twice the limit that trigger a refill.
|
||||
float capacitySeconds = mProcessedQueueThresholdMS / 1000.f * 2;
|
||||
float capacitySeconds = LOW_AUDIO_USECS / 1000. / 1000. * 2;
|
||||
mProcessedSPSCQueue =
|
||||
MakeUnique<SPSCQueue<AudioDataValue>>(static_cast<uint32_t>(
|
||||
capacitySeconds * static_cast<float>(mOutputChannels * mOutputRate)));
|
||||
|
@ -216,11 +216,6 @@ uint32_t AudioSink::PopFrames(AudioDataValue* aBuffer, uint32_t aFrames,
|
|||
if (aAudioThreadChanged) {
|
||||
mProcessedSPSCQueue->ResetThreadIds();
|
||||
}
|
||||
|
||||
TRACE_COMMENT("AudioSink::PopFrames", "%u frames (ringbuffer: %u/%u)",
|
||||
aFrames, SampleToFrame(mProcessedSPSCQueue->AvailableRead()),
|
||||
SampleToFrame(mProcessedSPSCQueue->Capacity()));
|
||||
|
||||
const int samplesToPop = static_cast<int>(aFrames * mOutputChannels);
|
||||
const int samplesRead = mProcessedSPSCQueue->Dequeue(aBuffer, samplesToPop);
|
||||
MOZ_ASSERT(samplesRead % mOutputChannels == 0);
|
||||
|
@ -230,8 +225,6 @@ uint32_t AudioSink::PopFrames(AudioDataValue* aBuffer, uint32_t aFrames,
|
|||
SINK_LOG("Last PopFrames -- Source ended.");
|
||||
} else {
|
||||
NS_WARNING("Underrun when popping samples from audiosink ring buffer.");
|
||||
TRACE_COMMENT("AudioSink::PopFrames", "Underrun %u frames missing",
|
||||
SampleToFrame(samplesToPop - samplesRead));
|
||||
}
|
||||
// silence the rest
|
||||
PodZero(aBuffer + samplesRead, samplesToPop - samplesRead);
|
||||
|
@ -275,9 +268,10 @@ void AudioSink::OnAudioPushed(const RefPtr<AudioData>& aSample) {
|
|||
NotifyAudioNeeded();
|
||||
}
|
||||
|
||||
uint32_t AudioSink::AudioQueuedInRingBufferMS() const {
|
||||
uint32_t AudioSink::AudioQueuedInRingBufferUs() const {
|
||||
return static_cast<uint32_t>(
|
||||
1000 * SampleToFrame(mProcessedSPSCQueue->AvailableRead()) / mOutputRate);
|
||||
1000. * 1000 * SampleToFrame(mProcessedSPSCQueue->AvailableRead()) /
|
||||
mOutputRate);
|
||||
}
|
||||
|
||||
uint32_t AudioSink::SampleToFrame(uint32_t aSamples) const {
|
||||
|
@ -289,7 +283,7 @@ void AudioSink::NotifyAudioNeeded() {
|
|||
"Not called from the owner's thread");
|
||||
|
||||
while (mAudioQueue.GetSize() &&
|
||||
AudioQueuedInRingBufferMS() < mProcessedQueueThresholdMS) {
|
||||
AudioQueuedInRingBufferUs() < LOW_AUDIO_USECS) {
|
||||
// Check if there's room in our ring buffer.
|
||||
if (mAudioQueue.PeekFront()->Frames() >
|
||||
SampleToFrame(mProcessedSPSCQueue->AvailableWrite())) {
|
||||
|
@ -398,7 +392,6 @@ void AudioSink::NotifyAudioNeeded() {
|
|||
} else {
|
||||
silenceData = CreateAudioFromBuffer(std::move(silenceBuffer), data);
|
||||
}
|
||||
TRACE("Pushing silence");
|
||||
PushProcessedAudio(silenceData);
|
||||
}
|
||||
|
||||
|
@ -428,10 +421,6 @@ uint32_t AudioSink::PushProcessedAudio(AudioData* aData) {
|
|||
return 0;
|
||||
}
|
||||
int framesToEnqueue = static_cast<int>(aData->Frames() * aData->mChannels);
|
||||
TRACE_COMMENT("AudioSink::PushProcessedAudio", "%u frames (%u/%u)",
|
||||
framesToEnqueue,
|
||||
SampleToFrame(mProcessedSPSCQueue->AvailableWrite()),
|
||||
SampleToFrame(mProcessedSPSCQueue->Capacity()));
|
||||
DebugOnly<int> rv =
|
||||
mProcessedSPSCQueue->Enqueue(aData->Data().Elements(), framesToEnqueue);
|
||||
NS_WARNING_ASSERTION(
|
||||
|
|
|
@ -129,7 +129,7 @@ class AudioSink : private AudioStream::DataSource {
|
|||
AlignedAudioBuffer&& aBuffer, AudioData* aReference);
|
||||
// Add data to the processsed queue return the number of frames added.
|
||||
uint32_t PushProcessedAudio(AudioData* aData);
|
||||
uint32_t AudioQueuedInRingBufferMS() const;
|
||||
uint32_t AudioQueuedInRingBufferUs() const;
|
||||
uint32_t SampleToFrame(uint32_t aSamples) const;
|
||||
UniquePtr<AudioConverter> mConverter;
|
||||
UniquePtr<SPSCQueue<AudioDataValue>> mProcessedSPSCQueue;
|
||||
|
@ -153,7 +153,6 @@ class AudioSink : private AudioStream::DataSource {
|
|||
|
||||
Atomic<bool> mProcessedQueueFinished;
|
||||
MediaQueue<AudioData>& mAudioQueue;
|
||||
const float mProcessedQueueThresholdMS;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -9512,14 +9512,6 @@
|
|||
value: 8
|
||||
mirror: always
|
||||
|
||||
# The duration, in milliseconds, of decoded audio to keep around in the
|
||||
# AudioSink ring-buffer. New decoding operations are started when this limit is
|
||||
# reached. The total size of the ring-buffer is slightly bigger than this.
|
||||
- name: media.audio.audiosink.threshold_ms
|
||||
type: AtomicFloat
|
||||
value: 1000.0
|
||||
mirror: always
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Prefs starting with "midi."
|
||||
|
|
Загрузка…
Ссылка в новой задаче