зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1388236 - Remove B2G-only AudioChannel code from MSG. r=padenot
This commit is contained in:
Родитель
89fde0ce0f
Коммит
2f8cc7804c
|
@ -3585,7 +3585,7 @@ HTMLMediaElement::MozCaptureStream(ErrorResult& aRv)
|
|||
}
|
||||
|
||||
MediaStreamGraph* graph =
|
||||
MediaStreamGraph::GetInstance(graphDriverType, mAudioChannel, window);
|
||||
MediaStreamGraph::GetInstance(graphDriverType, window);
|
||||
|
||||
RefPtr<DOMMediaStream> stream =
|
||||
CaptureStreamInternal(StreamCaptureBehavior::CONTINUE_WHEN_ENDED,
|
||||
|
@ -3618,7 +3618,7 @@ HTMLMediaElement::MozCaptureStreamUntilEnded(ErrorResult& aRv)
|
|||
}
|
||||
|
||||
MediaStreamGraph* graph =
|
||||
MediaStreamGraph::GetInstance(graphDriverType, mAudioChannel, window);
|
||||
MediaStreamGraph::GetInstance(graphDriverType, window);
|
||||
|
||||
RefPtr<DOMMediaStream> stream =
|
||||
CaptureStreamInternal(StreamCaptureBehavior::FINISH_WHEN_ENDED,
|
||||
|
@ -5158,11 +5158,6 @@ void HTMLMediaElement::SetupSrcMediaStreamPlayback(DOMMediaStream* aStream)
|
|||
return;
|
||||
}
|
||||
|
||||
RefPtr<MediaStream> stream = GetSrcMediaStream();
|
||||
if (stream) {
|
||||
stream->SetAudioChannelType(mAudioChannel);
|
||||
}
|
||||
|
||||
UpdateSrcMediaStreamPlaying();
|
||||
|
||||
// If we pause this media element, track changes in the underlying stream
|
||||
|
@ -7252,8 +7247,7 @@ HTMLMediaElement::AudioCaptureStreamChange(bool aCapture)
|
|||
|
||||
uint64_t id = window->WindowID();
|
||||
MediaStreamGraph* msg =
|
||||
MediaStreamGraph::GetInstance(MediaStreamGraph::AUDIO_THREAD_DRIVER,
|
||||
mAudioChannel, window);
|
||||
MediaStreamGraph::GetInstance(MediaStreamGraph::AUDIO_THREAD_DRIVER, window);
|
||||
|
||||
if (GetSrcMediaStream()) {
|
||||
mCaptureStreamPort = msg->ConnectToCaptureStream(id, GetSrcMediaStream());
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "mozilla/CORSMode.h"
|
||||
#include "DecoderTraits.h"
|
||||
#include "nsIAudioChannelAgent.h"
|
||||
#include "mozilla/dom/AudioChannelBinding.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/TextTrackManager.h"
|
||||
#include "mozilla/WeakPtr.h"
|
||||
|
|
|
@ -279,9 +279,7 @@ CanvasCaptureMediaStream::CreateSourceStream(nsPIDOMWindowInner* aWindow,
|
|||
{
|
||||
RefPtr<CanvasCaptureMediaStream> stream = new CanvasCaptureMediaStream(aWindow, aCanvas);
|
||||
MediaStreamGraph* graph =
|
||||
MediaStreamGraph::GetInstance(MediaStreamGraph::SYSTEM_THREAD_DRIVER,
|
||||
AudioChannel::Normal,
|
||||
aWindow);
|
||||
MediaStreamGraph::GetInstance(MediaStreamGraph::SYSTEM_THREAD_DRIVER, aWindow);
|
||||
stream->InitSourceStream(graph);
|
||||
return stream.forget();
|
||||
}
|
||||
|
|
|
@ -563,8 +563,7 @@ DOMMediaStream::Constructor(const GlobalObject& aGlobal,
|
|||
if (!newStream->GetPlaybackStream()) {
|
||||
MOZ_ASSERT(aTracks.IsEmpty());
|
||||
MediaStreamGraph* graph =
|
||||
MediaStreamGraph::GetInstance(MediaStreamGraph::SYSTEM_THREAD_DRIVER,
|
||||
AudioChannel::Normal, ownerWindow);
|
||||
MediaStreamGraph::GetInstance(MediaStreamGraph::SYSTEM_THREAD_DRIVER, ownerWindow);
|
||||
newStream->InitPlaybackStreamCommon(graph);
|
||||
}
|
||||
|
||||
|
|
|
@ -565,7 +565,6 @@ AudioCallbackDriver::AudioCallbackDriver(MediaStreamGraphImpl* aGraphImpl)
|
|||
, mIterationDurationMS(MEDIA_GRAPH_TARGET_PERIOD_MS)
|
||||
, mStarted(false)
|
||||
, mAudioInput(nullptr)
|
||||
, mAudioChannel(aGraphImpl->AudioChannel())
|
||||
, mAddedMixer(false)
|
||||
, mInCallback(false)
|
||||
, mMicrophoneActive(false)
|
||||
|
|
|
@ -525,8 +525,6 @@ private:
|
|||
nsCOMPtr<nsIThread> mInitShutdownThread;
|
||||
/* This must be accessed with the graph monitor held. */
|
||||
AutoTArray<StreamAndPromiseForOperation, 1> mPromisesForOperation;
|
||||
/* This is set during initialization, and can be read safely afterwards. */
|
||||
dom::AudioChannel mAudioChannel;
|
||||
/* Used to queue us to add the mixer callback on first run. */
|
||||
bool mAddedMixer;
|
||||
|
||||
|
|
|
@ -1062,8 +1062,7 @@ public:
|
|||
mAudioDevice ? MediaStreamGraph::AUDIO_THREAD_DRIVER
|
||||
: MediaStreamGraph::SYSTEM_THREAD_DRIVER;
|
||||
MediaStreamGraph* msg =
|
||||
MediaStreamGraph::GetInstance(graphDriverType,
|
||||
dom::AudioChannel::Normal, window);
|
||||
MediaStreamGraph::GetInstance(graphDriverType, window);
|
||||
|
||||
RefPtr<DOMMediaStream> domStream;
|
||||
RefPtr<SourceMediaStream> stream;
|
||||
|
@ -3719,8 +3718,7 @@ SourceListener::StopSharing()
|
|||
MOZ_RELEASE_ASSERT(window);
|
||||
window->SetAudioCapture(false);
|
||||
MediaStreamGraph* graph =
|
||||
MediaStreamGraph::GetInstance(MediaStreamGraph::AUDIO_THREAD_DRIVER,
|
||||
dom::AudioChannel::Normal, window);
|
||||
MediaStreamGraph::GetInstance(MediaStreamGraph::AUDIO_THREAD_DRIVER, window);
|
||||
graph->UnregisterCaptureStreamForWindow(windowID);
|
||||
mStream->Destroy();
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "TrackUnionStream.h"
|
||||
#include "ImageContainer.h"
|
||||
#include "AudioCaptureStream.h"
|
||||
#include "AudioChannelService.h"
|
||||
#include "AudioNodeStream.h"
|
||||
#include "AudioNodeExternalInputStream.h"
|
||||
#include "MediaStreamListener.h"
|
||||
|
@ -59,7 +58,7 @@ enum SourceMediaStream::TrackCommands : uint32_t {
|
|||
};
|
||||
|
||||
/**
|
||||
* A hash table containing the graph instances, one per AudioChannel.
|
||||
* A hash table containing the graph instances, one per document.
|
||||
*/
|
||||
static nsDataHashtable<nsUint32HashKey, MediaStreamGraphImpl*> gGraphs;
|
||||
|
||||
|
@ -1912,7 +1911,6 @@ MediaStream::MediaStream()
|
|||
, mMainThreadDestroyed(false)
|
||||
, mNrOfMainThreadUsers(0)
|
||||
, mGraph(nullptr)
|
||||
, mAudioChannelType(dom::AudioChannel::Normal)
|
||||
{
|
||||
MOZ_COUNT_CTOR(MediaStream);
|
||||
}
|
||||
|
@ -1997,7 +1995,6 @@ MediaStream::SetGraphImpl(MediaStreamGraphImpl* aGraph)
|
|||
{
|
||||
MOZ_ASSERT(!mGraph, "Should only be called once");
|
||||
mGraph = aGraph;
|
||||
mAudioChannelType = aGraph->AudioChannel();
|
||||
mTracks.InitGraphRate(aGraph->GraphRate());
|
||||
}
|
||||
|
||||
|
@ -3444,7 +3441,6 @@ ProcessedMediaStream::DestroyImpl()
|
|||
|
||||
MediaStreamGraphImpl::MediaStreamGraphImpl(GraphDriverType aDriverRequested,
|
||||
TrackRate aSampleRate,
|
||||
dom::AudioChannel aChannel,
|
||||
AbstractThread* aMainThread)
|
||||
: MediaStreamGraph(aSampleRate)
|
||||
, mPortCount(0)
|
||||
|
@ -3473,7 +3469,6 @@ MediaStreamGraphImpl::MediaStreamGraphImpl(GraphDriverType aDriverRequested,
|
|||
#ifdef DEBUG
|
||||
, mCanRunMessagesSynchronously(false)
|
||||
#endif
|
||||
, mAudioChannel(aChannel)
|
||||
{
|
||||
if (mRealtime) {
|
||||
if (aDriverRequested == AUDIO_THREAD_DRIVER) {
|
||||
|
@ -3509,12 +3504,10 @@ MediaStreamGraphImpl::Destroy()
|
|||
}
|
||||
|
||||
static
|
||||
uint32_t ChannelAndWindowToHash(dom::AudioChannel aChannel,
|
||||
nsPIDOMWindowInner* aWindow)
|
||||
uint32_t WindowToHash(nsPIDOMWindowInner* aWindow)
|
||||
{
|
||||
uint32_t hashkey = 0;
|
||||
|
||||
hashkey = AddToHash(hashkey, static_cast<uint32_t>(aChannel));
|
||||
hashkey = AddToHash(hashkey, aWindow);
|
||||
|
||||
return hashkey;
|
||||
|
@ -3522,20 +3515,17 @@ uint32_t ChannelAndWindowToHash(dom::AudioChannel aChannel,
|
|||
|
||||
MediaStreamGraph*
|
||||
MediaStreamGraph::GetInstance(MediaStreamGraph::GraphDriverType aGraphDriverRequested,
|
||||
dom::AudioChannel aChannel,
|
||||
nsPIDOMWindowInner* aWindow)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Main thread only");
|
||||
|
||||
uint32_t channel = static_cast<uint32_t>(aChannel);
|
||||
MediaStreamGraphImpl* graph = nullptr;
|
||||
|
||||
// We hash the AudioChannel and the nsPIDOMWindowInner together to form a key
|
||||
// to the gloabl MediaStreamGraph hashtable. Effectively, this means there is
|
||||
// a graph per document and AudioChannel.
|
||||
// We hash the nsPIDOMWindowInner to form a key to the gloabl
|
||||
// MediaStreamGraph hashtable. Effectively, this means there is a graph per
|
||||
// document.
|
||||
|
||||
|
||||
uint32_t hashkey = ChannelAndWindowToHash(aChannel, aWindow);
|
||||
uint32_t hashkey = WindowToHash(aWindow);
|
||||
|
||||
if (!gGraphs.Get(hashkey, &graph)) {
|
||||
if (!gMediaStreamGraphShutdownBlocker) {
|
||||
|
@ -3583,14 +3573,12 @@ MediaStreamGraph::GetInstance(MediaStreamGraph::GraphDriverType aGraphDriverRequ
|
|||
}
|
||||
graph = new MediaStreamGraphImpl(aGraphDriverRequested,
|
||||
CubebUtils::PreferredSampleRate(),
|
||||
aChannel,
|
||||
mainThread);
|
||||
|
||||
gGraphs.Put(hashkey, graph);
|
||||
|
||||
LOG(LogLevel::Debug,
|
||||
("Starting up MediaStreamGraph %p for channel %s and window %p",
|
||||
graph, AudioChannelValues::strings[channel].value, aWindow));
|
||||
("Starting up MediaStreamGraph %p for window %p", graph, aWindow));
|
||||
}
|
||||
|
||||
return graph;
|
||||
|
@ -3606,7 +3594,6 @@ MediaStreamGraph::CreateNonRealtimeInstance(TrackRate aSampleRate,
|
|||
MediaStreamGraphImpl* graph = new MediaStreamGraphImpl(
|
||||
OFFLINE_THREAD_DRIVER,
|
||||
aSampleRate,
|
||||
AudioChannel::Normal,
|
||||
parentObject->AbstractMainThreadFor(TaskCategory::Other));
|
||||
|
||||
LOG(LogLevel::Debug, ("Starting up Offline MediaStreamGraph %p", graph));
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "mozilla/LinkedList.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/TaskQueue.h"
|
||||
#include "mozilla/dom/AudioChannelBinding.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsAutoRef.h"
|
||||
#include "nsIRunnable.h"
|
||||
|
@ -527,9 +526,6 @@ public:
|
|||
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const;
|
||||
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
void SetAudioChannelType(dom::AudioChannel aType) { mAudioChannelType = aType; }
|
||||
dom::AudioChannel AudioChannelType() const { return mAudioChannelType; }
|
||||
|
||||
bool IsSuspended() { return mSuspendedCount > 0; }
|
||||
void IncrementSuspendCount();
|
||||
void DecrementSuspendCount();
|
||||
|
@ -662,8 +658,6 @@ protected:
|
|||
|
||||
// Our media stream graph. null if destroyed on the graph thread.
|
||||
MediaStreamGraphImpl* mGraph;
|
||||
|
||||
dom::AudioChannel mAudioChannelType;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1275,7 +1269,6 @@ public:
|
|||
|
||||
// Main thread only
|
||||
static MediaStreamGraph* GetInstance(GraphDriverType aGraphDriverRequested,
|
||||
dom::AudioChannel aChannel,
|
||||
nsPIDOMWindowInner* aWindow);
|
||||
static MediaStreamGraph* CreateNonRealtimeInstance(
|
||||
TrackRate aSampleRate,
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
* file. It's not in the anonymous namespace because MediaStream needs to
|
||||
* be able to friend it.
|
||||
*
|
||||
* There can be multiple MediaStreamGraph per process: one per AudioChannel.
|
||||
* There can be multiple MediaStreamGraph per process: one per document.
|
||||
* Additionaly, each OfflineAudioContext object creates its own MediaStreamGraph
|
||||
* object too.
|
||||
*/
|
||||
|
@ -119,7 +119,6 @@ public:
|
|||
*/
|
||||
explicit MediaStreamGraphImpl(GraphDriverType aGraphDriverRequested,
|
||||
TrackRate aSampleRate,
|
||||
dom::AudioChannel aChannel,
|
||||
AbstractThread* aWindow);
|
||||
|
||||
/**
|
||||
|
@ -820,8 +819,6 @@ public:
|
|||
RefPtr<AudioOutputObserver> mFarendObserverRef;
|
||||
#endif
|
||||
|
||||
dom::AudioChannel AudioChannel() const { return mAudioChannel; }
|
||||
|
||||
// used to limit graph shutdown time
|
||||
nsCOMPtr<nsITimer> mShutdownTimer;
|
||||
|
||||
|
@ -855,8 +852,6 @@ private:
|
|||
*/
|
||||
bool mCanRunMessagesSynchronously;
|
||||
#endif
|
||||
|
||||
dom::AudioChannel mAudioChannel;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -129,7 +129,6 @@ static float GetSampleRateForAudioContext(bool aIsOffline, float aSampleRate)
|
|||
|
||||
AudioContext::AudioContext(nsPIDOMWindowInner* aWindow,
|
||||
bool aIsOffline,
|
||||
AudioChannel aChannel,
|
||||
uint32_t aNumberOfChannels,
|
||||
uint32_t aLength,
|
||||
float aSampleRate)
|
||||
|
@ -149,7 +148,7 @@ AudioContext::AudioContext(nsPIDOMWindowInner* aWindow,
|
|||
|
||||
// Note: AudioDestinationNode needs an AudioContext that must already be
|
||||
// bound to the window.
|
||||
mDestination = new AudioDestinationNode(this, aIsOffline, aChannel,
|
||||
mDestination = new AudioDestinationNode(this, aIsOffline,
|
||||
aNumberOfChannels, aLength, aSampleRate);
|
||||
|
||||
// The context can't be muted until it has a destination.
|
||||
|
@ -207,8 +206,7 @@ AudioContext::Constructor(const GlobalObject& aGlobal,
|
|||
}
|
||||
|
||||
RefPtr<AudioContext> object =
|
||||
new AudioContext(window, false,
|
||||
AudioChannelService::GetDefaultAudioChannel());
|
||||
new AudioContext(window, false);
|
||||
aRv = object->Init();
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
|
@ -244,7 +242,6 @@ AudioContext::Constructor(const GlobalObject& aGlobal,
|
|||
|
||||
RefPtr<AudioContext> object = new AudioContext(window,
|
||||
true,
|
||||
AudioChannel::Normal,
|
||||
aNumberOfChannels,
|
||||
aLength,
|
||||
aSampleRate);
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef AudioContext_h_
|
||||
#define AudioContext_h_
|
||||
|
||||
#include "mozilla/dom/AudioChannelBinding.h"
|
||||
#include "MediaBufferDecoder.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
|
@ -121,7 +120,6 @@ class AudioContext final : public DOMEventTargetHelper,
|
|||
{
|
||||
AudioContext(nsPIDOMWindowInner* aParentWindow,
|
||||
bool aIsOffline,
|
||||
AudioChannel aChannel,
|
||||
uint32_t aNumberOfChannels = 0,
|
||||
uint32_t aLength = 0,
|
||||
float aSampleRate = 0.0f);
|
||||
|
|
|
@ -323,7 +323,6 @@ NS_IMPL_RELEASE_INHERITED(AudioDestinationNode, AudioNode)
|
|||
|
||||
AudioDestinationNode::AudioDestinationNode(AudioContext* aContext,
|
||||
bool aIsOffline,
|
||||
AudioChannel aChannel,
|
||||
uint32_t aNumberOfChannels,
|
||||
uint32_t aLength, float aSampleRate)
|
||||
: AudioNode(aContext, aIsOffline ? aNumberOfChannels : 2,
|
||||
|
@ -340,7 +339,7 @@ AudioDestinationNode::AudioDestinationNode(AudioContext* aContext,
|
|||
aIsOffline
|
||||
? MediaStreamGraph::CreateNonRealtimeInstance(aSampleRate, window)
|
||||
: MediaStreamGraph::GetInstance(
|
||||
MediaStreamGraph::AUDIO_THREAD_DRIVER, aChannel, window);
|
||||
MediaStreamGraph::AUDIO_THREAD_DRIVER, window);
|
||||
AudioNodeEngine* engine = aIsOffline ?
|
||||
new OfflineDestinationNodeEngine(this, aNumberOfChannels,
|
||||
aLength, aSampleRate) :
|
||||
|
@ -357,11 +356,6 @@ AudioDestinationNode::AudioDestinationNode(AudioContext* aContext,
|
|||
if (!aIsOffline) {
|
||||
graph->NotifyWhenGraphStarted(mStream);
|
||||
}
|
||||
|
||||
if (aChannel != AudioChannel::Normal) {
|
||||
ErrorResult rv;
|
||||
SetMozAudioChannelType(aChannel, rv);
|
||||
}
|
||||
}
|
||||
|
||||
AudioDestinationNode::~AudioDestinationNode()
|
||||
|
@ -615,10 +609,6 @@ AudioDestinationNode::SetMozAudioChannelType(AudioChannel aValue, ErrorResult& a
|
|||
CheckAudioChannelPermissions(aValue)) {
|
||||
mAudioChannel = aValue;
|
||||
|
||||
if (mStream) {
|
||||
mStream->SetAudioChannelType(mAudioChannel);
|
||||
}
|
||||
|
||||
if (mAudioChannelAgent) {
|
||||
CreateAudioChannelAgent();
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ public:
|
|||
// whether it's in offline mode.
|
||||
AudioDestinationNode(AudioContext* aContext,
|
||||
bool aIsOffline,
|
||||
AudioChannel aChannel = AudioChannel::Normal,
|
||||
uint32_t aNumberOfChannels = 0,
|
||||
uint32_t aLength = 0,
|
||||
float aSampleRate = 0.0f);
|
||||
|
|
|
@ -171,7 +171,7 @@ nsSpeechTask::InitDirectAudio()
|
|||
// nullptr as final argument here means that this is not tied to a window.
|
||||
// This is a global MSG.
|
||||
mStream = MediaStreamGraph::GetInstance(MediaStreamGraph::AUDIO_THREAD_DRIVER,
|
||||
AudioChannel::Normal, nullptr)->
|
||||
nullptr)->
|
||||
CreateSourceStream();
|
||||
mIndirectAudio = false;
|
||||
mInited = true;
|
||||
|
|
|
@ -379,8 +379,7 @@ already_AddRefed<DOMMediaStream>
|
|||
PeerConnectionImpl::MakeMediaStream()
|
||||
{
|
||||
MediaStreamGraph* graph =
|
||||
MediaStreamGraph::GetInstance(MediaStreamGraph::AUDIO_THREAD_DRIVER,
|
||||
AudioChannel::Normal, GetWindow());
|
||||
MediaStreamGraph::GetInstance(MediaStreamGraph::AUDIO_THREAD_DRIVER, GetWindow());
|
||||
|
||||
RefPtr<DOMMediaStream> stream =
|
||||
DOMMediaStream::CreateSourceStreamAsInput(GetWindow(), graph);
|
||||
|
|
Загрузка…
Ссылка в новой задаче