Implement Outbound/InboundRtpStreamStats.mid.
This is what allowed us to remove "transceiver" stats from the spec.
Bug: webrtc:14191
Change-Id: I687a2dd97de016832005cb4271f6e1a0e0560cd3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/266022
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Philipp Hancke <philipp.hancke@googlemail.com>
Cr-Commit-Position: refs/heads/main@{#37247}
diff --git a/pc/rtc_stats_collector.cc b/pc/rtc_stats_collector.cc
index efc90a3..04ea8b2 100644
--- a/pc/rtc_stats_collector.cc
+++ b/pc/rtc_stats_collector.cc
@@ -422,6 +422,7 @@
timestamp_us);
SetInboundRTPStreamStatsFromMediaReceiverInfo(voice_receiver_info,
inbound_audio.get());
+ inbound_audio->mid = mid;
inbound_audio->media_type = "audio";
inbound_audio->kind = "audio";
if (voice_receiver_info.codec_payload_type) {
@@ -524,6 +525,7 @@
RTCInboundRTPStreamStats* inbound_video) {
SetInboundRTPStreamStatsFromMediaReceiverInfo(video_receiver_info,
inbound_video);
+ inbound_video->mid = mid;
inbound_video->media_type = "video";
inbound_video->kind = "video";
if (video_receiver_info.codec_payload_type) {
@@ -615,6 +617,7 @@
RTCOutboundRTPStreamStats* outbound_audio) {
SetOutboundRTPStreamStatsFromMediaSenderInfo(voice_sender_info,
outbound_audio);
+ outbound_audio->mid = mid;
outbound_audio->media_type = "audio";
outbound_audio->kind = "audio";
if (voice_sender_info.target_bitrate > 0) {
@@ -634,6 +637,7 @@
RTCOutboundRTPStreamStats* outbound_video) {
SetOutboundRTPStreamStatsFromMediaSenderInfo(video_sender_info,
outbound_video);
+ outbound_video->mid = mid;
outbound_video->media_type = "video";
outbound_video->kind = "video";
if (video_sender_info.codec_payload_type) {
diff --git a/pc/rtc_stats_collector_unittest.cc b/pc/rtc_stats_collector_unittest.cc
index 89d0daa..c008c1b 100644
--- a/pc/rtc_stats_collector_unittest.cc
+++ b/pc/rtc_stats_collector_unittest.cc
@@ -2099,6 +2099,7 @@
expected_audio.media_type = "audio";
expected_audio.kind = "audio";
expected_audio.track_identifier = "RemoteAudioTrackID";
+ expected_audio.mid = "AudioMid";
expected_audio.track_id = stats_of_track_type[0]->id();
expected_audio.transport_id = "RTCTransport_TransportName_1";
expected_audio.codec_id = "RTCCodec_AudioMid_Inbound_42";
@@ -2208,6 +2209,7 @@
expected_video.media_type = "video";
expected_video.kind = "video";
expected_video.track_identifier = "RemoteVideoTrackID";
+ expected_video.mid = "VideoMid";
expected_video.track_id = IdForType<RTCMediaStreamTrackStats>(report.get());
expected_video.transport_id = "RTCTransport_TransportName_1";
expected_video.codec_id = "RTCCodec_VideoMid_Inbound_42";
@@ -2300,6 +2302,7 @@
report->timestamp_us());
expected_audio.media_source_id = "RTCAudioSource_50";
// `expected_audio.remote_id` should be undefined.
+ expected_audio.mid = "AudioMid";
expected_audio.ssrc = 1;
expected_audio.media_type = "audio";
expected_audio.kind = "audio";
@@ -2387,6 +2390,7 @@
report->timestamp_us());
expected_video.media_source_id = "RTCVideoSource_50";
// `expected_video.remote_id` should be undefined.
+ expected_video.mid = "VideoMid";
expected_video.ssrc = 1;
expected_video.media_type = "video";
expected_video.kind = "video";
@@ -2728,6 +2732,7 @@
RTCOutboundRTPStreamStats expected_audio("RTCOutboundRTPAudioStream_1",
report->timestamp_us());
expected_audio.media_source_id = "RTCAudioSource_50";
+ expected_audio.mid = "AudioMid";
expected_audio.ssrc = 1;
expected_audio.media_type = "audio";
expected_audio.kind = "audio";
diff --git a/pc/rtc_stats_integrationtest.cc b/pc/rtc_stats_integrationtest.cc
index 6125137..a071786 100644
--- a/pc/rtc_stats_integrationtest.cc
+++ b/pc/rtc_stats_integrationtest.cc
@@ -799,6 +799,7 @@
*inbound_stream.media_type == "audio");
verifier.TestMemberIsOptionalIDReference(
inbound_stream.remote_id, RTCRemoteOutboundRtpStreamStats::kType);
+ verifier.TestMemberIsDefined(inbound_stream.mid);
verifier.TestMemberIsDefined(inbound_stream.track_identifier);
if (inbound_stream.kind.is_defined() &&
*inbound_stream.media_type == "video") {
@@ -926,6 +927,7 @@
const RTCOutboundRTPStreamStats& outbound_stream) {
RTCStatsVerifier verifier(report_.get(), &outbound_stream);
VerifyRTCRTPStreamStats(outbound_stream, verifier);
+ verifier.TestMemberIsDefined(outbound_stream.mid);
if (outbound_stream.kind.is_defined() &&
*outbound_stream.media_type == "video") {
verifier.TestMemberIsIDReference(outbound_stream.media_source_id,