import changes from `dev' branch of rmottola/Arctic-Fox:

- Bug 1165515 - Part 1: Convert PR_LOG to MOZ_LOG. r=froydnj (034b6056f)
- Bug 1165515 - Part 3: Convert PR_LOG_TEST to MOZ_LOG_TEST. r=froydnj (38739377e)
- Bug 1165515 - Part 5: Convert instances of PR_LOG_ALWAYS. r=froydnj (867725f77)
- Bug 1165515 - Part 7: Convert PR_LOG_DEBUG + 1 to PR_LOG_VERBOSE. rs=froydnj (afe55d0b8)
- Bug 1165515 - Part 8: Convert log level 6 to PR_LOG_VERBOSE. r=jesup (d01127f2c)
- Bug 1165515 - Part 9: Remove instances of using numeric log levels 15. rs=froydnj (2ff8b0056)
- Bug 1165515 - Part 10: Convert mtransport/logging.h to use PR_LOG levels. r=ekr (a0334c607)
- Bug 1165515 - Part 11: Align CSFLogLevel with PR_LOG levels. r=jesup (ca57ae88a)
- Bug 1165515 - Part 12: Convert nsPluginLogging to use PR_LOG levels. r=bsmedberg (1f3226ca8)
- Bug 1165515 - Part 13-2: Replace usage of PRLogModuleLevel and PR_LOG_*. rs=froydnj (96db7f2e9)
- Bug 1165515 - Part 14: Undef PR_LOG macros when using mozilla/Logging.h. r=froydnj (81d9dc8e5)
- fix some bustage after Bug 1165515 - Part 14, stuff missed in part 13 (80c83c78d)
- Bug 1165515 - Part 15: Reduce log level of WebRTC during testing. r=jesup (dda33e173)
This commit is contained in:
2021-03-01 10:32:55 +08:00
parent eb7ab47f85
commit 3ea1cc0dd0
376 changed files with 2627 additions and 2588 deletions
+29 -29
View File
@@ -11,7 +11,7 @@
#endif
extern PRLogModuleInfo* gMediaStreamGraphLog;
#define STREAM_LOG(type, msg) PR_LOG(gMediaStreamGraphLog, type, msg)
#define STREAM_LOG(type, msg) MOZ_LOG(gMediaStreamGraphLog, type, msg)
// We don't use NSPR log here because we want this interleaved with adb logcat
// on Android/B2G
@@ -69,7 +69,7 @@ void GraphDriver::SetGraphTime(GraphDriver* aPreviousDriver,
mStateComputedTime = aLastSwitchStateComputedTime;
mNextStateComputedTime = aLastSwitchNextStateComputedTime;
STREAM_LOG(PR_LOG_DEBUG, ("Setting previous driver: %p (%s)", aPreviousDriver, aPreviousDriver->AsAudioCallbackDriver() ? "AudioCallbackDriver" : "SystemClockDriver"));
STREAM_LOG(LogLevel::Debug, ("Setting previous driver: %p (%s)", aPreviousDriver, aPreviousDriver->AsAudioCallbackDriver() ? "AudioCallbackDriver" : "SystemClockDriver"));
MOZ_ASSERT(!mPreviousDriver);
mPreviousDriver = aPreviousDriver;
}
@@ -182,7 +182,7 @@ public:
NS_IMETHOD Run()
{
char aLocal;
STREAM_LOG(PR_LOG_DEBUG, ("Starting system thread"));
STREAM_LOG(LogLevel::Debug, ("Starting system thread"));
profiler_register_thread("MediaStreamGraph", &aLocal);
LIFECYCLE_LOG("Starting a new system driver for graph %p\n",
mDriver->mGraphImpl);
@@ -236,7 +236,7 @@ ThreadedDriver::Revive()
{
// Note: only called on MainThread, without monitor
// We know were weren't in a running state
STREAM_LOG(PR_LOG_DEBUG, ("AudioCallbackDriver reviving."));
STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver reviving."));
// If we were switching, switch now. Otherwise, tell thread to run the main
// loop again.
MonitorAutoLock mon(mGraphImpl->GetMonitor());
@@ -256,7 +256,7 @@ ThreadedDriver::Stop()
{
NS_ASSERTION(NS_IsMainThread(), "Must be called on main thread");
// mGraph's thread is not running so it's OK to do whatever here
STREAM_LOG(PR_LOG_DEBUG, ("Stopping threads for MediaStreamGraph %p", this));
STREAM_LOG(LogLevel::Debug, ("Stopping threads for MediaStreamGraph %p", this));
if (mThread) {
mThread->Shutdown();
@@ -287,7 +287,7 @@ ThreadedDriver::RunThread()
mNextStateComputedTime =
mGraphImpl->RoundUpToNextAudioBlock(
nextCurrentTime + mGraphImpl->MillisecondsToMediaTime(AUDIO_TARGET_MS));
STREAM_LOG(PR_LOG_DEBUG,
STREAM_LOG(LogLevel::Debug,
("interval[%ld; %ld] state[%ld; %ld]",
(long)mIterationStart, (long)mIterationEnd,
(long)mStateComputedTime, (long)mNextStateComputedTime));
@@ -300,7 +300,7 @@ ThreadedDriver::RunThread()
mNextStateComputedTime);
if (mNextDriver && stillProcessing) {
STREAM_LOG(PR_LOG_DEBUG, ("Switching to AudioCallbackDriver"));
STREAM_LOG(LogLevel::Debug, ("Switching to AudioCallbackDriver"));
mNextDriver->SetGraphTime(this, mIterationStart, mIterationEnd,
mStateComputedTime, mNextStateComputedTime);
mGraphImpl->SetCurrentDriver(mNextDriver);
@@ -319,20 +319,20 @@ SystemClockDriver::GetIntervalForIteration(GraphTime& aFrom, GraphTime& aTo)
mCurrentTimeStamp = now;
PR_LOG(gMediaStreamGraphLog, PR_LOG_DEBUG+1, ("Updating current time to %f (real %f, mStateComputedTime %f)",
MOZ_LOG(gMediaStreamGraphLog, LogLevel::Verbose, ("Updating current time to %f (real %f, mStateComputedTime %f)",
mGraphImpl->MediaTimeToSeconds(aTo),
(now - mInitialTimeStamp).ToSeconds(),
mGraphImpl->MediaTimeToSeconds(StateComputedTime())));
if (mStateComputedTime < aTo) {
STREAM_LOG(PR_LOG_WARNING, ("Media graph global underrun detected"));
STREAM_LOG(LogLevel::Warning, ("Media graph global underrun detected"));
aTo = mIterationEnd = mStateComputedTime;
}
if (aFrom >= aTo) {
NS_ASSERTION(aFrom == aTo , "Time can't go backwards!");
// This could happen due to low clock resolution, maybe?
STREAM_LOG(PR_LOG_DEBUG, ("Time did not advance"));
STREAM_LOG(LogLevel::Debug, ("Time did not advance"));
}
}
@@ -363,7 +363,7 @@ SystemClockDriver::WaitForNextIteration()
// least once a minute, if we need to wake up at all
timeoutMS = std::max<int64_t>(0, std::min<int64_t>(timeoutMS, 60*1000));
timeout = PR_MillisecondsToInterval(uint32_t(timeoutMS));
STREAM_LOG(PR_LOG_DEBUG+1, ("Waiting for next iteration; at %f, timeout=%f", (now - mInitialTimeStamp).ToSeconds(), timeoutMS/1000.0));
STREAM_LOG(LogLevel::Verbose, ("Waiting for next iteration; at %f, timeout=%f", (now - mInitialTimeStamp).ToSeconds(), timeoutMS/1000.0));
if (mWaitState == WAITSTATE_WAITING_INDEFINITELY) {
mGraphImpl->mGraphDriverAsleep = false; // atomic
}
@@ -374,7 +374,7 @@ SystemClockDriver::WaitForNextIteration()
}
if (timeout > 0) {
mGraphImpl->GetMonitor().Wait(timeout);
STREAM_LOG(PR_LOG_DEBUG+1, ("Resuming after timeout; at %f, elapsed=%f",
STREAM_LOG(LogLevel::Verbose, ("Resuming after timeout; at %f, elapsed=%f",
(TimeStamp::Now() - mInitialTimeStamp).ToSeconds(),
(TimeStamp::Now() - now).ToSeconds()));
}
@@ -439,14 +439,14 @@ OfflineClockDriver::GetIntervalForIteration(GraphTime& aFrom, GraphTime& aTo)
aTo = mIterationEnd = IterationEnd() + mGraphImpl->MillisecondsToMediaTime(mSlice);
if (mStateComputedTime < aTo) {
STREAM_LOG(PR_LOG_WARNING, ("Media graph global underrun detected"));
STREAM_LOG(LogLevel::Warning, ("Media graph global underrun detected"));
aTo = mIterationEnd = mStateComputedTime;
}
if (aFrom >= aTo) {
NS_ASSERTION(aFrom == aTo , "Time can't go backwards!");
// This could happen due to low clock resolution, maybe?
STREAM_LOG(PR_LOG_DEBUG, ("Time did not advance"));
STREAM_LOG(LogLevel::Debug, ("Time did not advance"));
}
}
@@ -545,7 +545,7 @@ AudioCallbackDriver::AudioCallbackDriver(MediaStreamGraphImpl* aGraphImpl, dom::
, mCallbackReceivedWhileSwitching(0)
#endif
{
STREAM_LOG(PR_LOG_DEBUG, ("AudioCallbackDriver ctor for graph %p", aGraphImpl));
STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver ctor for graph %p", aGraphImpl));
}
AudioCallbackDriver::~AudioCallbackDriver()
@@ -613,21 +613,21 @@ AudioCallbackDriver::Init()
StartStream();
STREAM_LOG(PR_LOG_DEBUG, ("AudioCallbackDriver started."));
STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver started."));
}
void
AudioCallbackDriver::Destroy()
{
STREAM_LOG(PR_LOG_DEBUG, ("AudioCallbackDriver destroyed."));
STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver destroyed."));
mAudioStream.reset();
}
void
AudioCallbackDriver::Resume()
{
STREAM_LOG(PR_LOG_DEBUG, ("Resuming audio threads for MediaStreamGraph %p", mGraphImpl));
STREAM_LOG(LogLevel::Debug, ("Resuming audio threads for MediaStreamGraph %p", mGraphImpl));
if (cubeb_stream_start(mAudioStream) != CUBEB_OK) {
NS_WARNING("Could not start cubeb stream for MSG.");
}
@@ -639,12 +639,12 @@ AudioCallbackDriver::Start()
// If this is running on the main thread, we can't open the stream directly,
// because it is a blocking operation.
if (NS_IsMainThread()) {
STREAM_LOG(PR_LOG_DEBUG, ("Starting audio threads for MediaStreamGraph %p from a new thread.", mGraphImpl));
STREAM_LOG(LogLevel::Debug, ("Starting audio threads for MediaStreamGraph %p from a new thread.", mGraphImpl));
nsRefPtr<AsyncCubebTask> initEvent =
new AsyncCubebTask(this, AsyncCubebOperation::INIT);
initEvent->Dispatch();
} else {
STREAM_LOG(PR_LOG_DEBUG, ("Starting audio threads for MediaStreamGraph %p from the previous driver's thread", mGraphImpl));
STREAM_LOG(LogLevel::Debug, ("Starting audio threads for MediaStreamGraph %p from the previous driver's thread", mGraphImpl));
Init();
// Check if we need to resolve promises because the driver just got switched
@@ -689,7 +689,7 @@ AudioCallbackDriver::Revive()
{
// Note: only called on MainThread, without monitor
// We know were weren't in a running state
STREAM_LOG(PR_LOG_DEBUG, ("AudioCallbackDriver reviving."));
STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver reviving."));
// If we were switching, switch now. Otherwise, start the audio thread again.
MonitorAutoLock mon(mGraphImpl->GetMonitor());
if (mNextDriver) {
@@ -698,7 +698,7 @@ AudioCallbackDriver::Revive()
mGraphImpl->SetCurrentDriver(mNextDriver);
mNextDriver->Start();
} else {
STREAM_LOG(PR_LOG_DEBUG, ("Starting audio threads for MediaStreamGraph %p from a new thread.", mGraphImpl));
STREAM_LOG(LogLevel::Debug, ("Starting audio threads for MediaStreamGraph %p from a new thread.", mGraphImpl));
nsRefPtr<AsyncCubebTask> initEvent =
new AsyncCubebTask(this, AsyncCubebOperation::INIT);
initEvent->Dispatch();
@@ -782,9 +782,9 @@ AudioCallbackDriver::OSXDeviceSwitchingWorkaround()
// callback is called "some" number of times, and then stops being called,
// and then gets called again. 10 is to be safe, it's a low-enough number
// of milliseconds anyways (< 100ms)
//STREAM_LOG(PR_LOG_DEBUG, ("Callbacks during switch: %d", mCallbackReceivedWhileSwitching+1));
//STREAM_LOG(LogLevel::Debug, ("Callbacks during switch: %d", mCallbackReceivedWhileSwitching+1));
if (mCallbackReceivedWhileSwitching++ >= 10) {
STREAM_LOG(PR_LOG_DEBUG, ("Got %d callbacks, switching back to CallbackDriver", mCallbackReceivedWhileSwitching));
STREAM_LOG(LogLevel::Debug, ("Got %d callbacks, switching back to CallbackDriver", mCallbackReceivedWhileSwitching));
// If we have a self reference, we have fallen back temporarily on a
// system clock driver, but we just got called back, that means the osx
// audio backend has switched to the new device.
@@ -883,7 +883,7 @@ AudioCallbackDriver::DataCallback(AudioDataValue* aBuffer, long aFrames)
// reclock the current time against the state time, here.
mIterationEnd = mIterationStart + 0.8 * inGraph;
STREAM_LOG(PR_LOG_DEBUG, ("interval[%ld; %ld] state[%ld; %ld] (frames: %ld) (durationMS: %u) (duration ticks: %ld)\n",
STREAM_LOG(LogLevel::Debug, ("interval[%ld; %ld] state[%ld; %ld] (frames: %ld) (durationMS: %u) (duration ticks: %ld)\n",
(long)mIterationStart, (long)mIterationEnd,
(long)mStateComputedTime, (long)mNextStateComputedTime,
(long)aFrames, (uint32_t)durationMS,
@@ -892,7 +892,7 @@ AudioCallbackDriver::DataCallback(AudioDataValue* aBuffer, long aFrames)
mCurrentTimeStamp = TimeStamp::Now();
if (mStateComputedTime < mIterationEnd) {
STREAM_LOG(PR_LOG_WARNING, ("Media graph global underrun detected"));
STREAM_LOG(LogLevel::Warning, ("Media graph global underrun detected"));
mIterationEnd = mStateComputedTime;
}
@@ -916,7 +916,7 @@ AudioCallbackDriver::DataCallback(AudioDataValue* aBuffer, long aFrames)
return aFrames;
}
}
STREAM_LOG(PR_LOG_DEBUG, ("Switching to system driver."));
STREAM_LOG(LogLevel::Debug, ("Switching to system driver."));
mNextDriver->SetGraphTime(this, mIterationStart, mIterationEnd,
mStateComputedTime, mNextStateComputedTime);
mGraphImpl->SetCurrentDriver(mNextDriver);
@@ -936,7 +936,7 @@ AudioCallbackDriver::DataCallback(AudioDataValue* aBuffer, long aFrames)
void
AudioCallbackDriver::StateCallback(cubeb_state aState)
{
STREAM_LOG(PR_LOG_DEBUG, ("AudioCallbackDriver State: %d", aState));
STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver State: %d", aState));
}
void
@@ -1020,7 +1020,7 @@ AudioCallbackDriver::DeviceChangedCallback() {
if (mSelfReference) {
return;
}
STREAM_LOG(PR_LOG_ERROR, ("Switching to SystemClockDriver during output switch"));
STREAM_LOG(LogLevel::Error, ("Switching to SystemClockDriver during output switch"));
mSelfReference.Take(this);
mCallbackReceivedWhileSwitching = 0;
mGraphImpl->mFlushSourcesOnNextIteration = true;