зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1625372 permit ForceShutDown() on a realtime graph r=padenot
Depends on D74812 Differential Revision: https://phabricator.services.mozilla.com/D74813
This commit is contained in:
Родитель
3e139c32e0
Коммит
989d1fc6db
|
@ -1618,9 +1618,8 @@ class MediaTrackGraphShutDownRunnable : public Runnable {
|
|||
// mGraph is no longer needed, so delete it.
|
||||
mGraph->Destroy();
|
||||
} else {
|
||||
// The graph is not empty. We must be in a forced shutdown, either for
|
||||
// process shutdown or a non-realtime graph that has finished
|
||||
// processing. Some later AppendMessage will detect that the graph has
|
||||
// The graph is not empty. We must be in a forced shutdown.
|
||||
// Some later AppendMessage will detect that the graph has
|
||||
// been emptied, and delete it.
|
||||
NS_ASSERTION(mGraph->mForceShutDownReceived, "Not in forced shutdown?");
|
||||
mGraph->LifecycleStateRef() =
|
||||
|
@ -3129,12 +3128,10 @@ MediaTrackGraph* MediaTrackGraph::CreateNonRealtimeInstance(
|
|||
return graph;
|
||||
}
|
||||
|
||||
void MediaTrackGraph::DestroyNonRealtimeInstance(MediaTrackGraph* aGraph) {
|
||||
void MediaTrackGraph::ForceShutDown() {
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Main thread only");
|
||||
MOZ_ASSERT(aGraph->IsNonRealtime(),
|
||||
"Should not destroy the global graph here");
|
||||
|
||||
MediaTrackGraphImpl* graph = static_cast<MediaTrackGraphImpl*>(aGraph);
|
||||
MediaTrackGraphImpl* graph = static_cast<MediaTrackGraphImpl*>(this);
|
||||
|
||||
graph->ForceShutDown();
|
||||
}
|
||||
|
|
|
@ -1026,7 +1026,7 @@ class MediaTrackGraph {
|
|||
AbstractThread* AbstractMainThread();
|
||||
|
||||
// Idempotent
|
||||
static void DestroyNonRealtimeInstance(MediaTrackGraph* aGraph);
|
||||
void ForceShutDown();
|
||||
|
||||
virtual nsresult OpenAudioInput(CubebUtils::AudioDeviceID aID,
|
||||
AudioDataListener* aListener) = 0;
|
||||
|
|
|
@ -174,7 +174,8 @@ class MediaTrackGraphImpl : public MediaTrackGraph,
|
|||
* Make this MediaTrackGraph enter forced-shutdown state. This state
|
||||
* will be noticed by the media graph thread, which will shut down all tracks
|
||||
* and other state controlled by the media graph thread.
|
||||
* This is called during application shutdown.
|
||||
* This is called during application shutdown, and on document unload if an
|
||||
* AudioContext is using the graph.
|
||||
*/
|
||||
void ForceShutDown();
|
||||
|
||||
|
@ -841,13 +842,13 @@ class MediaTrackGraphImpl : public MediaTrackGraph,
|
|||
* creation after this point will create a new graph. An async event is
|
||||
* dispatched to Shutdown() the graph's threads and then delete the graph
|
||||
* object.
|
||||
* 2) Forced shutdown at application shutdown, or completion of a
|
||||
* non-realtime graph. A flag is set, RunThread() detects the flag and
|
||||
* exits, the next RunInStableState() detects the flag, and dispatches the
|
||||
* async event to Shutdown() the graph's threads. However the graph object
|
||||
* is not deleted. New messages for the graph are processed synchronously on
|
||||
* the main thread if necessary. When the last track is destroyed, the
|
||||
* graph object is deleted.
|
||||
* 2) Forced shutdown at application shutdown, completion of a non-realtime
|
||||
* graph, or document unload. A flag is set, RunThread() detects the flag
|
||||
* and exits, the next RunInStableState() detects the flag, and dispatches
|
||||
* the async event to Shutdown() the graph's threads. However the graph
|
||||
* object is not deleted. New messages for the graph are processed
|
||||
* synchronously on the main thread if necessary. When the last track is
|
||||
* destroyed, the graph object is deleted.
|
||||
*
|
||||
* This should be kept in sync with the LifecycleState_str array in
|
||||
* MediaTrackGraph.cpp
|
||||
|
@ -902,9 +903,8 @@ class MediaTrackGraphImpl : public MediaTrackGraph,
|
|||
}
|
||||
|
||||
/**
|
||||
* True when we need to do a forced shutdown, during process shutdown or
|
||||
* when shutting down a non-realtime graph, and the graph thread has
|
||||
* received the message. This is checked in the decision to shut down the
|
||||
* True once the graph thread has received the message from ForceShutDown().
|
||||
* This is checked in the decision to shut down the
|
||||
* graph thread so that control messages dispatched before forced shutdown
|
||||
* are processed on the graph thread.
|
||||
* Only set on the graph thread.
|
||||
|
|
|
@ -499,7 +499,7 @@ void AudioDestinationNode::OfflineShutdown() {
|
|||
"Should only be called on a valid OfflineAudioContext");
|
||||
|
||||
if (mTrack) {
|
||||
MediaTrackGraph::DestroyNonRealtimeInstance(mTrack->Graph());
|
||||
mTrack->Graph()->MediaTrackGraph::ForceShutDown();
|
||||
mOfflineRenderingRef.Drop(this);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче