[clang-tidy] Apply performance-move-const-arg fixes (misc).

This CL is a manual spin-off of [1], which tried to apply clang-tidy's
performance-move-const-arg [1] to the WebRTC codebase.

Since there were some wrong fixes to correct, this CL lands a few
different fixes, like adding a constructor overload to take an rvalue
reference or remove 'const' to make std::move effective.

[1] - https://webrtc-review.googlesource.com/c/src/+/120350
[2] - https://clang.llvm.org/extra/clang-tidy/checks/performance-move-const-arg.html

Bug: webrtc:10252
Change-Id: I42a777247fee2cb788efcd7c2035148330056b7a
Reviewed-on: https://webrtc-review.googlesource.com/c/120928
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26553}
diff --git a/api/audio_codecs/audio_format.cc b/api/audio_codecs/audio_format.cc
index 11788b9..2a529a4 100644
--- a/api/audio_codecs/audio_format.cc
+++ b/api/audio_codecs/audio_format.cc
@@ -10,6 +10,8 @@
 
 #include "api/audio_codecs/audio_format.h"
 
+#include <utility>
+
 #include "absl/strings/match.h"
 
 namespace webrtc {
@@ -31,6 +33,15 @@
       num_channels(num_channels),
       parameters(param) {}
 
+SdpAudioFormat::SdpAudioFormat(absl::string_view name,
+                               int clockrate_hz,
+                               size_t num_channels,
+                               Parameters&& param)
+    : name(name),
+      clockrate_hz(clockrate_hz),
+      num_channels(num_channels),
+      parameters(std::move(param)) {}
+
 bool SdpAudioFormat::Matches(const SdpAudioFormat& o) const {
   return absl::EqualsIgnoreCase(name, o.name) &&
          clockrate_hz == o.clockrate_hz && num_channels == o.num_channels;
diff --git a/api/audio_codecs/audio_format.h b/api/audio_codecs/audio_format.h
index b8b0421..053c067 100644
--- a/api/audio_codecs/audio_format.h
+++ b/api/audio_codecs/audio_format.h
@@ -32,6 +32,10 @@
                  int clockrate_hz,
                  size_t num_channels,
                  const Parameters& param);
+  SdpAudioFormat(absl::string_view name,
+                 int clockrate_hz,
+                 size_t num_channels,
+                 Parameters&& param);
   ~SdpAudioFormat();
 
   // Returns true if this format is compatible with |o|. In SDP terminology:
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
index dfbbb57..e7408f0 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -587,7 +587,7 @@
     sampling_rate_hz = media_transport_sampling_frequency_;
     channel_id = media_transport_channel_id_;
   }
-  const MediaTransportEncodedAudioFrame frame(
+  MediaTransportEncodedAudioFrame frame(
       /*sampling_rate_hz=*/sampling_rate_hz,
 
       // TODO(nisse): Timestamp and sample index are the same for all supported
diff --git a/logging/rtc_event_log/rtc_event_log_parser.cc b/logging/rtc_event_log/rtc_event_log_parser.cc
index 30e8a51..1a0c8eb 100644
--- a/logging/rtc_event_log/rtc_event_log_parser.cc
+++ b/logging/rtc_event_log/rtc_event_log_parser.cc
@@ -1051,7 +1051,7 @@
   // Since we dont need rapid lookup based on SSRC after parsing, we move the
   // packets_streams from map to vector.
   incoming_rtp_packets_by_ssrc_.reserve(incoming_rtp_packets_map_.size());
-  for (const auto& kv : incoming_rtp_packets_map_) {
+  for (auto& kv : incoming_rtp_packets_map_) {
     incoming_rtp_packets_by_ssrc_.emplace_back(LoggedRtpStreamIncoming());
     incoming_rtp_packets_by_ssrc_.back().ssrc = kv.first;
     incoming_rtp_packets_by_ssrc_.back().incoming_packets =
@@ -1059,7 +1059,7 @@
   }
   incoming_rtp_packets_map_.clear();
   outgoing_rtp_packets_by_ssrc_.reserve(outgoing_rtp_packets_map_.size());
-  for (const auto& kv : outgoing_rtp_packets_map_) {
+  for (auto& kv : outgoing_rtp_packets_map_) {
     outgoing_rtp_packets_by_ssrc_.emplace_back(LoggedRtpStreamOutgoing());
     outgoing_rtp_packets_by_ssrc_.back().ssrc = kv.first;
     outgoing_rtp_packets_by_ssrc_.back().outgoing_packets =
diff --git a/modules/audio_device/audio_device_name.cc b/modules/audio_device/audio_device_name.cc
index 0a1ed0c..92d8ba1 100644
--- a/modules/audio_device/audio_device_name.cc
+++ b/modules/audio_device/audio_device_name.cc
@@ -17,8 +17,7 @@
 const char AudioDeviceName::kDefaultDeviceId[] = "default";
 const char AudioDeviceName::kDefaultCommunicationsDeviceId[] = "communications";
 
-AudioDeviceName::AudioDeviceName(const std::string device_name,
-                                 const std::string unique_id)
+AudioDeviceName::AudioDeviceName(std::string device_name, std::string unique_id)
     : device_name(std::move(device_name)), unique_id(std::move(unique_id)) {}
 
 bool AudioDeviceName::IsValid() {
diff --git a/modules/audio_device/audio_device_name.h b/modules/audio_device/audio_device_name.h
index c03384e..2673663 100644
--- a/modules/audio_device/audio_device_name.h
+++ b/modules/audio_device/audio_device_name.h
@@ -24,7 +24,7 @@
   static const char kDefaultCommunicationsDeviceId[];
 
   AudioDeviceName() = default;
-  AudioDeviceName(const std::string device_name, const std::string unique_id);
+  AudioDeviceName(std::string device_name, std::string unique_id);
 
   ~AudioDeviceName() = default;
 
diff --git a/pc/peer_connection_ice_unittest.cc b/pc/peer_connection_ice_unittest.cc
index 1d525e3..5499c83 100644
--- a/pc/peer_connection_ice_unittest.cc
+++ b/pc/peer_connection_ice_unittest.cc
@@ -994,7 +994,7 @@
                                           nullptr /* cert_generator */,
                                           &observer_));
     EXPECT_TRUE(pc.get());
-    pc_ = std::move(pc.get());
+    pc_ = std::move(pc);
   }
 
   rtc::scoped_refptr<PeerConnectionFactoryInterface> pc_factory_ = nullptr;
diff --git a/pc/transport_stats.cc b/pc/transport_stats.cc
index f6dd7d6..8049c07 100644
--- a/pc/transport_stats.cc
+++ b/pc/transport_stats.cc
@@ -18,8 +18,4 @@
 
 TransportChannelStats::~TransportChannelStats() = default;
 
-TransportStats::TransportStats() = default;
-
-TransportStats::~TransportStats() = default;
-
 }  // namespace cricket
diff --git a/pc/transport_stats.h b/pc/transport_stats.h
index 8813dbe..bec1c2b 100644
--- a/pc/transport_stats.h
+++ b/pc/transport_stats.h
@@ -39,9 +39,6 @@
 
 // Information about the stats of a transport.
 struct TransportStats {
-  TransportStats();
-  ~TransportStats();
-
   std::string transport_name;
   TransportChannelStatsList channel_stats;
 };
diff --git a/rtc_base/function_view_unittest.cc b/rtc_base/function_view_unittest.cc
index 535fae8..d91bac0 100644
--- a/rtc_base/function_view_unittest.cc
+++ b/rtc_base/function_view_unittest.cc
@@ -97,6 +97,7 @@
 TEST(FunctionViewTest, MoveConstructorIsCopy) {
   auto f17 = [] { return 17; };
   rtc::FunctionView<int()> fv1(f17);
+  // NOLINTNEXTLINE(performance-move-const-arg)
   rtc::FunctionView<int()> fv2(std::move(fv1));
   EXPECT_EQ(17, fv1());
   EXPECT_EQ(17, fv2());
@@ -121,7 +122,7 @@
   rtc::FunctionView<int()> fv2(f23);
   EXPECT_EQ(17, fv1());
   EXPECT_EQ(23, fv2());
-  fv2 = std::move(fv1);
+  fv2 = std::move(fv1);  // NOLINT(performance-move-const-arg)
   EXPECT_EQ(17, fv1());
   EXPECT_EQ(17, fv2());
 }