Bug 1476514 store AudioContext destination stream on AudioWorkletImpl r=padenot

The destination stream will provide currentFrame for AudioWorkletGlobalScope on the worklet execution thread.

On the control thread, it supports messages via the MediaStreamGraph and identifies the associated AudioContext.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Karl Tomlinson 2018-11-30 02:28:34 +00:00
Родитель 5995caa7e9
Коммит 0138ac87a9
2 изменённых файлов: 13 добавлений и 4 удалений

Просмотреть файл

@ -7,6 +7,7 @@
#include "AudioWorkletImpl.h"
#include "AudioContext.h"
#include "AudioNodeStream.h"
#include "mozilla/dom/AudioWorkletBinding.h"
#include "mozilla/dom/AudioWorkletGlobalScope.h"
#include "mozilla/dom/Worklet.h"
@ -31,13 +32,16 @@ namespace mozilla {
return nullptr;
}
RefPtr<AudioWorkletImpl> impl = new AudioWorkletImpl(window, principal);
RefPtr<AudioWorkletImpl> impl =
new AudioWorkletImpl(window, principal, aContext->DestinationStream());
return MakeAndAddRef<dom::Worklet>(window, std::move(impl));
}
AudioWorkletImpl::AudioWorkletImpl(nsPIDOMWindowInner* aWindow,
nsIPrincipal* aPrincipal)
: WorkletImpl(aWindow, aPrincipal) {}
nsIPrincipal* aPrincipal,
AudioNodeStream* aDestinationStream)
: WorkletImpl(aWindow, aPrincipal),
mDestinationStream(aDestinationStream) {}
AudioWorkletImpl::~AudioWorkletImpl() = default;

Просмотреть файл

@ -11,6 +11,8 @@
namespace mozilla {
class AudioNodeStream;
namespace dom {
class AudioContext;
}
@ -30,8 +32,11 @@ class AudioWorkletImpl final : public WorkletImpl {
already_AddRefed<dom::WorkletGlobalScope> ConstructGlobalScope() override;
private:
AudioWorkletImpl(nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal);
AudioWorkletImpl(nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal,
AudioNodeStream* aDestinationStream);
~AudioWorkletImpl();
const RefPtr<AudioNodeStream> mDestinationStream;
};
} // namespace mozilla