зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1425150 - Register AudioCallbackDriver to the Gecko Profiler. r=jya
MozReview-Commit-ID: 3rJbF8Kq0zx --HG-- extra : rebase_source : 49719ea92da9c1c556b1c3d10a06d3f2cdc3b08f
This commit is contained in:
Родитель
5993dad148
Коммит
17ca0b45f8
|
@ -539,6 +539,7 @@ AudioCallbackDriver::AudioCallbackDriver(MediaStreamGraphImpl* aGraphImpl)
|
||||||
, mMicrophoneActive(false)
|
, mMicrophoneActive(false)
|
||||||
, mShouldFallbackIfError(false)
|
, mShouldFallbackIfError(false)
|
||||||
, mFromFallback(false)
|
, mFromFallback(false)
|
||||||
|
, mProfilerRegistered(false)
|
||||||
{
|
{
|
||||||
LOG(LogLevel::Debug, ("AudioCallbackDriver ctor for graph %p", aGraphImpl));
|
LOG(LogLevel::Debug, ("AudioCallbackDriver ctor for graph %p", aGraphImpl));
|
||||||
#if defined(XP_WIN)
|
#if defined(XP_WIN)
|
||||||
|
@ -897,6 +898,11 @@ AudioCallbackDriver::DataCallback(const AudioDataValue* aInputBuffer,
|
||||||
AutoInCallback aic(this);
|
AutoInCallback aic(this);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (!mProfilerRegistered) {
|
||||||
|
mProfilerRegistered = true;
|
||||||
|
PROFILER_REGISTER_THREAD("AudioCallback");
|
||||||
|
}
|
||||||
|
|
||||||
GraphTime stateComputedTime = StateComputedTime();
|
GraphTime stateComputedTime = StateComputedTime();
|
||||||
if (stateComputedTime == 0) {
|
if (stateComputedTime == 0) {
|
||||||
MonitorAutoLock mon(mGraphImpl->GetMonitor());
|
MonitorAutoLock mon(mGraphImpl->GetMonitor());
|
||||||
|
@ -1002,6 +1008,8 @@ AudioCallbackDriver::DataCallback(const AudioDataValue* aInputBuffer,
|
||||||
// Enter shutdown mode. The stable-state handler will detect this
|
// Enter shutdown mode. The stable-state handler will detect this
|
||||||
// and complete shutdown if the graph does not get restarted.
|
// and complete shutdown if the graph does not get restarted.
|
||||||
mGraphImpl->SignalMainThreadCleanup();
|
mGraphImpl->SignalMainThreadCleanup();
|
||||||
|
|
||||||
|
PROFILER_UNREGISTER_THREAD();
|
||||||
return aFrames - 1;
|
return aFrames - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1024,6 +1032,7 @@ AudioCallbackDriver::DataCallback(const AudioDataValue* aInputBuffer,
|
||||||
NextDriver()->SetGraphTime(this, mIterationStart, mIterationEnd);
|
NextDriver()->SetGraphTime(this, mIterationStart, mIterationEnd);
|
||||||
mGraphImpl->SetCurrentDriver(NextDriver());
|
mGraphImpl->SetCurrentDriver(NextDriver());
|
||||||
NextDriver()->Start();
|
NextDriver()->Start();
|
||||||
|
PROFILER_UNREGISTER_THREAD();
|
||||||
// Returning less than aFrames starts the draining and eventually stops the
|
// Returning less than aFrames starts the draining and eventually stops the
|
||||||
// audio thread. This function will never get called again.
|
// audio thread. This function will never get called again.
|
||||||
return aFrames - 1;
|
return aFrames - 1;
|
||||||
|
@ -1115,6 +1124,8 @@ AudioCallbackDriver::DeviceChangedCallback() {
|
||||||
#ifdef XP_MACOSX
|
#ifdef XP_MACOSX
|
||||||
PanOutputIfNeeded(mMicrophoneActive);
|
PanOutputIfNeeded(mMicrophoneActive);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
mProfilerRegistered = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -566,6 +566,12 @@ private:
|
||||||
/* True if this driver was created from a driver created because of a previous
|
/* True if this driver was created from a driver created because of a previous
|
||||||
* AudioCallbackDriver failure. */
|
* AudioCallbackDriver failure. */
|
||||||
bool mFromFallback;
|
bool mFromFallback;
|
||||||
|
/* Whether or not the Gecko profiler has been registered for this thread.
|
||||||
|
* We reset this on device change, because the underlying thread is going to
|
||||||
|
* change.
|
||||||
|
* We de-register on the last iteration, and re-register on the first
|
||||||
|
* iteration of a new driver. */
|
||||||
|
Atomic<bool> mProfilerRegistered;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AsyncCubebTask : public Runnable
|
class AsyncCubebTask : public Runnable
|
||||||
|
|
Загрузка…
Ссылка в новой задаче