[getStats] Make remote-inbound-rtp.ssrc match outbound-rtp.ssrc.

Per discussions at https://crbug.com/webrtc/10753, the
remote-outbound-rtp.ssrc is supposed to reflect the SSRC of the RTP
media stream (i.e. outbound-rtp.ssrc) and not the sender that the
corresponding RTCP report block was transmitted on.

Bug: webrtc:10753
Change-Id: Id88f5fdbe6397ba81a46f0ef430bd6f08e66b145
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/143484
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28354}
This commit is contained in:
Henrik Boström
2019-06-24 16:44:51 +02:00
committed by Commit Bot
parent 8f7b41afd8
commit 8605fbf6ec
2 changed files with 18 additions and 23 deletions

View File

@ -92,15 +92,14 @@ std::string RTCOutboundRTPStreamStatsIDFromSSRC(bool audio, uint32_t ssrc) {
return sb.str();
}
std::string RTCRemoteInboundRtpStreamStatsIdFromSsrcs(
std::string RTCRemoteInboundRtpStreamStatsIdFromSourceSsrc(
cricket::MediaType media_type,
uint32_t sender_ssrc,
uint32_t source_ssrc) {
char buf[1024];
rtc::SimpleStringBuilder sb(buf);
sb << "RTCRemoteInboundRtp"
<< (media_type == cricket::MEDIA_TYPE_AUDIO ? "Audio" : "Video")
<< "Stream_" << sender_ssrc << "_" << source_ssrc;
<< "Stream_" << source_ssrc;
return sb.str();
}
@ -408,10 +407,10 @@ ProduceRemoteInboundRtpStreamStatsFromReportBlockData(
// for "remote-[outbound/inbound]-rtp" it refers to the local time when the
// Report Block was received.
auto remote_inbound = absl::make_unique<RTCRemoteInboundRtpStreamStats>(
RTCRemoteInboundRtpStreamStatsIdFromSsrcs(
media_type, report_block.sender_ssrc, report_block.source_ssrc),
RTCRemoteInboundRtpStreamStatsIdFromSourceSsrc(media_type,
report_block.source_ssrc),
/*timestamp=*/report_block_data.report_block_timestamp_utc_us());
remote_inbound->ssrc = report_block.sender_ssrc;
remote_inbound->ssrc = report_block.source_ssrc;
remote_inbound->kind =
media_type == cricket::MEDIA_TYPE_AUDIO ? "audio" : "video";
remote_inbound->packets_lost = report_block.packets_lost;

View File

@ -2450,9 +2450,8 @@ TEST_P(RTCStatsCollectorTestWithParamKind,
fake_clock_.SetTime(Timestamp::us(kReportBlockTimestampUtcUs));
RTCPReportBlock report_block;
// The remote-inbound-rtp SSRC, "SSRC of sender of this report".
report_block.sender_ssrc = 8;
// The outbound-rtp SSRC, "SSRC of the RTP packet sender".
// The remote-inbound-rtp SSRC and the outbound-rtp SSRC is the same as the
// |source_ssrc|, "SSRC of the RTP packet sender".
report_block.source_ssrc = 12;
report_block.packets_lost = 7;
ReportBlockData report_block_data;
@ -2468,9 +2467,9 @@ TEST_P(RTCStatsCollectorTestWithParamKind,
rtc::scoped_refptr<const RTCStatsReport> report = stats_->GetStatsReport();
RTCRemoteInboundRtpStreamStats expected_remote_inbound_rtp(
"RTCRemoteInboundRtp" + MediaTypeUpperCase() + "Stream_8_12",
"RTCRemoteInboundRtp" + MediaTypeUpperCase() + "Stream_12",
kReportBlockTimestampUtcUs);
expected_remote_inbound_rtp.ssrc = 8;
expected_remote_inbound_rtp.ssrc = 12;
expected_remote_inbound_rtp.kind = MediaTypeLowerCase();
expected_remote_inbound_rtp.transport_id =
"RTCTransport_TransportName_1"; // 1 for RTP (we have no RTCP transport)
@ -2495,9 +2494,8 @@ TEST_P(RTCStatsCollectorTestWithParamKind,
fake_clock_.SetTime(Timestamp::us(kReportBlockTimestampUtcUs));
RTCPReportBlock report_block;
// The remote-inbound-rtp SSRC, "SSRC of sender of this report".
report_block.sender_ssrc = 8;
// The outbound-rtp SSRC, "SSRC of the RTP packet sender".
// The remote-inbound-rtp SSRC and the outbound-rtp SSRC is the same as the
// |source_ssrc|, "SSRC of the RTP packet sender".
report_block.source_ssrc = 12;
ReportBlockData report_block_data;
report_block_data.SetReportBlock(report_block, kReportBlockTimestampUtcUs);
@ -2511,7 +2509,7 @@ TEST_P(RTCStatsCollectorTestWithParamKind,
rtc::scoped_refptr<const RTCStatsReport> report = stats_->GetStatsReport();
std::string remote_inbound_rtp_id =
"RTCRemoteInboundRtp" + MediaTypeUpperCase() + "Stream_8_12";
"RTCRemoteInboundRtp" + MediaTypeUpperCase() + "Stream_12";
ASSERT_TRUE(report->Get(remote_inbound_rtp_id));
auto& remote_inbound_rtp = report->Get(remote_inbound_rtp_id)
->cast_to<RTCRemoteInboundRtpStreamStats>();
@ -2528,9 +2526,8 @@ TEST_P(RTCStatsCollectorTestWithParamKind,
fake_clock_.SetTime(Timestamp::us(kReportBlockTimestampUtcUs));
RTCPReportBlock report_block;
// The remote-inbound-rtp SSRC, "SSRC of sender of this report".
report_block.sender_ssrc = 8;
// The outbound-rtp SSRC, "SSRC of the RTP packet sender".
// The remote-inbound-rtp SSRC and the outbound-rtp SSRC is the same as the
// |source_ssrc|, "SSRC of the RTP packet sender".
report_block.source_ssrc = 12;
report_block.jitter = 5000;
ReportBlockData report_block_data;
@ -2546,7 +2543,7 @@ TEST_P(RTCStatsCollectorTestWithParamKind,
rtc::scoped_refptr<const RTCStatsReport> report = stats_->GetStatsReport();
std::string remote_inbound_rtp_id =
"RTCRemoteInboundRtp" + MediaTypeUpperCase() + "Stream_8_12";
"RTCRemoteInboundRtp" + MediaTypeUpperCase() + "Stream_12";
ASSERT_TRUE(report->Get(remote_inbound_rtp_id));
auto& remote_inbound_rtp = report->Get(remote_inbound_rtp_id)
->cast_to<RTCRemoteInboundRtpStreamStats>();
@ -2566,9 +2563,8 @@ TEST_P(RTCStatsCollectorTestWithParamKind,
fake_clock_.SetTime(Timestamp::us(kReportBlockTimestampUtcUs));
RTCPReportBlock report_block;
// The remote-inbound-rtp SSRC, "SSRC of sender of this report".
report_block.sender_ssrc = 8;
// The outbound-rtp SSRC, "SSRC of the RTP packet sender".
// The remote-inbound-rtp SSRC and the outbound-rtp SSRC is the same as the
// |source_ssrc|, "SSRC of the RTP packet sender".
report_block.source_ssrc = 12;
ReportBlockData report_block_data;
report_block_data.SetReportBlock(report_block, kReportBlockTimestampUtcUs);
@ -2588,7 +2584,7 @@ TEST_P(RTCStatsCollectorTestWithParamKind,
rtc::scoped_refptr<const RTCStatsReport> report = stats_->GetStatsReport();
std::string remote_inbound_rtp_id =
"RTCRemoteInboundRtp" + MediaTypeUpperCase() + "Stream_8_12";
"RTCRemoteInboundRtp" + MediaTypeUpperCase() + "Stream_12";
ASSERT_TRUE(report->Get(remote_inbound_rtp_id));
auto& remote_inbound_rtp = report->Get(remote_inbound_rtp_id)
->cast_to<RTCRemoteInboundRtpStreamStats>();