Fix places that trigger no-unused-lambda-capture

no-unused-lambda-capture was suppressed, but it's been decided as desireable to stop suppressing it. This CL fixes places in the code that trigger it.

1. Some unnecessary captures removed.
2. s/constexpr/const when capturing a float by value - this is good enough to stop the error.
3. Complete removal of the constexpr/const-modifier for int-types as a workaround.

BUG=webrtc:7133

Review-Url: https://codereview.webrtc.org/3005433002
Cr-Original-Commit-Position: refs/heads/master@{#19462}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 1cc5fc3ebfacefe8326abb6c3367be6ddf524957
diff --git a/modules/audio_processing/aec3/adaptive_fir_filter.cc b/modules/audio_processing/aec3/adaptive_fir_filter.cc
index 43cc901..09347e8 100644
--- a/modules/audio_processing/aec3/adaptive_fir_filter.cc
+++ b/modules/audio_processing/aec3/adaptive_fir_filter.cc
@@ -507,7 +507,7 @@
   std::array<float, kFftLength> h;
   fft_.Ifft(H_[partition_to_constrain_], &h);
 
-  constexpr float kScale = 1.0f / kFftLengthBy2;
+  const float kScale = 1.0f / kFftLengthBy2;
   std::for_each(h.begin(), h.begin() + kFftLengthBy2,
                 [kScale](float& a) { a *= kScale; });
   std::fill(h.begin() + kFftLengthBy2, h.end(), 0.f);
diff --git a/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc b/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc
index 32b20a4..b9ab201 100644
--- a/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc
+++ b/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc
@@ -337,7 +337,7 @@
       delay_buffer.Delay(x[0], y);
 
       RandomizeSampleVector(&random_generator, n);
-      constexpr float kNoiseScaling = 1.f / 100.f;
+      const float kNoiseScaling = 1.f / 100.f;
       std::transform(
           y.begin(), y.end(), n.begin(), y.begin(),
           [kNoiseScaling](float a, float b) { return a + b * kNoiseScaling; });
diff --git a/modules/audio_processing/aec3/residual_echo_estimator.cc b/modules/audio_processing/aec3/residual_echo_estimator.cc
index 6120811..f3b3106 100644
--- a/modules/audio_processing/aec3/residual_echo_estimator.cc
+++ b/modules/audio_processing/aec3/residual_echo_estimator.cc
@@ -32,7 +32,7 @@
   }
 
   // Apply soft noise gate of -78 dBFS.
-  constexpr float kNoiseGatePower = 27509.42f;
+  const float kNoiseGatePower = 27509.42f;
   std::for_each(X2->begin(), X2->end(), [kNoiseGatePower](float& a) {
     if (kNoiseGatePower > a) {
       a = std::max(0.f, a - 0.3f * (kNoiseGatePower - a));
diff --git a/pc/channel_unittest.cc b/pc/channel_unittest.cc
index fa9d3da..0eaffc4 100644
--- a/pc/channel_unittest.cc
+++ b/pc/channel_unittest.cc
@@ -1205,9 +1205,13 @@
   // Tests that when the transport channel signals a candidate pair change
   // event, the media channel will receive a call on the network route change.
   void TestNetworkRouteChanges() {
-    constexpr uint16_t kLocalNetId = 1;
-    constexpr uint16_t kRemoteNetId = 2;
-    constexpr int kLastPacketId = 100;
+    // These would have been declared as constexpr, but then some compilers
+    // require them to be captured in the lambda, and other compilers complain
+    // about no-ununused-lambda-capture. Keeping them as normal variables was
+    // the easiest work-around.
+    uint16_t kLocalNetId = 1;
+    uint16_t kRemoteNetId = 2;
+    int kLastPacketId = 100;
 
     CreateChannels(0, 0);
 
@@ -1227,7 +1231,7 @@
     EXPECT_FALSE(media_channel1->last_network_route().connected);
     media_channel1->set_num_network_route_changes(0);
 
-    network_thread_->Invoke<void>(RTC_FROM_HERE, [this, media_channel1,
+    network_thread_->Invoke<void>(RTC_FROM_HERE, [this,
                                                   kLocalNetId, kRemoteNetId,
                                                   kLastPacketId] {
       // The transport channel becomes connected.
diff --git a/pc/rtcstatscollector_unittest.cc b/pc/rtcstatscollector_unittest.cc
index f6591c0..4f3b35f 100644
--- a/pc/rtcstatscollector_unittest.cc
+++ b/pc/rtcstatscollector_unittest.cc
@@ -721,13 +721,13 @@
 
   // Mock the session to return the local and remote certificates.
   EXPECT_CALL(test_->session(), GetStats(_)).WillRepeatedly(Invoke(
-      [this](const ChannelNamePairs&) {
+      [](const ChannelNamePairs&) {
         std::unique_ptr<SessionStats> stats(new SessionStats());
         stats->transport_stats["transport"].transport_name = "transport";
         return stats;
       }));
   EXPECT_CALL(test_->session(), GetLocalCertificate(_, _)).WillRepeatedly(
-      Invoke([this, &local_certinfo](const std::string& transport_name,
+      Invoke([&local_certinfo](const std::string& transport_name,
              rtc::scoped_refptr<rtc::RTCCertificate>* certificate) {
         if (transport_name == "transport") {
           *certificate = local_certinfo->certificate;
@@ -737,7 +737,7 @@
       }));
   EXPECT_CALL(test_->session(),
       GetRemoteSSLCertificate_ReturnsRawPointer(_)).WillRepeatedly(Invoke(
-      [this, &remote_certinfo](const std::string& transport_name) {
+      [&remote_certinfo](const std::string& transport_name) {
         if (transport_name == "transport")
           return remote_certinfo->certificate->ssl_certificate().GetReference();
         return static_cast<rtc::SSLCertificate*>(nullptr);
@@ -892,14 +892,14 @@
 
   // Mock the session to return the local and remote certificates.
   EXPECT_CALL(test_->session(), GetStats(_)).WillRepeatedly(Invoke(
-      [this](const ChannelNamePairs&) {
+      [](const ChannelNamePairs&) {
         std::unique_ptr<SessionStats> stats(new SessionStats());
         stats->transport_stats["audio"].transport_name = "audio";
         stats->transport_stats["video"].transport_name = "video";
         return stats;
       }));
   EXPECT_CALL(test_->session(), GetLocalCertificate(_, _)).WillRepeatedly(
-      Invoke([this, &audio_local_certinfo, &video_local_certinfo](
+      Invoke([&audio_local_certinfo, &video_local_certinfo](
             const std::string& transport_name,
             rtc::scoped_refptr<rtc::RTCCertificate>* certificate) {
         if (transport_name == "audio") {
@@ -914,7 +914,7 @@
       }));
   EXPECT_CALL(test_->session(),
       GetRemoteSSLCertificate_ReturnsRawPointer(_)).WillRepeatedly(Invoke(
-      [this, &audio_remote_certinfo, &video_remote_certinfo](
+      [&audio_remote_certinfo, &video_remote_certinfo](
           const std::string& transport_name) {
         if (transport_name == "audio") {
           return audio_remote_certinfo->certificate->ssl_certificate()
@@ -952,13 +952,13 @@
 
   // Mock the session to return the local and remote certificates.
   EXPECT_CALL(test_->session(), GetStats(_)).WillRepeatedly(Invoke(
-      [this](const ChannelNamePairs&) {
+      [](const ChannelNamePairs&) {
         std::unique_ptr<SessionStats> stats(new SessionStats());
         stats->transport_stats["transport"].transport_name = "transport";
         return stats;
       }));
   EXPECT_CALL(test_->session(), GetLocalCertificate(_, _)).WillRepeatedly(
-      Invoke([this, &local_certinfo](const std::string& transport_name,
+      Invoke([&local_certinfo](const std::string& transport_name,
              rtc::scoped_refptr<rtc::RTCCertificate>* certificate) {
         if (transport_name == "transport") {
           *certificate = local_certinfo->certificate;
@@ -968,7 +968,7 @@
       }));
   EXPECT_CALL(test_->session(),
       GetRemoteSSLCertificate_ReturnsRawPointer(_)).WillRepeatedly(Invoke(
-      [this, &remote_certinfo](const std::string& transport_name) {
+      [&remote_certinfo](const std::string& transport_name) {
         if (transport_name == "transport")
           return remote_certinfo->certificate->ssl_certificate().GetReference();
         return static_cast<rtc::SSLCertificate*>(nullptr);
@@ -2278,7 +2278,7 @@
       CreateFakeCertificateAndInfoFromDers(
           std::vector<std::string>({ "(remote) local", "(remote) chain" }));
   EXPECT_CALL(test_->session(), GetLocalCertificate(_, _)).WillRepeatedly(
-    Invoke([this, &local_certinfo](const std::string& transport_name,
+    Invoke([&local_certinfo](const std::string& transport_name,
            rtc::scoped_refptr<rtc::RTCCertificate>* certificate) {
       if (transport_name == "transport") {
         *certificate = local_certinfo->certificate;
@@ -2288,7 +2288,7 @@
     }));
   EXPECT_CALL(test_->session(),
       GetRemoteSSLCertificate_ReturnsRawPointer(_)).WillRepeatedly(Invoke(
-      [this, &remote_certinfo](const std::string& transport_name) {
+      [&remote_certinfo](const std::string& transport_name) {
         if (transport_name == "transport")
           return remote_certinfo->certificate->ssl_certificate().GetReference();
         return static_cast<rtc::SSLCertificate*>(nullptr);
diff --git a/pc/webrtcsession_unittest.cc b/pc/webrtcsession_unittest.cc
index bb1c877..6c9dcec 100644
--- a/pc/webrtcsession_unittest.cc
+++ b/pc/webrtcsession_unittest.cc
@@ -3264,7 +3264,7 @@
 
   // Checks if one of the transport channels contains a connection using a given
   // port.
-  auto connection_with_remote_port = [this, voice_channel](int port) {
+  auto connection_with_remote_port = [this](int port) {
     std::unique_ptr<webrtc::SessionStats> stats = session_->GetStats_s();
     for (auto& kv : stats->transport_stats) {
       for (auto& chan_stat : kv.second.channel_stats) {
diff --git a/video/end_to_end_tests.cc b/video/end_to_end_tests.cc
index a4d7033..f0cbf3e 100644
--- a/video/end_to_end_tests.cc
+++ b/video/end_to_end_tests.cc
@@ -4278,9 +4278,13 @@
     rtc::CriticalSection crit_;
   } observer;
 
-  constexpr int kFrameMaxWidth = 320;
-  constexpr int kFrameMaxHeight = 180;
-  constexpr int kFrameRate = 15;
+  // These would have been declared as constexpr, but then some compilers
+  // require them to be captured in the lambda, and other compilers complain
+  // about no-ununused-lambda-capture. Keeping them as normal variables was
+  // the easiest work-around.
+  int kFrameMaxWidth = 320;
+  int kFrameMaxHeight = 180;
+  int kFrameRate = 15;
 
   Call::Config config(event_log_.get());
 
diff --git a/video/overuse_frame_detector_unittest.cc b/video/overuse_frame_detector_unittest.cc
index e52efcb..80faf65 100644
--- a/video/overuse_frame_detector_unittest.cc
+++ b/video/overuse_frame_detector_unittest.cc
@@ -357,7 +357,7 @@
         event.Set();
       }));
 
-  queue.PostTask([this, &event] {
+  queue.PostTask([this] {
     const int kDelayUs1 = 5 * rtc::kNumMicrosecsPerMillisec;
     const int kDelayUs2 = 6 * rtc::kNumMicrosecsPerMillisec;
     InsertAndSendFramesWithInterval(1300, kFrameIntervalUs, kWidth, kHeight,