Delete RTCInboundRTPStreamStats::fraction_lost

And delete corresponding plumbing via the internal stats attribute
MediaReceiverInfo::fraction_lost. The latter attribute is not deleted
yet, since downstream projects have to be updated first.

Bug: webrtc:10744
Change-Id: Id5401aeee7e5637a406ddf2fa33fbfe336abec9f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/143178
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28385}
diff --git a/api/stats/rtcstats_objects.h b/api/stats/rtcstats_objects.h
index ff99df5..0c864cd 100644
--- a/api/stats/rtcstats_objects.h
+++ b/api/stats/rtcstats_objects.h
@@ -419,7 +419,6 @@
   // TODO(hbos): Collect and populate this value for both "audio" and "video",
   // currently not collected for "video". https://bugs.webrtc.org/7065
   RTCStatsMember<double> jitter;
-  RTCStatsMember<double> fraction_lost;
   // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
   RTCStatsMember<double> round_trip_time;
   // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
diff --git a/audio/audio_receive_stream.cc b/audio/audio_receive_stream.cc
index 32617aa..0ff2b0c 100644
--- a/audio/audio_receive_stream.cc
+++ b/audio/audio_receive_stream.cc
@@ -188,7 +188,6 @@
   stats.bytes_rcvd = call_stats.bytesReceived;
   stats.packets_rcvd = call_stats.packetsReceived;
   stats.packets_lost = call_stats.cumulativeLost;
-  stats.fraction_lost = Q8ToFloat(call_stats.fractionLost);
   stats.capture_start_ntp_time_ms = call_stats.capture_start_ntp_time_ms_;
   stats.last_packet_received_timestamp_ms =
       call_stats.last_packet_received_timestamp_ms;
diff --git a/audio/audio_receive_stream_unittest.cc b/audio/audio_receive_stream_unittest.cc
index b97217c..7a6b31e 100644
--- a/audio/audio_receive_stream_unittest.cc
+++ b/audio/audio_receive_stream_unittest.cc
@@ -61,8 +61,7 @@
 const double kTotalOutputEnergy = 0.25;
 const double kTotalOutputDuration = 0.5;
 
-const CallReceiveStatistics kCallStats = {345, 678, 901, 234,
-                                          -12, 567, 890, 123};
+const CallReceiveStatistics kCallStats = {678, 901, 234, -12, 567, 890, 123};
 const std::pair<int, SdpAudioFormat> kReceiveCodec = {
     123,
     {"codec_name_recv", 96000, 0}};
@@ -270,7 +269,6 @@
   EXPECT_EQ(static_cast<uint32_t>(kCallStats.packetsReceived),
             stats.packets_rcvd);
   EXPECT_EQ(kCallStats.cumulativeLost, stats.packets_lost);
-  EXPECT_EQ(Q8ToFloat(kCallStats.fractionLost), stats.fraction_lost);
   EXPECT_EQ(kReceiveCodec.second.name, stats.codec_name);
   EXPECT_EQ(kCallStats.extendedMax, stats.ext_seqnum);
   EXPECT_EQ(
diff --git a/audio/channel_receive.cc b/audio/channel_receive.cc
index 25f4ac8..8b9dd2d 100644
--- a/audio/channel_receive.cc
+++ b/audio/channel_receive.cc
@@ -756,7 +756,6 @@
                                 _rtpRtcpModule->RTCP() == RtcpMode::kOff);
   }
 
-  stats.fractionLost = statistics.fraction_lost;
   stats.cumulativeLost = statistics.packets_lost;
   stats.extendedMax = statistics.extended_highest_sequence_number;
   stats.jitterSamples = statistics.jitter;
diff --git a/audio/channel_receive.h b/audio/channel_receive.h
index d29f624..1b0c81c 100644
--- a/audio/channel_receive.h
+++ b/audio/channel_receive.h
@@ -50,7 +50,6 @@
 class RtpRtcp;
 
 struct CallReceiveStatistics {
-  unsigned short fractionLost;  // NOLINT
   unsigned int cumulativeLost;
   unsigned int extendedMax;
   unsigned int jitterSamples;
diff --git a/audio/test/audio_stats_test.cc b/audio/test/audio_stats_test.cc
index 556a16d..c45e3c1 100644
--- a/audio/test/audio_stats_test.cc
+++ b/audio/test/audio_stats_test.cc
@@ -69,7 +69,6 @@
     EXPECT_PRED2(IsNear, kBytesSent, recv_stats.bytes_rcvd);
     EXPECT_PRED2(IsNear, kPacketsSent, recv_stats.packets_rcvd);
     EXPECT_EQ(0u, recv_stats.packets_lost);
-    EXPECT_EQ(0.0f, recv_stats.fraction_lost);
     EXPECT_EQ("opus", send_stats.codec_name);
     // recv_stats.jitter_ms
     // recv_stats.jitter_buffer_ms
diff --git a/call/audio_receive_stream.h b/call/audio_receive_stream.h
index 911b38e..1829228 100644
--- a/call/audio_receive_stream.h
+++ b/call/audio_receive_stream.h
@@ -41,7 +41,6 @@
     uint64_t fec_packets_received = 0;
     uint64_t fec_packets_discarded = 0;
     uint32_t packets_lost = 0;
-    float fraction_lost = 0.0f;
     std::string codec_name;
     absl::optional<int> codec_payload_type;
     uint32_t ext_seqnum = 0;
diff --git a/media/base/media_channel.h b/media/base/media_channel.h
index 123b289..e98da00 100644
--- a/media/base/media_channel.h
+++ b/media/base/media_channel.h
@@ -450,6 +450,8 @@
   int64_t bytes_rcvd = 0;
   int packets_rcvd = 0;
   int packets_lost = 0;
+  // TODO(bugs.webrtc.org/10679): Unused, delete as soon as downstream code is
+  // updated.
   float fraction_lost = 0.0f;
   // The timestamp at which the last packet was received, i.e. the time of the
   // local clock when it was received - not the RTP timestamp of that packet.
diff --git a/media/engine/webrtc_video_engine.cc b/media/engine/webrtc_video_engine.cc
index d650f3a..b95b40e 100644
--- a/media/engine/webrtc_video_engine.cc
+++ b/media/engine/webrtc_video_engine.cc
@@ -2723,8 +2723,6 @@
                     stats.rtp_stats.transmitted.padding_bytes;
   info.packets_rcvd = stats.rtp_stats.transmitted.packets;
   info.packets_lost = stats.rtcp_stats.packets_lost;
-  info.fraction_lost =
-      static_cast<float>(stats.rtcp_stats.fraction_lost) / (1 << 8);
 
   info.framerate_rcvd = stats.network_frame_rate;
   info.framerate_decoded = stats.decode_frame_rate;
diff --git a/media/engine/webrtc_video_engine_unittest.cc b/media/engine/webrtc_video_engine_unittest.cc
index dc94f5d..f7b2a2f 100644
--- a/media/engine/webrtc_video_engine_unittest.cc
+++ b/media/engine/webrtc_video_engine_unittest.cc
@@ -1610,7 +1610,6 @@
   EXPECT_EQ(DefaultCodec().id, *info.receivers[0].codec_payload_type);
   EXPECT_EQ(NumRtpBytes(), info.receivers[0].bytes_rcvd);
   EXPECT_EQ(NumRtpPackets(), info.receivers[0].packets_rcvd);
-  EXPECT_EQ(0.0, info.receivers[0].fraction_lost);
   EXPECT_EQ(0, info.receivers[0].packets_lost);
   // TODO(asapersson): Not set for webrtc. Handle missing stats.
   // EXPECT_EQ(0, info.receivers[0].packets_concealed);
@@ -5117,8 +5116,6 @@
   EXPECT_EQ(stats.rtp_stats.transmitted.packets,
             rtc::checked_cast<unsigned int>(info.receivers[0].packets_rcvd));
   EXPECT_EQ(stats.rtcp_stats.packets_lost, info.receivers[0].packets_lost);
-  EXPECT_EQ(rtc::checked_cast<float>(stats.rtcp_stats.fraction_lost) / (1 << 8),
-            info.receivers[0].fraction_lost);
 }
 
 TEST_F(WebRtcVideoChannelTest, TranslatesCallStatsCorrectly) {
diff --git a/media/engine/webrtc_voice_engine.cc b/media/engine/webrtc_voice_engine.cc
index 46e219f..9fe6f79 100644
--- a/media/engine/webrtc_voice_engine.cc
+++ b/media/engine/webrtc_voice_engine.cc
@@ -2247,7 +2247,6 @@
     rinfo.fec_packets_received = stats.fec_packets_received;
     rinfo.fec_packets_discarded = stats.fec_packets_discarded;
     rinfo.packets_lost = stats.packets_lost;
-    rinfo.fraction_lost = stats.fraction_lost;
     rinfo.codec_name = stats.codec_name;
     rinfo.codec_payload_type = stats.codec_payload_type;
     rinfo.ext_seqnum = stats.ext_seqnum;
diff --git a/media/engine/webrtc_voice_engine_unittest.cc b/media/engine/webrtc_voice_engine_unittest.cc
index 3cbad9f..42d6145 100644
--- a/media/engine/webrtc_voice_engine_unittest.cc
+++ b/media/engine/webrtc_voice_engine_unittest.cc
@@ -645,7 +645,6 @@
     stats.bytes_rcvd = 456;
     stats.packets_rcvd = 768;
     stats.packets_lost = 101;
-    stats.fraction_lost = 23.45f;
     stats.codec_name = "codec_name_recv";
     stats.codec_payload_type = 42;
     stats.ext_seqnum = 678;
@@ -688,7 +687,6 @@
               stats.packets_rcvd);
     EXPECT_EQ(rtc::checked_cast<unsigned int>(info.packets_lost),
               stats.packets_lost);
-    EXPECT_EQ(info.fraction_lost, stats.fraction_lost);
     EXPECT_EQ(info.codec_name, stats.codec_name);
     EXPECT_EQ(info.codec_payload_type, stats.codec_payload_type);
     EXPECT_EQ(rtc::checked_cast<unsigned int>(info.ext_seqnum),
diff --git a/pc/rtc_stats_collector.cc b/pc/rtc_stats_collector.cc
index d6ade5b..5e0986d 100644
--- a/pc/rtc_stats_collector.cc
+++ b/pc/rtc_stats_collector.cc
@@ -259,8 +259,6 @@
       static_cast<uint64_t>(media_receiver_info.bytes_rcvd);
   inbound_stats->packets_lost =
       static_cast<int32_t>(media_receiver_info.packets_lost);
-  inbound_stats->fraction_lost =
-      static_cast<double>(media_receiver_info.fraction_lost);
 }
 
 void SetInboundRTPStreamStatsFromVoiceReceiverInfo(
diff --git a/pc/rtc_stats_collector_unittest.cc b/pc/rtc_stats_collector_unittest.cc
index be4f2b9..11500d6 100644
--- a/pc/rtc_stats_collector_unittest.cc
+++ b/pc/rtc_stats_collector_unittest.cc
@@ -1728,7 +1728,6 @@
   voice_media_info.receivers[0].bytes_rcvd = 3;
   voice_media_info.receivers[0].codec_payload_type = 42;
   voice_media_info.receivers[0].jitter_ms = 4500;
-  voice_media_info.receivers[0].fraction_lost = 5.5f;
   voice_media_info.receivers[0].last_packet_received_timestamp_ms =
       absl::nullopt;
 
@@ -1766,7 +1765,6 @@
   expected_audio.packets_lost = -1;
   // |expected_audio.last_packet_received_timestamp| should be undefined.
   expected_audio.jitter = 4.5;
-  expected_audio.fraction_lost = 5.5;
   ASSERT_TRUE(report->Get(expected_audio.id()));
   EXPECT_EQ(
       report->Get(expected_audio.id())->cast_to<RTCInboundRTPStreamStats>(),
@@ -1798,7 +1796,6 @@
   video_media_info.receivers[0].packets_rcvd = 2;
   video_media_info.receivers[0].packets_lost = 42;
   video_media_info.receivers[0].bytes_rcvd = 3;
-  video_media_info.receivers[0].fraction_lost = 4.5f;
   video_media_info.receivers[0].codec_payload_type = 42;
   video_media_info.receivers[0].firs_sent = 5;
   video_media_info.receivers[0].plis_sent = 6;
@@ -1839,7 +1836,6 @@
   expected_video.packets_received = 2;
   expected_video.bytes_received = 3;
   expected_video.packets_lost = 42;
-  expected_video.fraction_lost = 4.5;
   expected_video.frames_decoded = 8;
   // |expected_video.qp_sum| should be undefined.
   // |expected_video.last_packet_received_timestamp| should be undefined.
diff --git a/pc/rtc_stats_integrationtest.cc b/pc/rtc_stats_integrationtest.cc
index c21c796..4f10a1d 100644
--- a/pc/rtc_stats_integrationtest.cc
+++ b/pc/rtc_stats_integrationtest.cc
@@ -789,7 +789,7 @@
     } else {
       verifier.TestMemberIsNonNegative<double>(inbound_stream.jitter);
     }
-    verifier.TestMemberIsNonNegative<double>(inbound_stream.fraction_lost);
+
     verifier.TestMemberIsUndefined(inbound_stream.round_trip_time);
     verifier.TestMemberIsUndefined(inbound_stream.packets_discarded);
     verifier.TestMemberIsUndefined(inbound_stream.packets_repaired);
diff --git a/pc/stats_collector_unittest.cc b/pc/stats_collector_unittest.cc
index 3118ef9..6b75184 100644
--- a/pc/stats_collector_unittest.cc
+++ b/pc/stats_collector_unittest.cc
@@ -562,8 +562,6 @@
   voice_receiver_info->add_ssrc(kSsrcOfTrack);
   voice_receiver_info->bytes_rcvd = 110;
   voice_receiver_info->packets_rcvd = 111;
-  voice_receiver_info->packets_lost = 112;
-  voice_receiver_info->fraction_lost = 113;
   voice_receiver_info->packets_lost = 114;
   voice_receiver_info->ext_seqnum = 115;
   voice_receiver_info->jitter_ms = 116;
diff --git a/stats/rtcstats_objects.cc b/stats/rtcstats_objects.cc
index 8098707..43c1d23 100644
--- a/stats/rtcstats_objects.cc
+++ b/stats/rtcstats_objects.cc
@@ -602,7 +602,6 @@
     &packets_lost,
     &last_packet_received_timestamp,
     &jitter,
-    &fraction_lost,
     &round_trip_time,
     &packets_discarded,
     &packets_repaired,
@@ -632,7 +631,6 @@
       packets_lost("packetsLost"),
       last_packet_received_timestamp("lastPacketReceivedTimestamp"),
       jitter("jitter"),
-      fraction_lost("fractionLost"),
       round_trip_time("roundTripTime"),
       packets_discarded("packetsDiscarded"),
       packets_repaired("packetsRepaired"),
@@ -657,7 +655,6 @@
       packets_lost(other.packets_lost),
       last_packet_received_timestamp(other.last_packet_received_timestamp),
       jitter(other.jitter),
-      fraction_lost(other.fraction_lost),
       round_trip_time(other.round_trip_time),
       packets_discarded(other.packets_discarded),
       packets_repaired(other.packets_repaired),