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}
This commit is contained in:
parent
a6c7d5c8ce
commit
1ab61886a9
@ -452,6 +452,7 @@ class RTC_EXPORT RTCInboundRTPStreamStats final
|
||||
// TODO(https://crbug.com/webrtc/14174): Implement trackIdentifier and kind.
|
||||
|
||||
RTCStatsMember<std::string> track_identifier;
|
||||
RTCStatsMember<std::string> mid;
|
||||
RTCStatsMember<std::string> remote_id;
|
||||
RTCStatsMember<uint32_t> packets_received;
|
||||
RTCStatsMember<uint64_t> fec_packets_received;
|
||||
@ -515,6 +516,7 @@ class RTC_EXPORT RTCOutboundRTPStreamStats final : public RTCRTPStreamStats {
|
||||
|
||||
RTCStatsMember<std::string> media_source_id;
|
||||
RTCStatsMember<std::string> remote_id;
|
||||
RTCStatsMember<std::string> mid;
|
||||
RTCStatsMember<std::string> rid;
|
||||
RTCStatsMember<uint32_t> packets_sent;
|
||||
RTCStatsMember<uint64_t> retransmitted_packets_sent;
|
||||
|
||||
@ -422,6 +422,7 @@ std::unique_ptr<RTCInboundRTPStreamStats> CreateInboundAudioStreamStats(
|
||||
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 @@ void SetInboundRTPStreamStatsFromVideoReceiverInfo(
|
||||
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 @@ void SetOutboundRTPStreamStatsFromVoiceSenderInfo(
|
||||
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 @@ void SetOutboundRTPStreamStatsFromVideoSenderInfo(
|
||||
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) {
|
||||
|
||||
@ -2099,6 +2099,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Audio) {
|
||||
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 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Video) {
|
||||
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 @@ TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Audio) {
|
||||
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 @@ TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Video) {
|
||||
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 @@ TEST_F(RTCStatsCollectorTest, CollectNoStreamRTCOutboundRTPStreamStats_Audio) {
|
||||
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";
|
||||
|
||||
@ -799,6 +799,7 @@ class RTCStatsReportVerifier {
|
||||
*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 @@ class RTCStatsReportVerifier {
|
||||
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,
|
||||
|
||||
@ -641,6 +641,7 @@ RTCSentRtpStreamStats::~RTCSentRtpStreamStats() {}
|
||||
WEBRTC_RTCSTATS_IMPL(
|
||||
RTCInboundRTPStreamStats, RTCReceivedRtpStreamStats, "inbound-rtp",
|
||||
&track_identifier,
|
||||
&mid,
|
||||
&remote_id,
|
||||
&packets_received,
|
||||
&fec_packets_received,
|
||||
@ -690,6 +691,7 @@ RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id,
|
||||
int64_t timestamp_us)
|
||||
: RTCReceivedRtpStreamStats(std::move(id), timestamp_us),
|
||||
track_identifier("trackIdentifier"),
|
||||
mid("mid"),
|
||||
remote_id("remoteId"),
|
||||
packets_received("packetsReceived"),
|
||||
fec_packets_received("fecPacketsReceived"),
|
||||
@ -735,6 +737,7 @@ RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
|
||||
const RTCInboundRTPStreamStats& other)
|
||||
: RTCReceivedRtpStreamStats(other),
|
||||
track_identifier(other.track_identifier),
|
||||
mid(other.mid),
|
||||
remote_id(other.remote_id),
|
||||
packets_received(other.packets_received),
|
||||
fec_packets_received(other.fec_packets_received),
|
||||
@ -784,6 +787,7 @@ WEBRTC_RTCSTATS_IMPL(
|
||||
RTCOutboundRTPStreamStats, RTCRTPStreamStats, "outbound-rtp",
|
||||
&media_source_id,
|
||||
&remote_id,
|
||||
&mid,
|
||||
&rid,
|
||||
&packets_sent,
|
||||
&retransmitted_packets_sent,
|
||||
@ -821,6 +825,7 @@ RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(std::string&& id,
|
||||
: RTCRTPStreamStats(std::move(id), timestamp_us),
|
||||
media_source_id("mediaSourceId"),
|
||||
remote_id("remoteId"),
|
||||
mid("mid"),
|
||||
rid("rid"),
|
||||
packets_sent("packetsSent"),
|
||||
retransmitted_packets_sent("retransmittedPacketsSent"),
|
||||
@ -854,6 +859,7 @@ RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
|
||||
: RTCRTPStreamStats(other),
|
||||
media_source_id(other.media_source_id),
|
||||
remote_id(other.remote_id),
|
||||
mid(other.mid),
|
||||
rid(other.rid),
|
||||
packets_sent(other.packets_sent),
|
||||
retransmitted_packets_sent(other.retransmitted_packets_sent),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user