Bug 1383585 - Add logs for device cache in VideoEngine. r=jib, a=gchang
authorNico Grunbaum
Mon, 14 Aug 2017 14:50:50 -0700
changeset 423716 4a2765dc61713612d7b49eea3e94795ee3edfbae
parent 423715 ce2de2c006b2e16588e11e337defdaad445b1214
child 423717 d50b54209adbe823316f65332269bc840087e24e
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib, gchang
bugs1383585
milestone56.0
Bug 1383585 - Add logs for device cache in VideoEngine. r=jib, a=gchang MozReview-Commit-ID: 9hRSSwSUuuC
dom/media/systemservices/VideoEngine.cpp
--- a/dom/media/systemservices/VideoEngine.cpp
+++ b/dom/media/systemservices/VideoEngine.cpp
@@ -76,57 +76,66 @@ std::shared_ptr<webrtc::VideoCaptureModu
 VideoEngine::GetOrCreateVideoCaptureDeviceInfo() {
   LOG((__PRETTY_FUNCTION__));
   int64_t currentTime = 0;
 
   const char * capDevTypeName =
     webrtc::CaptureDeviceInfo(mCaptureDevInfo.type).TypeName();
 
   if (mDeviceInfo) {
+    LOG(("Device cache available."));
     // Camera cache is invalidated by HW change detection elsewhere
     if (mCaptureDevInfo.type == webrtc::CaptureDeviceType::Camera) {
       LOG(("returning cached CaptureDeviceInfo of type %s", capDevTypeName));
       return mDeviceInfo;
     }
     // Screen sharing cache is invalidated after the expiration time
     currentTime = webrtc::Clock::GetRealTimeClock()->TimeInMilliseconds();
+    LOG(("Checking expiry, fetched current time of: %" PRId64, currentTime));
+    LOG(("device cache expiration is %" PRId64, mExpiryTimeInMs));
     if (currentTime <= mExpiryTimeInMs) {
       LOG(("returning cached CaptureDeviceInfo of type %s", capDevTypeName));
       return mDeviceInfo;
     }
   }
 
   if (currentTime == 0) {
    currentTime = webrtc::Clock::GetRealTimeClock()->TimeInMilliseconds();
+   LOG(("Fetched current time of: %" PRId64, currentTime));
   }
   mExpiryTimeInMs = currentTime + kCacheExpiryPeriodMs;
+  LOG(("new device cache expiration is %" PRId64, mExpiryTimeInMs));
   LOG(("creating a new VideoCaptureDeviceInfo of type %s", capDevTypeName));
 
   switch (mCaptureDevInfo.type) {
     case webrtc::CaptureDeviceType::Camera: {
       mDeviceInfo.reset(webrtc::VideoCaptureFactory::CreateDeviceInfo());
+      LOG(("webrtc::CaptureDeviceType::Camera: Finished creating new device."));
       break;
     }
     case webrtc::CaptureDeviceType::Browser: {
       mDeviceInfo.reset(webrtc::BrowserDeviceInfoImpl::CreateDeviceInfo());
+      LOG(("webrtc::CaptureDeviceType::Browser: Finished creating new device."));
       break;
     }
     // Window, Application, and Screen types are handled by DesktopCapture
     case webrtc::CaptureDeviceType::Window:
     case webrtc::CaptureDeviceType::Application:
     case webrtc::CaptureDeviceType::Screen: {
 #if !defined(WEBRTC_ANDROID) && !defined(WEBRTC_IOS)
       mDeviceInfo.reset(webrtc::DesktopCaptureImpl::CreateDeviceInfo(mId,mCaptureDevInfo.type));
+      LOG(("screen capture: Finished creating new device."));
 #else
       MOZ_ASSERT("GetVideoCaptureDeviceInfo NO DESKTOP CAPTURE IMPL ON ANDROID" == nullptr);
       mDeviceInfo.reset();
 #endif
       break;
     }
   }
+  LOG(("EXIT %s", __PRETTY_FUNCTION__));
   return mDeviceInfo;
 }
 
 const UniquePtr<const webrtc::Config>&
 VideoEngine::GetConfiguration() {
   return mConfig;
 }