mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 1423241 - Ignore runnables for main thread after next stream state update, after entering shutdown. r=padenot
They may hang on to references causing leaks. Differential Revision: https://phabricator.services.mozilla.com/D12281 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
dff48ba75c
commit
28dcbfa728
@ -1562,6 +1562,9 @@ class MediaStreamGraphShutDownRunnable : public Runnable {
|
||||
stream->RemoveAllListenersImpl();
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mGraph->mUpdateRunnables.IsEmpty());
|
||||
mGraph->mPendingUpdateRunnables.Clear();
|
||||
|
||||
mGraph->mForceShutdownTicket = nullptr;
|
||||
|
||||
// We can't block past the final LIFECYCLE_WAITING_FOR_STREAM_DESTRUCTION
|
||||
@ -4004,7 +4007,8 @@ already_AddRefed<MediaInputPort> MediaStreamGraphImpl::ConnectToCaptureStream(
|
||||
void MediaStreamGraph::DispatchToMainThreadAfterStreamStateUpdate(
|
||||
already_AddRefed<nsIRunnable> aRunnable) {
|
||||
AssertOnGraphThreadOrNotRunning();
|
||||
*mPendingUpdateRunnables.AppendElement() =
|
||||
*static_cast<MediaStreamGraphImpl*>(this)
|
||||
->mPendingUpdateRunnables.AppendElement() =
|
||||
AbstractMainThread()->CreateDirectTaskDrainer(std::move(aRunnable));
|
||||
}
|
||||
|
||||
|
@ -1324,8 +1324,11 @@ class MediaStreamGraph {
|
||||
*
|
||||
* Should only be called during MediaStreamListener callbacks or during
|
||||
* ProcessedMediaStream::ProcessInput().
|
||||
*
|
||||
* Note that if called during shutdown the runnable will be ignored and
|
||||
* released on main thread.
|
||||
*/
|
||||
virtual void DispatchToMainThreadAfterStreamStateUpdate(
|
||||
void DispatchToMainThreadAfterStreamStateUpdate(
|
||||
already_AddRefed<nsIRunnable> aRunnable);
|
||||
|
||||
/**
|
||||
@ -1360,9 +1363,6 @@ class MediaStreamGraph {
|
||||
bool OnGraphThreadOrNotRunning() const;
|
||||
bool OnGraphThread() const;
|
||||
|
||||
// Media graph thread only
|
||||
nsTArray<nsCOMPtr<nsIRunnable>> mPendingUpdateRunnables;
|
||||
|
||||
/**
|
||||
* Sample rate at which this graph runs. For real time graphs, this is
|
||||
* the rate of the audio mixer. For offline graphs, this is the rate specified
|
||||
|
@ -652,6 +652,11 @@ class MediaStreamGraphImpl : public MediaStreamGraph,
|
||||
* Number of active MediaInputPorts
|
||||
*/
|
||||
int32_t mPortCount;
|
||||
/**
|
||||
* Runnables to run after the next update to main thread state, but that are
|
||||
* still waiting for the next iteration to finish.
|
||||
*/
|
||||
nsTArray<nsCOMPtr<nsIRunnable>> mPendingUpdateRunnables;
|
||||
|
||||
/**
|
||||
* Devices to use for cubeb input & output, or nullptr for default device.
|
||||
|
Loading…
Reference in New Issue
Block a user