Bug 1268861 - Insert the input data first and then run the graph iteration. r?jesup
This allows the graph to immediately process the input data instead of waiting
an iterationq
MozReview-Commit-ID: Cx9laCjcQYf
--- a/dom/media/GraphDriver.cpp
+++ b/dom/media/GraphDriver.cpp
@@ -838,16 +838,25 @@ AudioCallbackDriver::DataCallback(const
// duration so there is some damping against sudden changes.
if (!mIterationDurationMS) {
mIterationDurationMS = durationMS;
} else {
mIterationDurationMS = (mIterationDurationMS*3) + durationMS;
mIterationDurationMS /= 4;
}
+ // Process mic data if any/needed
+ if (aInputBuffer) {
+ if (mAudioInput) { // for this specific input-only or full-duplex stream
+ mAudioInput->NotifyInputData(mGraphImpl, aInputBuffer,
+ static_cast<size_t>(aFrames),
+ mSampleRate, mInputChannels);
+ }
+ }
+
mBuffer.SetBuffer(aOutputBuffer, aFrames);
// fill part or all with leftover data from last iteration (since we
// align to Audio blocks)
mScratchBuffer.Empty(mBuffer);
// if we totally filled the buffer (and mScratchBuffer isn't empty),
// we don't need to run an iteration and if we do so we may overflow.
if (mBuffer.Available()) {
@@ -894,25 +903,16 @@ AudioCallbackDriver::DataCallback(const
// Callback any observers for the AEC speaker data. Note that one
// (maybe) of these will be full-duplex, the others will get their input
// data off separate cubeb callbacks. Take care with how stuff is
// removed/added to this list and TSAN issues, but input and output will
// use separate callback methods.
mGraphImpl->NotifyOutputData(aOutputBuffer, static_cast<size_t>(aFrames),
mSampleRate, ChannelCount);
- // Process mic data if any/needed -- after inserting far-end data for AEC!
- if (aInputBuffer) {
- if (mAudioInput) { // for this specific input-only or full-duplex stream
- mAudioInput->NotifyInputData(mGraphImpl, aInputBuffer,
- static_cast<size_t>(aFrames),
- mSampleRate, mInputChannels);
- }
- }
-
bool switching = false;
{
MonitorAutoLock mon(mGraphImpl->GetMonitor());
switching = !!NextDriver();
}
if (switching && stillProcessing) {
// If the audio stream has not been started by the previous driver or