Bug 1215699. Ensure that AudioGraphDriver uses the MediaStreamGraph's AudioChannel. r=padenot

This commit is contained in:
Robert O'Callahan 2015-10-23 16:43:15 +13:00
parent 88eb8517c5
commit 2c08de69e9
4 changed files with 13 additions and 16 deletions

View File

@ -501,11 +501,11 @@ StreamAndPromiseForOperation::StreamAndPromiseForOperation(MediaStream* aStream,
// MOZ_ASSERT(aPromise);
}
AudioCallbackDriver::AudioCallbackDriver(MediaStreamGraphImpl* aGraphImpl, dom::AudioChannel aChannel)
AudioCallbackDriver::AudioCallbackDriver(MediaStreamGraphImpl* aGraphImpl)
: GraphDriver(aGraphImpl)
, mIterationDurationMS(MEDIA_GRAPH_TARGET_PERIOD_MS)
, mStarted(false)
, mAudioChannel(aChannel)
, mAudioChannel(aGraphImpl->AudioChannel())
, mInCallback(false)
, mPauseRequested(false)
#ifdef XP_MACOSX

View File

@ -329,8 +329,7 @@ class AudioCallbackDriver : public GraphDriver,
public MixerCallbackReceiver
{
public:
explicit AudioCallbackDriver(MediaStreamGraphImpl* aGraphImpl,
dom::AudioChannel aChannel = dom::AudioChannel::Normal);
explicit AudioCallbackDriver(MediaStreamGraphImpl* aGraphImpl);
virtual ~AudioCallbackDriver();
virtual void Destroy() override;

View File

@ -1409,9 +1409,9 @@ MediaStreamGraphImpl::RunInStableState(bool aSourceIsMSG)
LIFECYCLE_LOG("Disconnecting MediaStreamGraph %p", this);
MediaStreamGraphImpl* graph;
if (gGraphs.Get(mAudioChannel, &graph) && graph == this) {
if (gGraphs.Get(uint32_t(mAudioChannel), &graph) && graph == this) {
// null out gGraph if that's the graph being shut down
gGraphs.Remove(mAudioChannel);
gGraphs.Remove(uint32_t(mAudioChannel));
}
}
} else {
@ -1566,8 +1566,8 @@ MediaStreamGraphImpl::AppendMessage(ControlMessage* aMessage)
mLifecycleState >= LIFECYCLE_WAITING_FOR_STREAM_DESTRUCTION) {
MediaStreamGraphImpl* graph;
if (gGraphs.Get(mAudioChannel, &graph) && graph == this) {
gGraphs.Remove(mAudioChannel);
if (gGraphs.Get(uint32_t(mAudioChannel), &graph) && graph == this) {
gGraphs.Remove(uint32_t(mAudioChannel));
}
Destroy();
@ -1653,7 +1653,7 @@ MediaStream::SetGraphImpl(MediaStreamGraphImpl* aGraph)
{
MOZ_ASSERT(!mGraph, "Should only be called once");
mGraph = aGraph;
mAudioChannelType = static_cast<AudioChannel>(aGraph->AudioChannel());
mAudioChannelType = aGraph->AudioChannel();
mBuffer.InitGraphRate(aGraph->GraphRate());
}
@ -2567,7 +2567,7 @@ MediaStreamGraphImpl::MediaStreamGraphImpl(GraphDriverType aDriverRequested,
#ifdef DEBUG
, mCanRunMessagesSynchronously(false)
#endif
, mAudioChannel(static_cast<uint32_t>(aChannel))
, mAudioChannel(aChannel)
{
if (!gMediaStreamGraphLog) {
gMediaStreamGraphLog = PR_NewLogModule("MediaStreamGraph");
@ -2575,7 +2575,7 @@ MediaStreamGraphImpl::MediaStreamGraphImpl(GraphDriverType aDriverRequested,
if (mRealtime) {
if (aDriverRequested == AUDIO_THREAD_DRIVER) {
AudioCallbackDriver* driver = new AudioCallbackDriver(this, aChannel);
AudioCallbackDriver* driver = new AudioCallbackDriver(this);
mDriver = driver;
mMixer.AddCallback(driver);
} else {
@ -3082,7 +3082,7 @@ MediaStreamGraph::IsNonRealtime() const
const MediaStreamGraphImpl* impl = static_cast<const MediaStreamGraphImpl*>(this);
MediaStreamGraphImpl* graph;
return !gGraphs.Get(impl->AudioChannel(), &graph) || graph != impl;
return !gGraphs.Get(uint32_t(impl->AudioChannel()), &graph) || graph != impl;
}
void

View File

@ -717,7 +717,7 @@ public:
RefPtr<AudioOutputObserver> mFarendObserverRef;
#endif
uint32_t AudioChannel() const { return mAudioChannel; }
dom::AudioChannel AudioChannel() const { return mAudioChannel; }
private:
virtual ~MediaStreamGraphImpl();
@ -762,9 +762,7 @@ private:
bool mCanRunMessagesSynchronously;
#endif
// We use uint32_t instead AudioChannel because this is just used as key for
// the hashtable gGraphs.
uint32_t mAudioChannel;
dom::AudioChannel mAudioChannel;
};
} // namespace mozilla