Bug 1497751 update driver state before handing control to another thread r=achronop

Differential Revision: https://phabricator.services.mozilla.com/D8180

--HG--
extra : rebase_source : 28d6f37a225f5ca9a4f7edb2323497b59dd806a7
extra : amend_source : 2e1d83177eba552a95b651f13bc452cb39f5f97e
This commit is contained in:
Karl Tomlinson 2018-10-13 12:45:18 +13:00
parent 298234a01c
commit fb511e7d71

View File

@ -1037,12 +1037,12 @@ AudioCallbackDriver::DataCallback(const AudioDataValue* aInputBuffer,
// StateCallback() receives an error for this stream while the main thread
// or another driver has control of the graph.
mShouldFallbackIfError = false;
RemoveMixerCallback();
// Update the flag before handing over the graph and going to drain.
mAudioThreadRunning = false;
// Enter shutdown mode. The stable-state handler will detect this
// and complete shutdown if the graph does not get restarted.
mGraphImpl->SignalMainThreadCleanup();
RemoveMixerCallback();
// Update the flag before go to drain
mAudioThreadRunning = false;
return aFrames - 1;
}
@ -1062,8 +1062,8 @@ AudioCallbackDriver::DataCallback(const AudioDataValue* aInputBuffer,
}
LOG(LogLevel::Debug, ("%p: Switching to system driver.", GraphImpl()));
RemoveMixerCallback();
SwitchToNextDriver();
mAudioThreadRunning = false;
SwitchToNextDriver();
// Returning less than aFrames starts the draining and eventually stops the
// audio thread. This function will never get called again.
return aFrames - 1;