[clang-tidy] Apply performance-inefficient-vector-operation fixes.

This CL applies clang-tidy's performance-inefficient-vector-operation
[1] on the WebRTC codebase.

All changes in this CL are automatically generated by both clang-tidy
and 'git cl format'.

[1] - https://clang.llvm.org/extra/clang-tidy/checks/performance-inefficient-vector-operation.html

Bug: webrtc:10252
Change-Id: I824caab2a5746036852e00d714b89aa5ec030ee3
Reviewed-on: https://webrtc-review.googlesource.com/c/120052
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26442}
diff --git a/modules/audio_coding/codecs/builtin_audio_encoder_factory_unittest.cc b/modules/audio_coding/codecs/builtin_audio_encoder_factory_unittest.cc
index 64f0159..6d1cbc6 100644
--- a/modules/audio_coding/codecs/builtin_audio_encoder_factory_unittest.cc
+++ b/modules/audio_coding/codecs/builtin_audio_encoder_factory_unittest.cc
@@ -116,6 +116,7 @@
 
   const std::vector<SdpAudioFormat> supported_formats = [&specs] {
     std::vector<SdpAudioFormat> formats;
+    formats.reserve(specs.size());
     for (const auto& spec : specs) {
       formats.push_back(spec.format);
     }
diff --git a/modules/audio_mixer/audio_mixer_test.cc b/modules/audio_mixer/audio_mixer_test.cc
index f9c5c39..85854f0 100644
--- a/modules/audio_mixer/audio_mixer_test.cc
+++ b/modules/audio_mixer/audio_mixer_test.cc
@@ -122,6 +122,7 @@
   const std::vector<std::string> input_files = parse_input_files();
   std::vector<webrtc::test::FilePlayingSource> sources;
   const int num_channels = FLAG_stereo ? 2 : 1;
+  sources.reserve(input_files.size());
   for (const auto& input_file : input_files) {
     sources.emplace_back(input_file);
   }
diff --git a/modules/remote_bitrate_estimator/test/bwe_test.cc b/modules/remote_bitrate_estimator/test/bwe_test.cc
index ca685fe..9fad58d 100644
--- a/modules/remote_bitrate_estimator/test/bwe_test.cc
+++ b/modules/remote_bitrate_estimator/test/bwe_test.cc
@@ -329,6 +329,7 @@
   jitter.SetMaxJitter(max_jitter_ms);
 
   std::vector<RateCounterFilter*> rate_counters;
+  rate_counters.reserve(media_flow_ids.size());
   for (int flow : media_flow_ids) {
     rate_counters.push_back(
         new RateCounterFilter(&uplink_, flow, "Receiver", bwe_names[bwe_type]));
diff --git a/modules/remote_bitrate_estimator/test/metric_recorder_unittest.cc b/modules/remote_bitrate_estimator/test/metric_recorder_unittest.cc
index c778cb8..670b9bc 100644
--- a/modules/remote_bitrate_estimator/test/metric_recorder_unittest.cc
+++ b/modules/remote_bitrate_estimator/test/metric_recorder_unittest.cc
@@ -72,6 +72,7 @@
   const int kNumPackets = 1000;
 
   std::vector<int64_t> delays_ms;
+  delays_ms.reserve(kNumPackets);
   for (int i = 0; i < kNumPackets; ++i) {
     delays_ms.push_back(static_cast<int64_t>(i + 1));
   }
diff --git a/pc/media_session_unittest.cc b/pc/media_session_unittest.cc
index 534e4fc..fc1cafb 100644
--- a/pc/media_session_unittest.cc
+++ b/pc/media_session_unittest.cc
@@ -266,6 +266,7 @@
 template <class T>
 static std::vector<std::string> GetCodecNames(const std::vector<T>& codecs) {
   std::vector<std::string> codec_names;
+  codec_names.reserve(codecs.size());
   for (const auto& codec : codecs) {
     codec_names.push_back(codec.name);
   }
diff --git a/pc/peer_connection_bundle_unittest.cc b/pc/peer_connection_bundle_unittest.cc
index 5b1a23a..67401a3 100644
--- a/pc/peer_connection_bundle_unittest.cc
+++ b/pc/peer_connection_bundle_unittest.cc
@@ -282,6 +282,7 @@
 std::vector<int> GetCandidateComponents(
     const std::vector<IceCandidateInterface*> candidates) {
   std::vector<int> components;
+  components.reserve(candidates.size());
   for (auto* candidate : candidates) {
     components.push_back(candidate->candidate().component());
   }
diff --git a/pc/peer_connection_media_unittest.cc b/pc/peer_connection_media_unittest.cc
index ca03656..60bea4c 100644
--- a/pc/peer_connection_media_unittest.cc
+++ b/pc/peer_connection_media_unittest.cc
@@ -201,6 +201,7 @@
 std::vector<std::string> GetIds(
     const std::vector<cricket::StreamParams>& streams) {
   std::vector<std::string> ids;
+  ids.reserve(streams.size());
   for (const auto& stream : streams) {
     ids.push_back(stream.id);
   }
diff --git a/pc/rtc_stats_traversal_unittest.cc b/pc/rtc_stats_traversal_unittest.cc
index de2aae7..c08d293 100644
--- a/pc/rtc_stats_traversal_unittest.cc
+++ b/pc/rtc_stats_traversal_unittest.cc
@@ -41,6 +41,7 @@
 
   void TakeReferencedStats(std::vector<const RTCStats*> start_nodes) {
     std::vector<std::string> start_ids;
+    start_ids.reserve(start_nodes.size());
     for (const RTCStats* start_node : start_nodes) {
       start_ids.push_back(start_node->id());
     }
diff --git a/pc/rtp_sender_receiver_unittest.cc b/pc/rtp_sender_receiver_unittest.cc
index f3fb63a..69d0c74 100644
--- a/pc/rtp_sender_receiver_unittest.cc
+++ b/pc/rtp_sender_receiver_unittest.cc
@@ -203,6 +203,7 @@
   void CreateVideoRtpSenderWithSimulcast(
       int num_layers = kVideoSimulcastLayerCount) {
     std::vector<uint32_t> ssrcs;
+    ssrcs.reserve(num_layers);
     for (int i = 0; i < num_layers; ++i)
       ssrcs.push_back(kVideoSsrcSimulcast + i);
     cricket::StreamParams stream_params =
@@ -260,6 +261,7 @@
       std::vector<rtc::scoped_refptr<MediaStreamInterface>> streams = {},
       int num_layers = kVideoSimulcastLayerCount) {
     std::vector<uint32_t> ssrcs;
+    ssrcs.reserve(num_layers);
     for (int i = 0; i < num_layers; ++i)
       ssrcs.push_back(kVideoSsrcSimulcast + i);
     cricket::StreamParams stream_params =
@@ -943,6 +945,7 @@
 
   // Simulate the setLocalDescription call
   std::vector<uint32_t> ssrcs;
+  ssrcs.reserve(2);
   for (int i = 0; i < 2; ++i)
     ssrcs.push_back(kVideoSsrcSimulcast + i);
   cricket::StreamParams stream_params =
@@ -978,6 +981,7 @@
   // Simulate the setLocalDescription call as if the user used SDP munging
   // to enable simulcast
   std::vector<uint32_t> ssrcs;
+  ssrcs.reserve(2);
   for (int i = 0; i < 2; ++i)
     ssrcs.push_back(kVideoSsrcSimulcast + i);
   cricket::StreamParams stream_params =
diff --git a/rtc_base/bitrate_allocation_strategy.cc b/rtc_base/bitrate_allocation_strategy.cc
index af40af4..34a61ef 100644
--- a/rtc_base/bitrate_allocation_strategy.cc
+++ b/rtc_base/bitrate_allocation_strategy.cc
@@ -45,6 +45,7 @@
 std::vector<uint32_t> BitrateAllocationStrategy::SetAllBitratesToMinimum(
     const std::vector<BitrateAllocationStrategy::TrackConfig>& track_configs) {
   std::vector<uint32_t> track_allocations;
+  track_allocations.reserve(track_configs.size());
   for (const auto& track_config : track_configs) {
     track_allocations.push_back(track_config.min_bitrate_bps);
   }
diff --git a/rtc_base/fake_ssl_identity.cc b/rtc_base/fake_ssl_identity.cc
index 8607e0a..480922c 100644
--- a/rtc_base/fake_ssl_identity.cc
+++ b/rtc_base/fake_ssl_identity.cc
@@ -75,6 +75,7 @@
 
 FakeSSLIdentity::FakeSSLIdentity(const std::vector<std::string>& pem_strings) {
   std::vector<std::unique_ptr<SSLCertificate>> certs;
+  certs.reserve(pem_strings.size());
   for (const std::string& pem_string : pem_strings) {
     certs.push_back(absl::make_unique<FakeSSLCertificate>(pem_string));
   }