mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 1542931 add a mechanism to notify engine on graph thread of forced shutdown r=padenot
This will be used to release the AudioWorkletProcessor on the correct thread. Depends on D34480 Differential Revision: https://phabricator.services.mozilla.com/D34481 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
64d6bd309f
commit
ff940f743d
@ -1347,6 +1347,12 @@ void MediaStreamGraphImpl::Process() {
|
||||
|
||||
bool MediaStreamGraphImpl::UpdateMainThreadState() {
|
||||
MOZ_ASSERT(OnGraphThread());
|
||||
if (mForceShutDown) {
|
||||
for (MediaStream* stream : AllStreams()) {
|
||||
stream->NotifyForcedShutdown();
|
||||
}
|
||||
}
|
||||
|
||||
MonitorAutoLock lock(mMonitor);
|
||||
bool finalUpdate =
|
||||
mForceShutDown || (IsEmpty() && mBackMessageQueue.IsEmpty());
|
||||
|
@ -511,6 +511,10 @@ class MediaStream : public mozilla::LinkedListElement<MediaStream> {
|
||||
void DecrementSuspendCount();
|
||||
|
||||
protected:
|
||||
// Called on graph thread before handing control to the main thread to
|
||||
// release streams.
|
||||
virtual void NotifyForcedShutdown() {}
|
||||
|
||||
// |AdvanceTimeVaryingValuesToCurrentTime| will be override in
|
||||
// SourceMediaStream.
|
||||
virtual void AdvanceTimeVaryingValuesToCurrentTime(GraphTime aCurrentTime,
|
||||
|
@ -333,6 +333,10 @@ class AudioNodeEngine {
|
||||
// returning false, then the stream can be suspended.
|
||||
virtual bool IsActive() const { return false; }
|
||||
|
||||
// Called on forced shutdown of the MediaStreamGraph before handing ownership
|
||||
// from graph thread to main thread.
|
||||
virtual void NotifyForcedShutdown() {}
|
||||
|
||||
bool HasNode() const {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return !!mNode;
|
||||
|
@ -52,6 +52,10 @@ AudioNodeStream::~AudioNodeStream() {
|
||||
MOZ_COUNT_DTOR(AudioNodeStream);
|
||||
}
|
||||
|
||||
void AudioNodeStream::NotifyForcedShutdown() {
|
||||
mEngine->NotifyForcedShutdown();
|
||||
}
|
||||
|
||||
void AudioNodeStream::DestroyImpl() {
|
||||
// These are graph thread objects, so clean up on graph thread.
|
||||
mInputChunks.Clear();
|
||||
|
@ -175,6 +175,7 @@ class AudioNodeStream : public ProcessedMediaStream {
|
||||
class AdvanceAndResumeMessage;
|
||||
class CheckForInactiveMessage;
|
||||
|
||||
void NotifyForcedShutdown() override;
|
||||
void DestroyImpl() override;
|
||||
|
||||
/*
|
||||
@ -201,7 +202,7 @@ class AudioNodeStream : public ProcessedMediaStream {
|
||||
void DecrementActiveInputCount();
|
||||
|
||||
// The engine that will generate output for this node.
|
||||
nsAutoPtr<AudioNodeEngine> mEngine;
|
||||
const nsAutoPtr<AudioNodeEngine> mEngine;
|
||||
// The mixed input blocks are kept from iteration to iteration to avoid
|
||||
// reallocating channel data arrays and any buffers for mixing.
|
||||
OutputChunks mInputChunks;
|
||||
|
@ -23,6 +23,8 @@ class WorkletNodeEngine final : public AudioNodeEngine {
|
||||
void ConstructProcessor(AudioWorkletImpl* aWorkletImpl,
|
||||
const nsAString& aName,
|
||||
StructuredCloneHolder* aOptionsSerialization);
|
||||
|
||||
void NotifyForcedShutdown() override {}
|
||||
};
|
||||
|
||||
void WorkletNodeEngine::ConstructProcessor(
|
||||
|
Loading…
Reference in New Issue
Block a user