Bug 1221587: patch 10 - Improve logging of callback driver/switching r=padenot draft
authorAndreas Pehrson <pehrsons@gmail.com>
Wed, 06 Jan 2016 16:20:20 +0800
changeset 321200 5d9121844bc95d82784ad36110ffdcf62b9938ca
parent 321199 d744ba5e39829d3b192193a34c3c20c6148325b7
child 321201 edb51bb165e7ad752c905e880f55835440b8174f
push id9349
push userrjesup@wgate.com
push dateWed, 13 Jan 2016 06:48:48 +0000
reviewerspadenot
bugs1221587
milestone46.0a1
Bug 1221587: patch 10 - Improve logging of callback driver/switching r=padenot
dom/media/GraphDriver.cpp
--- a/dom/media/GraphDriver.cpp
+++ b/dom/media/GraphDriver.cpp
@@ -90,16 +90,22 @@ void GraphDriver::SwitchAtNextIteration(
       PreviousDriver() &&
       PreviousDriver()->AsAudioCallbackDriver()->IsSwitchingDevice() &&
       PreviousDriver() != aNextDriver) {
     return;
   }
   LIFECYCLE_LOG("Switching to new driver: %p (%s)",
       aNextDriver, aNextDriver->AsAudioCallbackDriver() ?
       "AudioCallbackDriver" : "SystemClockDriver");
+  if (mNextDriver &&
+      mNextDriver != GraphImpl()->CurrentDriver()) {
+    LIFECYCLE_LOG("Discarding previous next driver: %p (%s)",
+                  mNextDriver.get(), mNextDriver->AsAudioCallbackDriver() ?
+                  "AudioCallbackDriver" : "SystemClockDriver");
+  }
   SetNextDriver(aNextDriver);
 }
 
 GraphTime
 GraphDriver::StateComputedTime() const
 {
   return mGraphImpl->mStateComputedTime;
 }
@@ -476,23 +482,23 @@ AsyncCubebTask::Run()
     // assumes the caller does.
     return NS_OK;
   }
 
   MOZ_ASSERT(mDriver);
 
   switch(mOperation) {
     case AsyncCubebOperation::INIT: {
-      LIFECYCLE_LOG("AsyncCubebOperation::INIT\n");
+      LIFECYCLE_LOG("AsyncCubebOperation::INIT driver=%p\n", mDriver.get());
       mDriver->Init();
       mDriver->CompleteAudioContextOperations(mOperation);
       break;
     }
     case AsyncCubebOperation::SHUTDOWN: {
-      LIFECYCLE_LOG("AsyncCubebOperation::SHUTDOWN\n");
+      LIFECYCLE_LOG("AsyncCubebOperation::SHUTDOWN driver=%p\n", mDriver.get());
       mDriver->Stop();
 
       mDriver->CompleteAudioContextOperations(mOperation);
 
       mDriver = nullptr;
       mShutdownGrip = nullptr;
       break;
     }
@@ -861,21 +867,21 @@ AudioCallbackDriver::DataCallback(AudioD
     // We want the interval [mIterationStart; mIterationEnd] to be before the
     // interval [stateComputedTime; nextStateComputedTime]. We also want
     // the distance between these intervals to be roughly equivalent each time, to
     // ensure there is no clock drift between current time and state time. Since
     // we can't act on the state time because we have to fill the audio buffer, we
     // reclock the current time against the state time, here.
     mIterationEnd = mIterationStart + 0.8 * inGraph;
 
-    STREAM_LOG(LogLevel::Debug, ("interval[%ld; %ld] state[%ld; %ld] (frames: %ld) (durationMS: %u) (duration ticks: %ld)\n",
-                              (long)mIterationStart, (long)mIterationEnd,
-                              (long)stateComputedTime, (long)nextStateComputedTime,
-                              (long)aFrames, (uint32_t)durationMS,
-                              (long)(nextStateComputedTime - stateComputedTime)));
+    STREAM_LOG(LogLevel::Verbose, ("interval[%ld; %ld] state[%ld; %ld] (frames: %ld) (durationMS: %u) (duration ticks: %ld)\n",
+                                   (long)mIterationStart, (long)mIterationEnd,
+                                   (long)stateComputedTime, (long)nextStateComputedTime,
+                                   (long)aFrames, (uint32_t)durationMS,
+                                   (long)(nextStateComputedTime - stateComputedTime)));
 
     mCurrentTimeStamp = TimeStamp::Now();
 
     if (stateComputedTime < mIterationEnd) {
       STREAM_LOG(LogLevel::Warning, ("Media graph global underrun detected"));
       mIterationEnd = stateComputedTime;
     }