Bug 1586387 - Don't append a device change message to a graph that is going away. r=padenot

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Pehrson 2019-10-08 21:39:30 +00:00
parent 1417210039
commit cea60bb690

View File

@ -866,6 +866,15 @@ void MediaTrackGraphImpl::DeviceChanged() {
MediaTrackGraphImpl* mGraphImpl;
};
if (mMainThreadTrackCount == 0 && mMainThreadPortCount == 0) {
// This is a special case where the origin of this event cannot control the
// lifetime of the graph, because the graph is controling the lifetime of
// the AudioCallbackDriver where the event originated.
// We know the graph is soon going away, so there's no need to notify about
// this device change.
return;
}
// Reset the latency, it will get fetched again next time it's queried.
MOZ_ASSERT(NS_IsMainThread());
mAudioOutputLatency = 0.0;