Bug 1420585 - refine logs. r?jib draft
authorMunro Mengjue Chiang <mchiang@mozilla.com>
Fri, 05 Jan 2018 15:51:48 +0800
changeset 720201 0b5e6d24f9c3af36402395ec54784b7fd08c48f9
parent 720200 1fd60858132e0ff182586b28c35594976906389a
child 746000 af3ea8b3cf2ed75e62848b198354abe7c4b09ab8
push id95474
push userbmo:mchiang@mozilla.com
push dateMon, 15 Jan 2018 02:47:46 +0000
reviewersjib
bugs1420585
milestone59.0a1
Bug 1420585 - refine logs. r?jib MozReview-Commit-ID: KJlFTQALAb4
dom/media/webrtc/MediaEngineCameraVideoSource.cpp
dom/media/webrtc/MediaEngineRemoteVideoSource.cpp
--- a/dom/media/webrtc/MediaEngineCameraVideoSource.cpp
+++ b/dom/media/webrtc/MediaEngineCameraVideoSource.cpp
@@ -356,17 +356,17 @@ MediaEngineCameraVideoSource::ChooseCapa
       found = true;
       break;
     }
   }
   if (!found) {
     GetCapability(candidateSet[0].mIndex, aCapability);
   }
 
-  LogCapability("Chosen capability", mCapability, sameDistance);
+  LogCapability("Chosen capability", aCapability, sameDistance);
   return true;
 }
 
 void
 MediaEngineCameraVideoSource::SetName(nsString aName)
 {
   mDeviceName = aName;
   bool hasFacingMode = false;
--- a/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp
+++ b/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp
@@ -293,20 +293,22 @@ MediaEngineRemoteVideoSource::UpdateSing
     const MediaEnginePrefs& aPrefs,
     const nsString& aDeviceId,
     const char** aOutBadConstraint)
 {
   switch (mState) {
     case kReleased:
       MOZ_ASSERT(aHandle);
       mHandleId = aHandle->mId;
+      LOG(("ChooseCapability(kFitness) for mTargetCapability and mCapability ++"));
       if (!ChooseCapability(aNetConstraints, aPrefs, aDeviceId, mCapability, kFitness)) {
         *aOutBadConstraint = FindBadConstraint(aNetConstraints, *this, aDeviceId);
         return NS_ERROR_FAILURE;
       }
+      LOG(("ChooseCapability(kFitness) for mTargetCapability and mCapability --"));
       mTargetCapability = mCapability;
 
       if (camera::GetChildAndCall(&camera::CamerasChild::AllocateCaptureDevice,
                                   mCapEngine, GetUUID().get(),
                                   kMaxUniqueIdLength, mCaptureIndex,
                                   aHandle->mPrincipalInfo)) {
         return NS_ERROR_FAILURE;
       }
@@ -318,36 +320,40 @@ MediaEngineRemoteVideoSource::UpdateSing
     case kStarted:
       {
         size_t index = mHandleIds.NoIndex;
         if (aHandle) {
           mHandleId = aHandle->mId;
           index = mHandleIds.IndexOf(mHandleId);
         }
 
+        LOG(("ChooseCapability(kFitness) for mTargetCapability ++"));
         if (!ChooseCapability(aNewConstraint, aPrefs, aDeviceId, mTargetCapability,
                               kFitness)) {
           *aOutBadConstraint = FindBadConstraint(aNewConstraint, *this, aDeviceId);
           return NS_ERROR_FAILURE;
         }
+        LOG(("ChooseCapability(kFitness) for mTargetCapability --"));
 
         if (index != mHandleIds.NoIndex) {
           MonitorAutoLock lock(mMonitor);
           mTargetCapabilities[index] = mTargetCapability;
           MOZ_ASSERT(mSources.Length() == mPrincipalHandles.Length());
           MOZ_ASSERT(mSources.Length() == mTargetCapabilities.Length());
           MOZ_ASSERT(mSources.Length() == mHandleIds.Length());
           MOZ_ASSERT(mSources.Length() == mImages.Length());
         }
 
+        LOG(("ChooseCapability(kFeasibility) for mCapability ++"));
         if (!ChooseCapability(aNetConstraints, aPrefs, aDeviceId, mCapability,
                               kFeasibility)) {
           *aOutBadConstraint = FindBadConstraint(aNetConstraints, *this, aDeviceId);
           return NS_ERROR_FAILURE;
         }
+        LOG(("ChooseCapability(kFeasibility) for mCapability --"));
 
         if (mCapability != mLastCapability) {
           camera::GetChildAndCall(&camera::CamerasChild::StopCapture,
                                   mCapEngine, mCaptureIndex);
           if (camera::GetChildAndCall(&camera::CamerasChild::StartCapture,
                                       mCapEngine, mCaptureIndex, mCapability,
                                       this)) {
             LOG(("StartCapture failed"));