Bug 1383585 - add logs for device cache in VideoEngine;r?jib draft
authorNico Grunbaum
Mon, 14 Aug 2017 14:50:50 -0700
changeset 647894 9b741a070844d826f41495179ff2cf43c7ffd163
parent 647854 5caf576b02503fe6c3e47596e929cfc8b8f3c981
child 726657 3041c1aacc3271c7b56f0f6dcb238dc079e603cf
push id74570
push userna-g@nostrum.com
push dateThu, 17 Aug 2017 01:55:34 +0000
reviewersjib
bugs1383585
milestone56.0
Bug 1383585 - add logs for device cache in VideoEngine;r?jib 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;
 }