Count key protocol for all media sections

This will give accurate stats for the number of calls
that use video that are using SDES.

Bug: chromium:804275
Change-Id: I35b045a2301fb5267b656b424b9b3482b1b72f9a
Reviewed-on: https://webrtc-review.googlesource.com/60481
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22324}
diff --git a/pc/peerconnection.cc b/pc/peerconnection.cc
index b8bc67d..3df7ebf 100644
--- a/pc/peerconnection.cc
+++ b/pc/peerconnection.cc
@@ -430,6 +430,11 @@
     if (content_info.rejected) {
       continue;
     }
+    // Note what media is used with each crypto protocol, for all sections.
+    NoteKeyProtocolAndMedia(dtls_enabled ? webrtc::kEnumCounterKeyProtocolDtls
+                                         : webrtc::kEnumCounterKeyProtocolSdes,
+                            content_info.media_description()->type(),
+                            uma_observer);
     const std::string& mid = content_info.name;
     if (bundle && bundle->HasContentName(mid) &&
         mid != *(bundle->FirstContentName())) {
@@ -455,16 +460,12 @@
         return RTCError(RTCErrorType::INVALID_PARAMETER,
                         kSdpWithoutDtlsFingerprint);
       }
-      NoteKeyProtocolAndMedia(webrtc::kEnumCounterKeyProtocolDtls,
-                              media->type(), uma_observer);
     } else {
       if (media->cryptos().empty()) {
         RTC_LOG(LS_WARNING)
             << "Session description must have SDES when DTLS disabled.";
         return RTCError(RTCErrorType::INVALID_PARAMETER, kSdpWithoutSdesCrypto);
       }
-      NoteKeyProtocolAndMedia(webrtc::kEnumCounterKeyProtocolSdes,
-                              media->type(), uma_observer);
     }
   }
   return RTCError::OK();