Implement RTCInboundRtpStreamStats.trackIdentifier.
This should allow standard stats users not to have to rely on the obsolete "track" stats. Bug: webrtc:14174 Change-Id: I24e5e1478ee47c73c12fcdecf7314f41fcc76bc7 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/266020 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#37246}
This commit is contained in:
parent
b670774435
commit
a6c7d5c8ce
@ -451,6 +451,7 @@ class RTC_EXPORT RTCInboundRTPStreamStats final
|
||||
|
||||
// TODO(https://crbug.com/webrtc/14174): Implement trackIdentifier and kind.
|
||||
|
||||
RTCStatsMember<std::string> track_identifier;
|
||||
RTCStatsMember<std::string> remote_id;
|
||||
RTCStatsMember<uint32_t> packets_received;
|
||||
RTCStatsMember<uint64_t> fec_packets_received;
|
||||
|
||||
@ -1949,6 +1949,7 @@ void RTCStatsCollector::ProduceAudioRTPStreamStats_n(
|
||||
kReceiver,
|
||||
track_media_info_map.GetAttachmentIdByTrack(audio_track.get())
|
||||
.value());
|
||||
inbound_audio->track_identifier = audio_track->id();
|
||||
}
|
||||
inbound_audio->transport_id = transport_id;
|
||||
// Remote-outbound.
|
||||
@ -2043,10 +2044,10 @@ void RTCStatsCollector::ProduceVideoRTPStreamStats_n(
|
||||
kReceiver,
|
||||
track_media_info_map.GetAttachmentIdByTrack(video_track.get())
|
||||
.value());
|
||||
inbound_video->track_identifier = video_track->id();
|
||||
}
|
||||
inbound_video->transport_id = transport_id;
|
||||
report->AddStats(std::move(inbound_video));
|
||||
// TODO(crbug.com/webrtc/12529): Add remote-outbound stats.
|
||||
}
|
||||
// Outbound
|
||||
std::map<std::string, RTCOutboundRTPStreamStats*> video_outbound_rtps;
|
||||
|
||||
@ -2098,6 +2098,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Audio) {
|
||||
expected_audio.ssrc = 1;
|
||||
expected_audio.media_type = "audio";
|
||||
expected_audio.kind = "audio";
|
||||
expected_audio.track_identifier = "RemoteAudioTrackID";
|
||||
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";
|
||||
@ -2206,6 +2207,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Video) {
|
||||
expected_video.ssrc = 1;
|
||||
expected_video.media_type = "video";
|
||||
expected_video.kind = "video";
|
||||
expected_video.track_identifier = "RemoteVideoTrackID";
|
||||
expected_video.track_id = IdForType<RTCMediaStreamTrackStats>(report.get());
|
||||
expected_video.transport_id = "RTCTransport_TransportName_1";
|
||||
expected_video.codec_id = "RTCCodec_VideoMid_Inbound_42";
|
||||
|
||||
@ -799,6 +799,7 @@ class RTCStatsReportVerifier {
|
||||
*inbound_stream.media_type == "audio");
|
||||
verifier.TestMemberIsOptionalIDReference(
|
||||
inbound_stream.remote_id, RTCRemoteOutboundRtpStreamStats::kType);
|
||||
verifier.TestMemberIsDefined(inbound_stream.track_identifier);
|
||||
if (inbound_stream.kind.is_defined() &&
|
||||
*inbound_stream.media_type == "video") {
|
||||
verifier.TestMemberIsNonNegative<uint64_t>(inbound_stream.qp_sum);
|
||||
|
||||
@ -640,6 +640,7 @@ RTCSentRtpStreamStats::~RTCSentRtpStreamStats() {}
|
||||
// clang-format off
|
||||
WEBRTC_RTCSTATS_IMPL(
|
||||
RTCInboundRTPStreamStats, RTCReceivedRtpStreamStats, "inbound-rtp",
|
||||
&track_identifier,
|
||||
&remote_id,
|
||||
&packets_received,
|
||||
&fec_packets_received,
|
||||
@ -688,6 +689,7 @@ RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(const std::string& id,
|
||||
RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id,
|
||||
int64_t timestamp_us)
|
||||
: RTCReceivedRtpStreamStats(std::move(id), timestamp_us),
|
||||
track_identifier("trackIdentifier"),
|
||||
remote_id("remoteId"),
|
||||
packets_received("packetsReceived"),
|
||||
fec_packets_received("fecPacketsReceived"),
|
||||
@ -732,6 +734,7 @@ RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id,
|
||||
RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
|
||||
const RTCInboundRTPStreamStats& other)
|
||||
: RTCReceivedRtpStreamStats(other),
|
||||
track_identifier(other.track_identifier),
|
||||
remote_id(other.remote_id),
|
||||
packets_received(other.packets_received),
|
||||
fec_packets_received(other.fec_packets_received),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user