Enable cpplint in pc/

Enable cpplint check in the PRESUBMIT for pc/ and fix all existing
warnings.

Bug: webrtc:5583
Change-Id: If39994692ab6f6f3c83c74f23850f02fdfe810e8
Reviewed-on: https://webrtc-review.googlesource.com/16540
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20482}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index a6d41c6..80e461a 100755
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -30,7 +30,6 @@
   'modules/utility',
   'modules/video_capture',
   'p2p',
-  'pc',
   'rtc_base',
   'sdk/android/src/jni',
   'sdk/objc',
diff --git a/pc/channel_unittest.cc b/pc/channel_unittest.cc
index c040854..07333b4 100644
--- a/pc/channel_unittest.cc
+++ b/pc/channel_unittest.cc
@@ -525,7 +525,7 @@
   class ScopedCallThread {
    public:
     template <class FunctorT>
-    ScopedCallThread(const FunctorT& functor)
+    explicit ScopedCallThread(const FunctorT& functor)
         : thread_(rtc::Thread::Create()),
           task_(new rtc::FunctorMessageHandler<void, FunctorT>(functor)) {
       thread_->Start();
diff --git a/pc/channelmanager.cc b/pc/channelmanager.cc
index 23abdef..e597032 100644
--- a/pc/channelmanager.cc
+++ b/pc/channelmanager.cc
@@ -11,6 +11,7 @@
 #include "pc/channelmanager.h"
 
 #include <algorithm>
+#include <utility>
 
 #include "media/base/device.h"
 #include "media/base/rtpdataengine.h"
diff --git a/pc/currentspeakermonitor_unittest.cc b/pc/currentspeakermonitor_unittest.cc
index 88b1821..fa3f0cb 100644
--- a/pc/currentspeakermonitor_unittest.cc
+++ b/pc/currentspeakermonitor_unittest.cc
@@ -8,6 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#include <utility>
+
 #include "pc/currentspeakermonitor.h"
 #include "pc/audiomonitor.h"
 #include "rtc_base/gunit.h"
diff --git a/pc/datachannel.cc b/pc/datachannel.cc
index c342908..9bc16df 100644
--- a/pc/datachannel.cc
+++ b/pc/datachannel.cc
@@ -180,7 +180,7 @@
     case webrtc::InternalDataChannelInit::kAcker:
       handshake_state_ = kHandshakeShouldSendAck;
       break;
-    };
+    }
 
     // Try to connect to the transport in case the transport channel already
     // exists.
diff --git a/pc/datachannel_unittest.cc b/pc/datachannel_unittest.cc
index 7acfa8e0..f8e9880 100644
--- a/pc/datachannel_unittest.cc
+++ b/pc/datachannel_unittest.cc
@@ -9,6 +9,7 @@
  */
 
 #include <memory>
+#include <vector>
 
 #include "pc/datachannel.h"
 #include "pc/sctputils.h"
diff --git a/pc/externalhmac.cc b/pc/externalhmac.cc
index 6c6d000..91f7412 100644
--- a/pc/externalhmac.cc
+++ b/pc/externalhmac.cc
@@ -80,7 +80,7 @@
     return srtp_err_status_alloc_fail;
 
   // Set pointers
-  *a = (srtp_auth_t *)pointer;
+  *a = reinterpret_cast<srtp_auth_t*>(pointer);
   // |external_hmac| is const and libsrtp expects |type| to be non-const.
   // const conversion is required. |external_hmac| is constant because we don't
   // want to increase global count in Chrome.
@@ -95,7 +95,8 @@
 
 srtp_err_status_t external_hmac_dealloc(srtp_auth_t* a) {
   // Zeroize entire state
-  memset((uint8_t *)a, 0, sizeof(ExternalHmacContext) + sizeof(srtp_auth_t));
+  memset(reinterpret_cast<uint8_t*>(a), 0,
+         sizeof(ExternalHmacContext) + sizeof(srtp_auth_t));
 
   // Free memory
   delete[] a;
diff --git a/pc/mediasession.cc b/pc/mediasession.cc
index 835f76d..3ca1074 100644
--- a/pc/mediasession.cc
+++ b/pc/mediasession.cc
@@ -2430,9 +2430,9 @@
 // Non-const versions of the above functions.
 //
 
-ContentInfo* GetFirstMediaContent(ContentInfos& contents,
+ContentInfo* GetFirstMediaContent(ContentInfos* contents,
                                   MediaType media_type) {
-  for (ContentInfo& content : contents) {
+  for (ContentInfo& content : *contents) {
     if (IsMediaContentOfType(&content, media_type)) {
       return &content;
     }
@@ -2440,15 +2440,15 @@
   return nullptr;
 }
 
-ContentInfo* GetFirstAudioContent(ContentInfos& contents) {
+ContentInfo* GetFirstAudioContent(ContentInfos* contents) {
   return GetFirstMediaContent(contents, MEDIA_TYPE_AUDIO);
 }
 
-ContentInfo* GetFirstVideoContent(ContentInfos& contents) {
+ContentInfo* GetFirstVideoContent(ContentInfos* contents) {
   return GetFirstMediaContent(contents, MEDIA_TYPE_VIDEO);
 }
 
-ContentInfo* GetFirstDataContent(ContentInfos& contents) {
+ContentInfo* GetFirstDataContent(ContentInfos* contents) {
   return GetFirstMediaContent(contents, MEDIA_TYPE_DATA);
 }
 
@@ -2458,7 +2458,7 @@
     return nullptr;
   }
 
-  return GetFirstMediaContent(sdesc->contents(), media_type);
+  return GetFirstMediaContent(&sdesc->contents(), media_type);
 }
 
 ContentInfo* GetFirstAudioContent(SessionDescription* sdesc) {
diff --git a/pc/mediasession.h b/pc/mediasession.h
index 6de9de9..513f645 100644
--- a/pc/mediasession.h
+++ b/pc/mediasession.h
@@ -618,10 +618,10 @@
     const SessionDescription* sdesc);
 // Non-const versions of the above functions.
 // Useful when modifying an existing description.
-ContentInfo* GetFirstMediaContent(ContentInfos& contents, MediaType media_type);
-ContentInfo* GetFirstAudioContent(ContentInfos& contents);
-ContentInfo* GetFirstVideoContent(ContentInfos& contents);
-ContentInfo* GetFirstDataContent(ContentInfos& contents);
+ContentInfo* GetFirstMediaContent(ContentInfos* contents, MediaType media_type);
+ContentInfo* GetFirstAudioContent(ContentInfos* contents);
+ContentInfo* GetFirstVideoContent(ContentInfos* contents);
+ContentInfo* GetFirstDataContent(ContentInfos* contents);
 ContentInfo* GetFirstAudioContent(SessionDescription* sdesc);
 ContentInfo* GetFirstVideoContent(SessionDescription* sdesc);
 ContentInfo* GetFirstDataContent(SessionDescription* sdesc);
diff --git a/pc/mediasession_unittest.cc b/pc/mediasession_unittest.cc
index 867640c..583362d 100644
--- a/pc/mediasession_unittest.cc
+++ b/pc/mediasession_unittest.cc
@@ -256,7 +256,16 @@
   return std::find_if(
       opts->media_description_options.begin(),
       opts->media_description_options.end(),
-      [mid](const MediaDescriptionOptions& t) { return t.mid == mid; });
+      [&mid](const MediaDescriptionOptions& t) { return t.mid == mid; });
+}
+
+std::vector<MediaDescriptionOptions>::const_iterator
+FindFirstMediaDescriptionByMid(const std::string& mid,
+                               const MediaSessionOptions& opts) {
+  return std::find_if(
+      opts.media_description_options.begin(),
+      opts.media_description_options.end(),
+      [&mid](const MediaDescriptionOptions& t) { return t.mid == mid; });
 }
 
 // Add a media section to the |session_options|.
@@ -402,7 +411,7 @@
   }
 
   void TestTransportInfo(bool offer,
-                         MediaSessionOptions& options,
+                         const MediaSessionOptions& options,
                          bool has_current_desc) {
     const std::string current_audio_ufrag = "current_audio_ufrag";
     const std::string current_audio_pwd = "current_audio_pwd";
@@ -448,7 +457,7 @@
                   ti_audio->description.ice_pwd.size());
       }
       auto media_desc_options_it =
-          FindFirstMediaDescriptionByMid("audio", &options);
+          FindFirstMediaDescriptionByMid("audio", options);
       EXPECT_EQ(
           media_desc_options_it->transport_options.enable_ice_renomination,
           GetIceRenomination(ti_audio));
@@ -476,7 +485,7 @@
         }
       }
       auto media_desc_options_it =
-          FindFirstMediaDescriptionByMid("video", &options);
+          FindFirstMediaDescriptionByMid("video", options);
       EXPECT_EQ(
           media_desc_options_it->transport_options.enable_ice_renomination,
           GetIceRenomination(ti_video));
@@ -503,7 +512,7 @@
         }
       }
       auto media_desc_options_it =
-          FindFirstMediaDescriptionByMid("data", &options);
+          FindFirstMediaDescriptionByMid("data", options);
       EXPECT_EQ(
           media_desc_options_it->transport_options.enable_ice_renomination,
           GetIceRenomination(ti_data));
diff --git a/pc/mediastream.cc b/pc/mediastream.cc
index 0d6fcda..eb78a8b 100644
--- a/pc/mediastream.cc
+++ b/pc/mediastream.cc
@@ -25,7 +25,7 @@
     }
   }
   return it;
-};
+}
 
 rtc::scoped_refptr<MediaStream> MediaStream::Create(
     const std::string& label) {
diff --git a/pc/peerconnection.cc b/pc/peerconnection.cc
index 0420b60..03d34d0 100644
--- a/pc/peerconnection.cc
+++ b/pc/peerconnection.cc
@@ -206,8 +206,8 @@
           class SENDERS,
           class RECEIVERS>
 void SetChannelOnSendersAndReceivers(CHANNEL* channel,
-                                     SENDERS& senders,
-                                     RECEIVERS& receivers,
+                                     const SENDERS& senders,
+                                     const RECEIVERS& receivers,
                                      cricket::MediaType media_type) {
   for (auto& sender : senders) {
     if (sender->media_type() == media_type) {
diff --git a/pc/peerconnectionendtoend_unittest.cc b/pc/peerconnectionendtoend_unittest.cc
index bc80e1e..dce69da 100644
--- a/pc/peerconnectionendtoend_unittest.cc
+++ b/pc/peerconnectionendtoend_unittest.cc
@@ -184,7 +184,7 @@
     std::unique_ptr<webrtc::AudioDecoder> real_decoder) {
   class ForwardingMockDecoder : public StrictMock<webrtc::MockAudioDecoder> {
    public:
-    ForwardingMockDecoder(std::unique_ptr<AudioDecoder> decoder)
+    explicit ForwardingMockDecoder(std::unique_ptr<AudioDecoder> decoder)
         : decoder_(std::move(decoder)) {}
 
    private:
diff --git a/pc/peerconnectionfactory.cc b/pc/peerconnectionfactory.cc
index dc84d76..2dcc4e5 100644
--- a/pc/peerconnectionfactory.cc
+++ b/pc/peerconnectionfactory.cc
@@ -106,7 +106,7 @@
     }
   }
 
-  // TODO: Currently there is no way creating an external adm in
+  // TODO(deadbeef): Currently there is no way to create an external adm in
   // libjingle source tree. So we can 't currently assert if this is NULL.
   // RTC_DCHECK(default_adm != NULL);
 }
diff --git a/pc/peerconnectionfactory.h b/pc/peerconnectionfactory.h
index f5faecc..398221f 100644
--- a/pc/peerconnectionfactory.h
+++ b/pc/peerconnectionfactory.h
@@ -49,7 +49,7 @@
       std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
       PeerConnectionObserver* observer) override;
 
-  virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
+  rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
       const PeerConnectionInterface::RTCConfiguration& configuration,
       std::unique_ptr<cricket::PortAllocator> allocator,
       std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
@@ -60,13 +60,13 @@
   rtc::scoped_refptr<MediaStreamInterface>
       CreateLocalMediaStream(const std::string& label) override;
 
-  virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
+  rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
       const cricket::AudioOptions& options) override;
   // Deprecated, use version without constraints.
   rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
       const MediaConstraintsInterface* constraints) override;
 
-  virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource(
+  rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource(
       std::unique_ptr<cricket::VideoCapturer> capturer) override;
   // This version supports filtering on width, height and frame rate.
   // For the "constraints=null" case, use the version without constraints.
diff --git a/pc/peerconnectionfactory_unittest.cc b/pc/peerconnectionfactory_unittest.cc
index 6fba8fa..a1bdbf5 100644
--- a/pc/peerconnectionfactory_unittest.cc
+++ b/pc/peerconnectionfactory_unittest.cc
@@ -11,6 +11,7 @@
 #include <memory>
 #include <string>
 #include <utility>
+#include <vector>
 
 #include "api/audio_codecs/builtin_audio_decoder_factory.h"
 #include "api/audio_codecs/builtin_audio_encoder_factory.h"
diff --git a/pc/peerconnectionwrapper.cc b/pc/peerconnectionwrapper.cc
index 070deb9..ddfa5a6 100644
--- a/pc/peerconnectionwrapper.cc
+++ b/pc/peerconnectionwrapper.cc
@@ -13,6 +13,7 @@
 #include <memory>
 #include <string>
 #include <utility>
+#include <vector>
 
 #include "api/jsepsessiondescription.h"
 #include "media/base/fakevideocapturer.h"
diff --git a/pc/peerconnectionwrapper.h b/pc/peerconnectionwrapper.h
index 88d2f07..2554f1f 100644
--- a/pc/peerconnectionwrapper.h
+++ b/pc/peerconnectionwrapper.h
@@ -14,6 +14,7 @@
 #include <functional>
 #include <memory>
 #include <string>
+#include <vector>
 
 #include "api/peerconnectioninterface.h"
 #include "pc/test/mockpeerconnectionobservers.h"
diff --git a/pc/rtcstats_integrationtest.cc b/pc/rtcstats_integrationtest.cc
index e0fb577..3da1083 100644
--- a/pc/rtcstats_integrationtest.cc
+++ b/pc/rtcstats_integrationtest.cc
@@ -56,15 +56,16 @@
   }
 
  private:
-  static void AddTraceEventHandler(char phase,
-                                   const unsigned char* category_enabled,
-                                   const char* name,
-                                   unsigned long long id,
-                                   int num_args,
-                                   const char** arg_names,
-                                   const unsigned char* arg_types,
-                                   const unsigned long long* arg_values,
-                                   unsigned char flags) {
+  static void AddTraceEventHandler(
+      char phase,
+      const unsigned char* category_enabled,
+      const char* name,
+      unsigned long long id,  // NOLINT(runtime/int)
+      int num_args,
+      const char** arg_names,
+      const unsigned char* arg_types,
+      const unsigned long long* arg_values,  // NOLINT(runtime/int)
+      unsigned char flags) {
     RTC_DCHECK(traced_report_);
     EXPECT_STREQ("webrtc_stats",
                  reinterpret_cast<const char*>(category_enabled));
diff --git a/pc/rtcstatscollector.cc b/pc/rtcstatscollector.cc
index d20f2ed..12a6f5a 100644
--- a/pc/rtcstatscollector.cc
+++ b/pc/rtcstatscollector.cc
@@ -12,6 +12,7 @@
 
 #include <memory>
 #include <sstream>
+#include <string>
 #include <utility>
 #include <vector>
 
diff --git a/pc/rtcstatscollector.h b/pc/rtcstatscollector.h
index a3a9c1e..6effe73 100644
--- a/pc/rtcstatscollector.h
+++ b/pc/rtcstatscollector.h
@@ -14,6 +14,7 @@
 #include <map>
 #include <memory>
 #include <set>
+#include <string>
 #include <vector>
 
 #include "api/optional.h"
diff --git a/pc/rtcstatscollector_unittest.cc b/pc/rtcstatscollector_unittest.cc
index a5c2ee1..71b3797 100644
--- a/pc/rtcstatscollector_unittest.cc
+++ b/pc/rtcstatscollector_unittest.cc
@@ -14,6 +14,7 @@
 #include <memory>
 #include <ostream>
 #include <string>
+#include <utility>
 #include <vector>
 
 #include "api/jsepsessiondescription.h"
@@ -181,9 +182,8 @@
     return audio_track_stats;
   }
 
-  FakeAudioTrackForStats(const std::string& id)
-      : MediaStreamTrack<AudioTrackInterface>(id) {
-  }
+  explicit FakeAudioTrackForStats(const std::string& id)
+      : MediaStreamTrack<AudioTrackInterface>(id) {}
 
   std::string kind() const override {
     return MediaStreamTrackInterface::kAudioKind;
@@ -209,9 +209,8 @@
     return video_track;
   }
 
-  FakeVideoTrackForStats(const std::string& id)
-      : MediaStreamTrack<VideoTrackInterface>(id) {
-  }
+  explicit FakeVideoTrackForStats(const std::string& id)
+      : MediaStreamTrack<VideoTrackInterface>(id) {}
 
   std::string kind() const override {
     return MediaStreamTrackInterface::kVideoKind;
diff --git a/pc/rtpreceiver.cc b/pc/rtpreceiver.cc
index 4f88f1c..4dc9167 100644
--- a/pc/rtpreceiver.cc
+++ b/pc/rtpreceiver.cc
@@ -10,6 +10,8 @@
 
 #include "pc/rtpreceiver.h"
 
+#include <vector>
+
 #include "api/mediastreamtrackproxy.h"
 #include "api/videosourceproxy.h"
 #include "pc/audiotrack.h"
diff --git a/pc/rtpreceiver.h b/pc/rtpreceiver.h
index 6b9ca99..d3f0f26 100644
--- a/pc/rtpreceiver.h
+++ b/pc/rtpreceiver.h
@@ -18,6 +18,7 @@
 #include <stdint.h>
 
 #include <string>
+#include <vector>
 
 #include "api/mediastreaminterface.h"
 #include "api/rtpreceiverinterface.h"
diff --git a/pc/rtpsender.cc b/pc/rtpsender.cc
index 3d5594c..ac3a03c 100644
--- a/pc/rtpsender.cc
+++ b/pc/rtpsender.cc
@@ -10,6 +10,8 @@
 
 #include "pc/rtpsender.h"
 
+#include <vector>
+
 #include "api/mediastreaminterface.h"
 #include "pc/localaudiosource.h"
 #include "rtc_base/checks.h"
diff --git a/pc/rtpsender.h b/pc/rtpsender.h
index 672637f..ce8c657 100644
--- a/pc/rtpsender.h
+++ b/pc/rtpsender.h
@@ -17,6 +17,7 @@
 
 #include <memory>
 #include <string>
+#include <vector>
 
 #include "api/mediastreaminterface.h"
 #include "api/rtpsenderinterface.h"
diff --git a/pc/sdputils.cc b/pc/sdputils.cc
index 8932bea..9bcbc43 100644
--- a/pc/sdputils.cc
+++ b/pc/sdputils.cc
@@ -10,6 +10,7 @@
 
 #include "pc/sdputils.h"
 
+#include <string>
 #include <utility>
 
 #include "api/jsepsessiondescription.h"
diff --git a/pc/sdputils.h b/pc/sdputils.h
index 3a53a41..7444aa7 100644
--- a/pc/sdputils.h
+++ b/pc/sdputils.h
@@ -13,6 +13,7 @@
 
 #include <functional>
 #include <memory>
+#include <string>
 
 #include "api/jsep.h"
 #include "p2p/base/sessiondescription.h"
diff --git a/pc/srtpfilter_unittest.cc b/pc/srtpfilter_unittest.cc
index a71762c..52f3afa 100644
--- a/pc/srtpfilter_unittest.cc
+++ b/pc/srtpfilter_unittest.cc
@@ -21,21 +21,21 @@
 
 namespace rtc {
 
-static const std::string kTestKeyParams1 =
+static const char kTestKeyParams1[] =
     "inline:WVNfX19zZW1jdGwgKCkgewkyMjA7fQp9CnVubGVz";
-static const std::string kTestKeyParams2 =
+static const char kTestKeyParams2[] =
     "inline:PS1uQCVeeCFCanVmcjkpPywjNWhcYD0mXXtxaVBR";
-static const std::string kTestKeyParams3 =
+static const char kTestKeyParams3[] =
     "inline:1234X19zZW1jdGwgKCkgewkyMjA7fQp9CnVubGVz";
-static const std::string kTestKeyParams4 =
+static const char kTestKeyParams4[] =
     "inline:4567QCVeeCFCanVmcjkpPywjNWhcYD0mXXtxaVBR";
-static const std::string kTestKeyParamsGcm1 =
+static const char kTestKeyParamsGcm1[] =
     "inline:e166KFlKzJsGW0d5apX+rrI05vxbrvMJEzFI14aTDCa63IRTlLK4iH66uOI=";
-static const std::string kTestKeyParamsGcm2 =
+static const char kTestKeyParamsGcm2[] =
     "inline:6X0oCd55zfz4VgtOwsuqcFq61275PDYN5uwuu3p7ZUHbfUY2FMpdP4m2PEo=";
-static const std::string kTestKeyParamsGcm3 =
+static const char kTestKeyParamsGcm3[] =
     "inline:YKlABGZWMgX32xuMotrG0v0T7G83veegaVzubQ==";
-static const std::string kTestKeyParamsGcm4 =
+static const char kTestKeyParamsGcm4[] =
     "inline:gJ6tWoUym2v+/F6xjr7xaxiS3QbJJozl3ZD/0A==";
 static const cricket::CryptoParams kTestCryptoParams1(
     1, "AES_CM_128_HMAC_SHA1_80", kTestKeyParams1, "");
diff --git a/pc/srtptransport.cc b/pc/srtptransport.cc
index aa76aa2..0270da2 100644
--- a/pc/srtptransport.cc
+++ b/pc/srtptransport.cc
@@ -11,6 +11,7 @@
 #include "pc/srtptransport.h"
 
 #include <string>
+#include <vector>
 
 #include "media/base/rtputils.h"
 #include "pc/rtptransport.h"
diff --git a/pc/srtptransport.h b/pc/srtptransport.h
index 9f20e1d..03c353c 100644
--- a/pc/srtptransport.h
+++ b/pc/srtptransport.h
@@ -14,6 +14,7 @@
 #include <memory>
 #include <string>
 #include <utility>
+#include <vector>
 
 #include "pc/rtptransportinternal.h"
 #include "pc/srtpfilter.h"
diff --git a/pc/srtptransport_unittest.cc b/pc/srtptransport_unittest.cc
index d3bc259..d551c83 100644
--- a/pc/srtptransport_unittest.cc
+++ b/pc/srtptransport_unittest.cc
@@ -8,6 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#include <vector>
+
 #include "pc/srtptransport.h"
 
 #include "media/base/fakertp.h"
@@ -141,14 +143,14 @@
       TestRtpAuthParams(srtp_transport1_.get(), cipher_suite_name);
     } else {
       ASSERT_TRUE(last_recv_packet2_.data());
-      EXPECT_TRUE(
-          memcmp(last_recv_packet2_.data(), original_rtp_data, rtp_len) == 0);
+      EXPECT_EQ(0,
+                memcmp(last_recv_packet2_.data(), original_rtp_data, rtp_len));
       // Get the encrypted packet from underneath packet transport and verify
       // the data is actually encrypted.
       auto fake_rtp_packet_transport = static_cast<rtc::FakePacketTransport*>(
           srtp_transport1_->rtp_packet_transport());
-      EXPECT_FALSE(memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
-                          original_rtp_data, rtp_len) == 0);
+      EXPECT_NE(0, memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
+                          original_rtp_data, rtp_len));
     }
 
     // Do the same thing in the opposite direction;
@@ -158,12 +160,12 @@
       TestRtpAuthParams(srtp_transport2_.get(), cipher_suite_name);
     } else {
       ASSERT_TRUE(last_recv_packet1_.data());
-      EXPECT_TRUE(
-          memcmp(last_recv_packet1_.data(), original_rtp_data, rtp_len) == 0);
+      EXPECT_EQ(0,
+                memcmp(last_recv_packet1_.data(), original_rtp_data, rtp_len));
       auto fake_rtp_packet_transport = static_cast<rtc::FakePacketTransport*>(
           srtp_transport2_->rtp_packet_transport());
-      EXPECT_FALSE(memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
-                          original_rtp_data, rtp_len) == 0);
+      EXPECT_NE(0, memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
+                          original_rtp_data, rtp_len));
     }
   }
 
@@ -186,25 +188,23 @@
     ASSERT_TRUE(srtp_transport1_->SendRtcpPacket(&rtcp_packet1to2, options,
                                                  cricket::PF_SRTP_BYPASS));
     ASSERT_TRUE(last_recv_packet2_.data());
-    EXPECT_TRUE(memcmp(last_recv_packet2_.data(), rtcp_packet_data, rtcp_len) ==
-                0);
+    EXPECT_EQ(0, memcmp(last_recv_packet2_.data(), rtcp_packet_data, rtcp_len));
     // Get the encrypted packet from underneath packet transport and verify the
     // data is actually encrypted.
     auto fake_rtp_packet_transport = static_cast<rtc::FakePacketTransport*>(
         srtp_transport1_->rtp_packet_transport());
-    EXPECT_FALSE(memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
-                        rtcp_packet_data, rtcp_len) == 0);
+    EXPECT_NE(0, memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
+                        rtcp_packet_data, rtcp_len));
 
     // Do the same thing in the opposite direction;
     ASSERT_TRUE(srtp_transport2_->SendRtcpPacket(&rtcp_packet2to1, options,
                                                  cricket::PF_SRTP_BYPASS));
     ASSERT_TRUE(last_recv_packet1_.data());
-    EXPECT_TRUE(memcmp(last_recv_packet1_.data(), rtcp_packet_data, rtcp_len) ==
-                0);
+    EXPECT_EQ(0, memcmp(last_recv_packet1_.data(), rtcp_packet_data, rtcp_len));
     fake_rtp_packet_transport = static_cast<rtc::FakePacketTransport*>(
         srtp_transport2_->rtp_packet_transport());
-    EXPECT_FALSE(memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
-                        rtcp_packet_data, rtcp_len) == 0);
+    EXPECT_NE(0, memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
+                        rtcp_packet_data, rtcp_len));
   }
 
   void TestSendRecvPacket(bool enable_external_auth,
@@ -267,14 +267,13 @@
     ASSERT_TRUE(srtp_transport1_->SendRtpPacket(&rtp_packet1to2, options,
                                                 cricket::PF_SRTP_BYPASS));
     ASSERT_TRUE(last_recv_packet2_.data());
-    EXPECT_TRUE(memcmp(last_recv_packet2_.data(), original_rtp_data, rtp_len) ==
-                0);
+    EXPECT_EQ(0, memcmp(last_recv_packet2_.data(), original_rtp_data, rtp_len));
     // Get the encrypted packet from underneath packet transport and verify the
     // data and header extension are actually encrypted.
     auto fake_rtp_packet_transport = static_cast<rtc::FakePacketTransport*>(
         srtp_transport1_->rtp_packet_transport());
-    EXPECT_FALSE(memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
-                        original_rtp_data, rtp_len) == 0);
+    EXPECT_NE(0, memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
+                        original_rtp_data, rtp_len));
     CompareHeaderExtensions(
         reinterpret_cast<const char*>(
             fake_rtp_packet_transport->last_sent_packet()->data()),
@@ -285,12 +284,11 @@
     ASSERT_TRUE(srtp_transport2_->SendRtpPacket(&rtp_packet2to1, options,
                                                 cricket::PF_SRTP_BYPASS));
     ASSERT_TRUE(last_recv_packet1_.data());
-    EXPECT_TRUE(memcmp(last_recv_packet1_.data(), original_rtp_data, rtp_len) ==
-                0);
+    EXPECT_EQ(0, memcmp(last_recv_packet1_.data(), original_rtp_data, rtp_len));
     fake_rtp_packet_transport = static_cast<rtc::FakePacketTransport*>(
         srtp_transport2_->rtp_packet_transport());
-    EXPECT_FALSE(memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
-                        original_rtp_data, rtp_len) == 0);
+    EXPECT_NE(0, memcmp(fake_rtp_packet_transport->last_sent_packet()->data(),
+                        original_rtp_data, rtp_len));
     CompareHeaderExtensions(
         reinterpret_cast<const char*>(
             fake_rtp_packet_transport->last_sent_packet()->data()),
diff --git a/pc/statscollector.cc b/pc/statscollector.cc
index 919ea46..15fe173 100644
--- a/pc/statscollector.cc
+++ b/pc/statscollector.cc
@@ -74,13 +74,14 @@
 }
 
 template <class TrackVector>
-void CreateTrackReports(const TrackVector& tracks, StatsCollection* reports,
-                        TrackIdMap& track_ids) {
+void CreateTrackReports(const TrackVector& tracks,
+                        StatsCollection* reports,
+                        TrackIdMap* track_ids) {
   for (const auto& track : tracks) {
     const std::string& track_id = track->id();
     StatsReport* report = AddTrackReport(reports, track_id);
     RTC_DCHECK(report != nullptr);
-    track_ids[track_id] = report;
+    (*track_ids)[track_id] = report;
   }
 }
 
@@ -463,10 +464,10 @@
   RTC_DCHECK(pc_->signaling_thread()->IsCurrent());
   RTC_DCHECK(stream != NULL);
 
-  CreateTrackReports<AudioTrackVector>(stream->GetAudioTracks(),
-                                       &reports_, track_ids_);
-  CreateTrackReports<VideoTrackVector>(stream->GetVideoTracks(),
-                                       &reports_, track_ids_);
+  CreateTrackReports<AudioTrackVector>(stream->GetAudioTracks(), &reports_,
+                                       &track_ids_);
+  CreateTrackReports<VideoTrackVector>(stream->GetVideoTracks(), &reports_,
+                                       &track_ids_);
 }
 
 void StatsCollector::AddLocalAudioTrack(AudioTrackInterface* audio_track,
diff --git a/pc/statscollector.h b/pc/statscollector.h
index 5c90066..bdfe64b 100644
--- a/pc/statscollector.h
+++ b/pc/statscollector.h
@@ -16,6 +16,7 @@
 
 #include <map>
 #include <string>
+#include <utility>
 #include <vector>
 
 #include "api/mediastreaminterface.h"
diff --git a/pc/statscollector_unittest.cc b/pc/statscollector_unittest.cc
index 5e34f7f..48e8959 100644
--- a/pc/statscollector_unittest.cc
+++ b/pc/statscollector_unittest.cc
@@ -12,6 +12,7 @@
 
 #include <algorithm>
 #include <memory>
+#include <utility>
 
 #include "pc/statscollector.h"
 
diff --git a/pc/test/fakeaudiocapturemodule.h b/pc/test/fakeaudiocapturemodule.h
index 25edea7..aa10efc 100644
--- a/pc/test/fakeaudiocapturemodule.h
+++ b/pc/test/fakeaudiocapturemodule.h
@@ -164,7 +164,7 @@
   // exposed in which case the burden of proper instantiation would be put on
   // the creator of a FakeAudioCaptureModule instance. To create an instance of
   // this class use the Create(..) API.
-  explicit FakeAudioCaptureModule();
+  FakeAudioCaptureModule();
   // The destructor is protected because it is reference counted and should not
   // be deleted directly.
   virtual ~FakeAudioCaptureModule();
@@ -201,11 +201,11 @@
   // Callback for playout and recording.
   webrtc::AudioTransport* audio_callback_;
 
-  bool recording_; // True when audio is being pushed from the instance.
-  bool playing_; // True when audio is being pulled by the instance.
+  bool recording_;  // True when audio is being pushed from the instance.
+  bool playing_;    // True when audio is being pulled by the instance.
 
-  bool play_is_initialized_; // True when the instance is ready to pull audio.
-  bool rec_is_initialized_; // True when the instance is ready to push audio.
+  bool play_is_initialized_;  // True when the instance is ready to pull audio.
+  bool rec_is_initialized_;   // True when the instance is ready to push audio.
 
   // Input to and output from RecordedDataIsAvailable(..) makes it possible to
   // modify the current mic level. The implementation does not care about the
diff --git a/pc/test/fakedatachannelprovider.h b/pc/test/fakedatachannelprovider.h
index bafcb17..2ac4f94 100644
--- a/pc/test/fakedatachannelprovider.h
+++ b/pc/test/fakedatachannelprovider.h
@@ -11,6 +11,8 @@
 #ifndef PC_TEST_FAKEDATACHANNELPROVIDER_H_
 #define PC_TEST_FAKEDATACHANNELPROVIDER_H_
 
+#include <set>
+
 #include "pc/datachannel.h"
 #include "rtc_base/checks.h"
 
diff --git a/pc/test/fakevideotrackrenderer.h b/pc/test/fakevideotrackrenderer.h
index caec548..617261a 100644
--- a/pc/test/fakevideotrackrenderer.h
+++ b/pc/test/fakevideotrackrenderer.h
@@ -18,7 +18,7 @@
 
 class FakeVideoTrackRenderer : public cricket::FakeVideoRenderer {
  public:
-  FakeVideoTrackRenderer(VideoTrackInterface* video_track)
+  explicit FakeVideoTrackRenderer(VideoTrackInterface* video_track)
       : video_track_(video_track) {
     video_track_->AddOrUpdateSink(this, rtc::VideoSinkWants());
   }
diff --git a/pc/test/mock_datachannel.h b/pc/test/mock_datachannel.h
index 4a77a6b..20a4da6 100644
--- a/pc/test/mock_datachannel.h
+++ b/pc/test/mock_datachannel.h
@@ -11,6 +11,8 @@
 #ifndef PC_TEST_MOCK_DATACHANNEL_H_
 #define PC_TEST_MOCK_DATACHANNEL_H_
 
+#include <string>
+
 #include "pc/datachannel.h"
 #include "test/gmock.h"
 
diff --git a/pc/test/mock_peerconnection.h b/pc/test/mock_peerconnection.h
index 7944a4d..d57ada8 100644
--- a/pc/test/mock_peerconnection.h
+++ b/pc/test/mock_peerconnection.h
@@ -11,6 +11,7 @@
 #ifndef PC_TEST_MOCK_PEERCONNECTION_H_
 #define PC_TEST_MOCK_PEERCONNECTION_H_
 
+#include <memory>
 #include <vector>
 
 #include "call/call.h"
diff --git a/pc/test/mock_webrtcsession.h b/pc/test/mock_webrtcsession.h
index afd1473..e027d0b 100644
--- a/pc/test/mock_webrtcsession.h
+++ b/pc/test/mock_webrtcsession.h
@@ -28,10 +28,11 @@
   // http://crbug.com/428099.
   explicit MockWebRtcSession(cricket::ChannelManager* channel_manager,
                              const cricket::MediaConfig& media_config)
-      : WebRtcSession(nullptr /* Call */,
+      : WebRtcSession(
+            nullptr,  // call
             channel_manager,
             media_config,
-            nullptr, // event_log
+            nullptr,  // event_log
             rtc::Thread::Current(),
             rtc::Thread::Current(),
             rtc::Thread::Current(),
diff --git a/pc/test/mockpeerconnectionobservers.h b/pc/test/mockpeerconnectionobservers.h
index 845dbc7..9128b8c 100644
--- a/pc/test/mockpeerconnectionobservers.h
+++ b/pc/test/mockpeerconnectionobservers.h
@@ -16,6 +16,8 @@
 
 #include <memory>
 #include <string>
+#include <utility>
+#include <vector>
 
 #include "api/datachannelinterface.h"
 #include "api/jsepicecandidate.h"
diff --git a/pc/test/peerconnectiontestwrapper.cc b/pc/test/peerconnectiontestwrapper.cc
index cc91217..6d28ef8 100644
--- a/pc/test/peerconnectiontestwrapper.cc
+++ b/pc/test/peerconnectiontestwrapper.cc
@@ -8,6 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#include <string>
 #include <utility>
 
 #include "p2p/base/fakeportallocator.h"
diff --git a/pc/test/peerconnectiontestwrapper.h b/pc/test/peerconnectiontestwrapper.h
index d9488b4..aadaa8e 100644
--- a/pc/test/peerconnectiontestwrapper.h
+++ b/pc/test/peerconnectiontestwrapper.h
@@ -12,6 +12,7 @@
 #define PC_TEST_PEERCONNECTIONTESTWRAPPER_H_
 
 #include <memory>
+#include <string>
 
 #include "api/peerconnectioninterface.h"
 #include "api/test/fakeconstraints.h"
@@ -52,7 +53,7 @@
   void OnRemoveStream(
       rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) override {}
   void OnDataChannel(
-      rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel) override ;
+      rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel) override;
   void OnRenegotiationNeeded() override {}
   void OnIceConnectionChange(
       webrtc::PeerConnectionInterface::IceConnectionState new_state) override {}
diff --git a/pc/test/testsdpstrings.h b/pc/test/testsdpstrings.h
index 2c9912e..fc884a1 100644
--- a/pc/test/testsdpstrings.h
+++ b/pc/test/testsdpstrings.h
@@ -76,7 +76,7 @@
     "a=candidate:5 2 UDP 1694302206 74.95.2.170 45468 typ srflx raddr"
     " 10.0.254.2 rport 61232\r\n"
 #endif
-    ;
+    ;  // NOLINT(whitespace/semicolon)
 
 // Audio SDP with a limited set of audio codecs.
 static const char kAudioSdp[] =
diff --git a/pc/videocapturertracksource.cc b/pc/videocapturertracksource.cc
index 97c0994..2426cea 100644
--- a/pc/videocapturertracksource.cc
+++ b/pc/videocapturertracksource.cc
@@ -12,6 +12,7 @@
 
 #include <cstdlib>
 #include <string>
+#include <utility>
 #include <vector>
 
 #include "api/mediaconstraintsinterface.h"
diff --git a/pc/videocapturertracksource_unittest.cc b/pc/videocapturertracksource_unittest.cc
index c64c83e..a492643 100644
--- a/pc/videocapturertracksource_unittest.cc
+++ b/pc/videocapturertracksource_unittest.cc
@@ -10,6 +10,7 @@
 
 #include <memory>
 #include <string>
+#include <utility>
 #include <vector>
 
 #include "api/test/fakeconstraints.h"
diff --git a/pc/videotrack.cc b/pc/videotrack.cc
index 718c0d6..bd6d9c2 100644
--- a/pc/videotrack.cc
+++ b/pc/videotrack.cc
@@ -8,11 +8,11 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#include <string>
+
 #include "pc/videotrack.h"
 #include "rtc_base/refcountedobject.h"
 
-#include <string>
-
 namespace webrtc {
 
 VideoTrack::VideoTrack(const std::string& label,
diff --git a/pc/webrtcsdp.cc b/pc/webrtcsdp.cc
index 47e4298..f053bf5 100644
--- a/pc/webrtcsdp.cc
+++ b/pc/webrtcsdp.cc
@@ -15,7 +15,9 @@
 #include <stdio.h>
 
 #include <algorithm>
+#include <map>
 #include <memory>
+#include <set>
 #include <string>
 #include <unordered_map>
 #include <vector>
@@ -174,7 +176,7 @@
 static const char kReturn = '\r';
 static const char kLineBreak[] = "\r\n";
 
-// TODO: Generate the Session and Time description
+// TODO(deadbeef): Generate the Session and Time description
 // instead of hardcoding.
 static const char kSessionVersion[] = "v=0";
 // RFC 4566
@@ -675,7 +677,7 @@
 // likely to work, typically IPv4 relay.
 // RFC 5245
 // The value of |component_id| currently supported are 1 (RTP) and 2 (RTCP).
-// TODO: Decide the default destination in webrtcsession and
+// TODO(deadbeef): Decide the default destination in webrtcsession and
 // pass it down via SessionDescription.
 static void GetDefaultDestination(
     const std::vector<Candidate>& candidates,
@@ -1179,7 +1181,8 @@
   bool encrypted = false;
   if (uri == RtpExtension::kEncryptHeaderExtensionsUri) {
     // RFC 6904
-    // a=extmap:<value["/"<direction>] urn:ietf:params:rtp-hdrext:encrypt <URI> <extensionattributes>
+    // a=extmap:<value["/"<direction>] urn:ietf:params:rtp-hdrext:encrypt <URI>
+    //     <extensionattributes>
     const size_t expected_min_fields_encrypted = expected_min_fields + 1;
     if (fields.size() < expected_min_fields_encrypted) {
       return ParseFailedExpectMinFieldNum(line, expected_min_fields_encrypted,
@@ -1207,7 +1210,7 @@
   if (content_info == NULL || message == NULL) {
     return;
   }
-  // TODO: Rethink if we should use sprintfn instead of stringstream.
+  // TODO(deadbeef): Rethink if we should use sprintfn instead of stringstream.
   // According to the style guide, streams should only be used for logging.
   // http://google-styleguide.googlecode.com/svn/
   // trunk/cppguide.xml?showone=Streams#Streams
@@ -2768,7 +2771,7 @@
     }
 
     if (!IsLineType(line, kLineTypeAttributes)) {
-      // TODO: Handle other lines if needed.
+      // TODO(deadbeef): Handle other lines if needed.
       LOG(LS_INFO) << "Ignored line: " << line;
       continue;
     }
@@ -2892,7 +2895,7 @@
       } else if (HasAttribute(line, kAttributeXGoogleFlag)) {
         // Experimental attribute.  Conference mode activates more aggressive
         // AEC and NS settings.
-        // TODO: expose API to set these directly.
+        // TODO(deadbeef): expose API to set these directly.
         std::string flag_value;
         if (!GetValue(line, kAttributeXGoogleFlag, &flag_value, error)) {
           return false;
diff --git a/pc/webrtcsdp_unittest.cc b/pc/webrtcsdp_unittest.cc
index 75dac25..e532324 100644
--- a/pc/webrtcsdp_unittest.cc
+++ b/pc/webrtcsdp_unittest.cc
@@ -2598,7 +2598,7 @@
   // No crash is a pass.
 }
 
-void MutateJsepSctpPort(JsepSessionDescription& jdesc,
+void MutateJsepSctpPort(JsepSessionDescription* jdesc,
                         const SessionDescription& desc) {
   // take our pre-built session description and change the SCTP port.
   cricket::SessionDescription* mutant = desc.Copy();
@@ -2611,7 +2611,7 @@
   dcdesc->set_codecs(codecs);
 
   // note: mutant's owned by jdesc now.
-  ASSERT_TRUE(jdesc.Initialize(mutant, kSessionId, kSessionVersion));
+  ASSERT_TRUE(jdesc->Initialize(mutant, kSessionId, kSessionVersion));
   mutant = NULL;
 }
 
@@ -2621,7 +2621,7 @@
 
   // First setup the expected JsepSessionDescription.
   JsepSessionDescription jdesc(kDummyString);
-  MutateJsepSctpPort(jdesc, desc_);
+  MutateJsepSctpPort(&jdesc, desc_);
 
   // Then get the deserialized JsepSessionDescription.
   std::string sdp_with_data = kSdpString;
@@ -2641,7 +2641,7 @@
   AddSctpDataChannel(use_sctpmap);
 
   JsepSessionDescription jdesc(kDummyString);
-  MutateJsepSctpPort(jdesc, desc_);
+  MutateJsepSctpPort(&jdesc, desc_);
 
   // We need to test the deserialized JsepSessionDescription from
   // kSdpSctpDataChannelStringWithSctpPort for
diff --git a/pc/webrtcsession.cc b/pc/webrtcsession.cc
index ebdcf4e..477b1ff 100644
--- a/pc/webrtcsession.cc
+++ b/pc/webrtcsession.cc
@@ -1872,7 +1872,7 @@
             RTC_FROM_HERE, rtc::Bind(&WebRtcSession::CreateSctpTransport_n,
                                      this, content->name, transport_name))) {
       return false;
-    };
+    }
   } else {
     bool require_rtcp_mux =
         rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire;
diff --git a/pc/webrtcsession.h b/pc/webrtcsession.h
index 07202ee..09e5a3e 100644
--- a/pc/webrtcsession.h
+++ b/pc/webrtcsession.h
@@ -11,6 +11,7 @@
 #ifndef PC_WEBRTCSESSION_H_
 #define PC_WEBRTCSESSION_H_
 
+#include <map>
 #include <memory>
 #include <set>
 #include <string>
diff --git a/pc/webrtcsessiondescriptionfactory.cc b/pc/webrtcsessiondescriptionfactory.cc
index bbab646..69c629e 100644
--- a/pc/webrtcsessiondescriptionfactory.cc
+++ b/pc/webrtcsessiondescriptionfactory.cc
@@ -10,7 +10,10 @@
 
 #include "pc/webrtcsessiondescriptionfactory.h"
 
+#include <algorithm>
+#include <string>
 #include <utility>
+#include <vector>
 
 #include "api/jsep.h"
 #include "api/jsepsessiondescription.h"
diff --git a/pc/webrtcsessiondescriptionfactory.h b/pc/webrtcsessiondescriptionfactory.h
index 5c3e18e..7ad418f 100644
--- a/pc/webrtcsessiondescriptionfactory.h
+++ b/pc/webrtcsessiondescriptionfactory.h
@@ -12,6 +12,8 @@
 #define PC_WEBRTCSESSIONDESCRIPTIONFACTORY_H_
 
 #include <memory>
+#include <queue>
+#include <string>
 
 #include "api/peerconnectioninterface.h"
 #include "p2p/base/transportdescriptionfactory.h"