Wire up RTCInboundRtpStreamStats.lastPacketReceivedTimestamp.

This collects this metric for both audio and video streams.
https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-lastpacketreceivedtimestamp

This is a follow-up to https://webrtc-review.googlesource.com/c/src/+/130479
which calculated this metric. This CL is purely plumbing from
"StreamDataCounters::last_packet_received_timestamp_ms" to
RTCInboundRtpStreamStats.


Bug: webrtc:10449
Change-Id: I757ad19b5b8e84553da5edd4a75efa3e1fe30b56
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/131397
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27628}
diff --git a/pc/rtc_stats_collector_unittest.cc b/pc/rtc_stats_collector_unittest.cc
index 7e843a6..82cd241 100644
--- a/pc/rtc_stats_collector_unittest.cc
+++ b/pc/rtc_stats_collector_unittest.cc
@@ -1625,6 +1625,8 @@
   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;
 
   RtpCodecParameters codec_parameters;
   codec_parameters.payload_type = 42;
@@ -1656,12 +1658,25 @@
   expected_audio.packets_received = 2;
   expected_audio.bytes_received = 3;
   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>(),
       expected_audio);
+
+  // Set previously undefined values and "GetStats" again.
+  voice_media_info.receivers[0].last_packet_received_timestamp_ms = 3000;
+  expected_audio.last_packet_received_timestamp = 3.0;
+  voice_media_channel->SetStats(voice_media_info);
+
+  report = stats_->GetFreshStatsReport();
+
+  ASSERT_TRUE(report->Get(expected_audio.id()));
+  EXPECT_EQ(
+      report->Get(expected_audio.id())->cast_to<RTCInboundRTPStreamStats>(),
+      expected_audio);
   EXPECT_TRUE(report->Get(*expected_audio.track_id));
   EXPECT_TRUE(report->Get(*expected_audio.transport_id));
   EXPECT_TRUE(report->Get(*expected_audio.codec_id));
@@ -1684,6 +1699,8 @@
   video_media_info.receivers[0].nacks_sent = 7;
   video_media_info.receivers[0].frames_decoded = 8;
   video_media_info.receivers[0].qp_sum = absl::nullopt;
+  video_media_info.receivers[0].last_packet_received_timestamp_ms =
+      absl::nullopt;
   video_media_info.receivers[0].content_type = VideoContentType::UNSPECIFIED;
 
   RtpCodecParameters codec_parameters;
@@ -1719,6 +1736,7 @@
   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.
   // |expected_video.content_type| should be undefined.
 
   ASSERT_TRUE(report->Get(expected_video.id()));
@@ -1728,7 +1746,9 @@
 
   // Set previously undefined values and "GetStats" again.
   video_media_info.receivers[0].qp_sum = 9;
+  video_media_info.receivers[0].last_packet_received_timestamp_ms = 1000;
   expected_video.qp_sum = 9;
+  expected_video.last_packet_received_timestamp = 1.0;
   video_media_info.receivers[0].content_type = VideoContentType::SCREENSHARE;
   expected_video.content_type = "screenshare";
   video_media_channel->SetStats(video_media_info);