Rename outbound-rtp's simulcastIndex to encodingIndex.

It seems likely that this metric will also be exposed to the web, in
which case there was pushback on the name "simulcastIndex". While the
final name is not set in stone, let's rename to one that has higher odds
of getting merged on the spec: encodingIndex.

Bug: chromium:404853839
Change-Id: Iaa93b56f7e9024884367515ef9d07daa6392ee3e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/382980
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Auto-Submit: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#44227}
diff --git a/api/stats/rtcstats_objects.h b/api/stats/rtcstats_objects.h
index da47deb..c4f15a3 100644
--- a/api/stats/rtcstats_objects.h
+++ b/api/stats/rtcstats_objects.h
@@ -335,7 +335,7 @@
   // C++-only metric. Useful for apps that don't use RIDs and need to know which
   // SSRC belong to which encoding, or stats processing which does not know the
   // app-specific RID-to-index mapping (e.g. chrome://webrtc-internals/).
-  std::optional<uint32_t> simulcast_index;
+  std::optional<uint32_t> encoding_index;
   std::optional<uint64_t> retransmitted_packets_sent;
   std::optional<uint64_t> header_bytes_sent;
   std::optional<uint64_t> retransmitted_bytes_sent;
diff --git a/media/base/media_channel.h b/media/base/media_channel.h
index e0cba40..56f5302 100644
--- a/media/base/media_channel.h
+++ b/media/base/media_channel.h
@@ -576,7 +576,7 @@
 struct VideoSenderInfo : public MediaSenderInfo {
   VideoSenderInfo();
   ~VideoSenderInfo();
-  std::optional<size_t> simulcast_index;
+  std::optional<size_t> encoding_index;
   std::vector<SsrcGroup> ssrc_groups;
   std::optional<std::string> encoder_implementation_name;
   int firs_received = 0;
diff --git a/media/engine/webrtc_video_engine.cc b/media/engine/webrtc_video_engine.cc
index 79560e6..6ba1023 100644
--- a/media/engine/webrtc_video_engine.cc
+++ b/media/engine/webrtc_video_engine.cc
@@ -2536,9 +2536,9 @@
       MergeInfoAboutOutboundRtpSubstreams(stats.substreams);
   // The streams are ordered by SSRC, but the SSRCs are randomly assigned so we
   // need map for index lookup by SSRC.
-  std::map<uint32_t, size_t> simulcast_index_by_ssrc;
+  std::map<uint32_t, size_t> encoding_index_by_ssrc;
   for (size_t i = 0; i < parameters_.config.rtp.ssrcs.size(); ++i) {
-    simulcast_index_by_ssrc[parameters_.config.rtp.ssrcs[i]] = i;
+    encoding_index_by_ssrc[parameters_.config.rtp.ssrcs[i]] = i;
   }
   // If SVC is used, one stream is configured but multiple encodings exist. This
   // is not spec-compliant, but it is how we've implemented SVC so this affects
@@ -2551,8 +2551,8 @@
     info.add_ssrc(ssrc);
     info.rid = parameters_.config.rtp.GetRidForSsrc(ssrc);
     if (outbound_rtp_substreams.size() > 1 &&
-        simulcast_index_by_ssrc.find(ssrc) != simulcast_index_by_ssrc.end()) {
-      info.simulcast_index = simulcast_index_by_ssrc[ssrc];
+        encoding_index_by_ssrc.find(ssrc) != encoding_index_by_ssrc.end()) {
+      info.encoding_index = encoding_index_by_ssrc[ssrc];
     }
     info.active = IsActiveFromEncodings(
         !is_svc ? std::optional<uint32_t>(ssrc) : std::nullopt,
@@ -2605,7 +2605,7 @@
     return infos[0];
   }
   VideoSenderInfo info = infos[0];
-  info.simulcast_index = std::nullopt;  // An aggregated info has no index.
+  info.encoding_index = std::nullopt;  // An aggregated info has no index.
   info.local_stats.clear();
   for (uint32_t ssrc : parameters_.config.rtp.ssrcs) {
     info.add_ssrc(ssrc);
diff --git a/pc/rtc_stats_collector.cc b/pc/rtc_stats_collector.cc
index c55aca7..259de23 100644
--- a/pc/rtc_stats_collector.cc
+++ b/pc/rtc_stats_collector.cc
@@ -849,8 +849,8 @@
   if (video_sender_info.rid.has_value()) {
     outbound_video->rid = *video_sender_info.rid;
   }
-  if (video_sender_info.simulcast_index.has_value()) {
-    outbound_video->simulcast_index = *video_sender_info.simulcast_index;
+  if (video_sender_info.encoding_index.has_value()) {
+    outbound_video->encoding_index = *video_sender_info.encoding_index;
   }
   if (video_sender_info.power_efficient_encoder.has_value()) {
     outbound_video->power_efficient_encoder =
diff --git a/pc/rtc_stats_collector_unittest.cc b/pc/rtc_stats_collector_unittest.cc
index f291b7c..5afdda5 100644
--- a/pc/rtc_stats_collector_unittest.cc
+++ b/pc/rtc_stats_collector_unittest.cc
@@ -2614,7 +2614,7 @@
   video_media_info.senders[0].local_stats.push_back(cricket::SsrcSenderInfo());
   video_media_info.senders[0].local_stats[0].ssrc = 1;
   video_media_info.senders[0].rid = "q";
-  video_media_info.senders[0].simulcast_index = 0;
+  video_media_info.senders[0].encoding_index = 0;
   video_media_info.senders[0].firs_received = 2;
   video_media_info.senders[0].plis_received = 3;
   video_media_info.senders[0].nacks_received = 4;
@@ -2661,7 +2661,7 @@
   video_media_info.senders.push_back(video_media_info.senders[0]);
   video_media_info.senders[1].local_stats[0].ssrc = 2;
   video_media_info.senders[1].rid = "h";
-  video_media_info.senders[1].simulcast_index = 1;
+  video_media_info.senders[1].encoding_index = 1;
 
   auto video_media_channels =
       pc_->AddVideoChannel("VideoMid", "TransportName", video_media_info);
@@ -2687,7 +2687,7 @@
   // `expected_video.remote_id` should be undefined.
   expected_video.mid = "VideoMid";
   expected_video.rid = "q";
-  expected_video.simulcast_index = 0;
+  expected_video.encoding_index = 0;
   expected_video.ssrc = 1;
   expected_video.kind = "video";
   expected_video.transport_id = "TTransportName1";
diff --git a/pc/rtc_stats_integrationtest.cc b/pc/rtc_stats_integrationtest.cc
index 81748ce..1da0c89 100644
--- a/pc/rtc_stats_integrationtest.cc
+++ b/pc/rtc_stats_integrationtest.cc
@@ -843,7 +843,7 @@
           outbound_stream.huge_frames_sent);
       // RID and simulcast index are N/A because this test uses singlecast.
       verifier.TestAttributeIsUndefined(outbound_stream.rid);
-      verifier.TestAttributeIsUndefined(outbound_stream.simulcast_index);
+      verifier.TestAttributeIsUndefined(outbound_stream.encoding_index);
       verifier.TestAttributeIsDefined(outbound_stream.scalability_mode);
       verifier.TestAttributeIsNonNegative<uint32_t>(outbound_stream.rtx_ssrc);
     } else {
@@ -863,7 +863,7 @@
       verifier.TestAttributeIsUndefined(
           outbound_stream.power_efficient_encoder);
       verifier.TestAttributeIsUndefined(outbound_stream.rid);
-      verifier.TestAttributeIsUndefined(outbound_stream.simulcast_index);
+      verifier.TestAttributeIsUndefined(outbound_stream.encoding_index);
       verifier.TestAttributeIsUndefined(outbound_stream.frames_per_second);
       verifier.TestAttributeIsUndefined(outbound_stream.frame_height);
       verifier.TestAttributeIsUndefined(outbound_stream.frame_width);
diff --git a/stats/rtcstats_objects.cc b/stats/rtcstats_objects.cc
index 26c62b55..5a801cc 100644
--- a/stats/rtcstats_objects.cc
+++ b/stats/rtcstats_objects.cc
@@ -296,7 +296,7 @@
     AttributeInit("remoteId", &remote_id),
     AttributeInit("mid", &mid),
     AttributeInit("rid", &rid),
-    AttributeInit("simulcastIndex", &simulcast_index),
+    AttributeInit("encodingIndex", &encoding_index),
     AttributeInit("retransmittedPacketsSent", &retransmitted_packets_sent),
     AttributeInit("headerBytesSent", &header_bytes_sent),
     AttributeInit("retransmittedBytesSent", &retransmitted_bytes_sent),