bug 1406830 reimplement Shutdown() as virtual separately on each driver r=padenot

moving Stop() to AudioCallbackDriver only.

MozReview-Commit-ID: 9atG8R4wAsY

--HG--
extra : rebase_source : 0addeae733c001f4e5c6cd2d55cbb0b069863864
This commit is contained in:
Karl Tomlinson 2017-09-28 15:05:36 +13:00
Родитель 4f358ada69
Коммит 7299e56b0b
2 изменённых файлов: 16 добавлений и 19 удалений

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

@ -93,19 +93,6 @@ void GraphDriver::EnsureNextIteration()
mGraphImpl->EnsureNextIteration();
}
void GraphDriver::Shutdown()
{
if (AsAudioCallbackDriver()) {
LOG(LogLevel::Debug,
("Releasing audio driver off main thread (GraphDriver::Shutdown)."));
RefPtr<AsyncCubebTask> releaseEvent =
new AsyncCubebTask(AsAudioCallbackDriver(), AsyncCubebOperation::SHUTDOWN);
releaseEvent->Dispatch(NS_DISPATCH_SYNC);
} else {
Stop();
}
}
bool GraphDriver::Switching()
{
GraphImpl()->GetMonitor().AssertCurrentThreadOwns();
@ -262,7 +249,7 @@ ThreadedDriver::RemoveCallback()
}
void
ThreadedDriver::Stop()
ThreadedDriver::Shutdown()
{
NS_ASSERTION(NS_IsMainThread(), "Must be called on main thread");
// mGraph's thread is not running so it's OK to do whatever here
@ -863,6 +850,16 @@ AudioCallbackDriver::WakeUp()
mGraphImpl->GetMonitor().Notify();
}
void
AudioCallbackDriver::Shutdown()
{
LOG(LogLevel::Debug,
("Releasing audio driver off main thread (GraphDriver::Shutdown)."));
RefPtr<AsyncCubebTask> releaseEvent =
new AsyncCubebTask(this, AsyncCubebOperation::SHUTDOWN);
releaseEvent->Dispatch(NS_DISPATCH_SYNC);
}
#if defined(XP_WIN)
void
AudioCallbackDriver::ResetDefaultDevice()

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

@ -122,14 +122,12 @@ public:
virtual void Destroy() {}
/* Start the graph, init the driver, start the thread. */
virtual void Start() = 0;
/* Stop the graph, shutting down the thread. */
virtual void Stop() = 0;
/* Revive this driver, as more messages just arrived. */
virtual void Revive() = 0;
/* Remove Mixer callbacks when switching */
virtual void RemoveCallback() = 0;
/* Shutdown GraphDriver (synchronously) */
void Shutdown();
virtual void Shutdown() = 0;
/* Rate at which the GraphDriver runs, in ms. This can either be user
* controlled (because we are using a {System,Offline}ClockDriver, and decide
* how often we want to wakeup/how much we want to process per iteration), or
@ -272,9 +270,9 @@ public:
explicit ThreadedDriver(MediaStreamGraphImpl* aGraphImpl);
virtual ~ThreadedDriver();
void Start() override;
void Stop() override;
void Revive() override;
void RemoveCallback() override;
void Shutdown() override;
/**
* Runs main control loop on the graph thread. Normally a single invocation
* of this runs for the entire lifetime of the graph thread.
@ -393,11 +391,11 @@ public:
void Destroy() override;
void Start() override;
void Stop() override;
void Revive() override;
void RemoveCallback() override;
void WaitForNextIteration() override;
void WakeUp() override;
void Shutdown() override;
#if defined(XP_WIN)
void ResetDefaultDevice() override;
#endif
@ -488,6 +486,8 @@ private:
bool StartStream();
friend class AsyncCubebTask;
bool Init();
void Stop();
/* MediaStreamGraphs are always down/up mixed to output channels. */
uint32_t mOutputChannels;
/* The size of this buffer comes from the fact that some audio backends can