Fix places that trigger no-unused-lambda-capture - change to using static-constexpr.

Follow up on https://codereview.webrtc.org/3005433002/.

BUG=webrtc:7133
TBR=stefan@webrtc.org

Review-Url: https://codereview.webrtc.org/3003723002
Cr-Original-Commit-Position: refs/heads/master@{#19499}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 05b07bb833328515f7e86b769a7660008f0f498e
diff --git a/modules/audio_processing/aec3/adaptive_fir_filter.cc b/modules/audio_processing/aec3/adaptive_fir_filter.cc
index 09347e8..303ff77 100644
--- a/modules/audio_processing/aec3/adaptive_fir_filter.cc
+++ b/modules/audio_processing/aec3/adaptive_fir_filter.cc
@@ -507,9 +507,9 @@
   std::array<float, kFftLength> h;
   fft_.Ifft(H_[partition_to_constrain_], &h);
 
-  const float kScale = 1.0f / kFftLengthBy2;
+  static constexpr float kScale = 1.0f / kFftLengthBy2;
   std::for_each(h.begin(), h.begin() + kFftLengthBy2,
-                [kScale](float& a) { a *= kScale; });
+                [](float& a) { a *= kScale; });
   std::fill(h.begin() + kFftLengthBy2, h.end(), 0.f);
 
   std::copy(h.begin(), h.begin() + kFftLengthBy2,
diff --git a/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc b/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc
index b9ab201..ddc7896 100644
--- a/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc
+++ b/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc
@@ -337,10 +337,10 @@
       delay_buffer.Delay(x[0], y);
 
       RandomizeSampleVector(&random_generator, n);
-      const float kNoiseScaling = 1.f / 100.f;
+      static constexpr 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; });
+          [](float a, float b) { return a + b * kNoiseScaling; });
 
       x_hp_filter.Process(x[0]);
       y_hp_filter.Process(y);
diff --git a/modules/audio_processing/aec3/residual_echo_estimator.cc b/modules/audio_processing/aec3/residual_echo_estimator.cc
index 8905846..c708664 100644
--- a/modules/audio_processing/aec3/residual_echo_estimator.cc
+++ b/modules/audio_processing/aec3/residual_echo_estimator.cc
@@ -32,8 +32,8 @@
   }
 
   // Apply soft noise gate of -78 dBFS.
-  const float kNoiseGatePower = 27509.42f;
-  std::for_each(X2->begin(), X2->end(), [kNoiseGatePower](float& a) {
+  static constexpr float kNoiseGatePower = 27509.42f;
+  std::for_each(X2->begin(), X2->end(), [](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 0eaffc4..3f30201 100644
--- a/pc/channel_unittest.cc
+++ b/pc/channel_unittest.cc
@@ -1205,13 +1205,9 @@
   // 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() {
-    // 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;
+    static constexpr uint16_t kLocalNetId = 1;
+    static constexpr uint16_t kRemoteNetId = 2;
+    static constexpr int kLastPacketId = 100;
 
     CreateChannels(0, 0);
 
@@ -1231,9 +1227,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,
-                                                  kLocalNetId, kRemoteNetId,
-                                                  kLastPacketId] {
+    network_thread_->Invoke<void>(RTC_FROM_HERE, [this] {
       // The transport channel becomes connected.
       rtc::SocketAddress local_address("192.168.1.1", 1000 /* port number */);
       rtc::SocketAddress remote_address("192.168.1.2", 2000 /* port number */);
diff --git a/video/end_to_end_tests.cc b/video/end_to_end_tests.cc
index f0cbf3e..7e62f6d 100644
--- a/video/end_to_end_tests.cc
+++ b/video/end_to_end_tests.cc
@@ -4278,13 +4278,9 @@
     rtc::CriticalSection crit_;
   } observer;
 
-  // 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;
+  static constexpr int kFrameMaxWidth = 320;
+  static constexpr int kFrameMaxHeight = 180;
+  static constexpr int kFrameRate = 15;
 
   Call::Config config(event_log_.get());
 
@@ -4371,8 +4367,7 @@
 
   EXPECT_TRUE(observer.Wait()) << "Timed out waiting for packets.";
 
-  task_queue_.SendTask([this, &observer,
-                        kFrameRate, kFrameMaxWidth, kFrameMaxHeight]() {
+  task_queue_.SendTask([this, &observer]() {
     // Ensure monotonicity when the VideoSendStream is recreated.
     frame_generator_capturer_->Stop();
     sender_call_->DestroyVideoSendStream(video_send_stream_);