stats: ensure rtx ssrc is associated with primary ssrc

BUG=webrtc:15529

Change-Id: I3623eede7fc7890677516d78f3ef7a89a287eb8a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/322221
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40873}
This commit is contained in:
Philipp Hancke 2023-10-04 16:20:05 +02:00 committed by WebRTC LUCI CQ
parent 3af8bfb34a
commit 13b5eb7c47
2 changed files with 43 additions and 1 deletions

View File

@ -924,6 +924,47 @@ TEST_F(PeerConnectionEncodingsIntegrationTest, VP9_TargetBitrate_StandardL1T3) {
EXPECT_LE(target_bitrate.kbps(), kVp9ExpectedMaxBitrateForL1T3.kbps());
}
TEST_F(PeerConnectionEncodingsIntegrationTest,
SimulcastProducesUniqueSsrcAndRtxSsrcs) {
rtc::scoped_refptr<PeerConnectionTestWrapper> local_pc_wrapper = CreatePc();
rtc::scoped_refptr<PeerConnectionTestWrapper> remote_pc_wrapper = CreatePc();
ExchangeIceCandidates(local_pc_wrapper, remote_pc_wrapper);
std::vector<cricket::SimulcastLayer> layers =
CreateLayers({"f", "h", "q"}, /*active=*/true);
rtc::scoped_refptr<RtpTransceiverInterface> transceiver =
AddTransceiverWithSimulcastLayers(local_pc_wrapper, remote_pc_wrapper,
layers);
std::vector<RtpCodecCapability> codecs =
GetCapabilitiesAndRestrictToCodec(local_pc_wrapper, "VP8");
transceiver->SetCodecPreferences(codecs);
NegotiateWithSimulcastTweaks(local_pc_wrapper, remote_pc_wrapper);
local_pc_wrapper->WaitForConnection();
remote_pc_wrapper->WaitForConnection();
// Wait until media is flowing on all three layers.
// Ramp up time is needed before all three layers are sending.
ASSERT_TRUE_WAIT(HasOutboundRtpBytesSent(local_pc_wrapper, 3u),
kLongTimeoutForRampingUp.ms());
// Verify SSRCs and RTX SSRCs.
rtc::scoped_refptr<const RTCStatsReport> report = GetStats(local_pc_wrapper);
std::vector<const RTCOutboundRtpStreamStats*> outbound_rtps =
report->GetStatsOfType<RTCOutboundRtpStreamStats>();
ASSERT_THAT(outbound_rtps, SizeIs(3u));
std::set<uint32_t> ssrcs;
std::set<uint32_t> rtx_ssrcs;
for (const auto& outbound_rtp : outbound_rtps) {
ASSERT_TRUE(outbound_rtp->ssrc.has_value());
ASSERT_TRUE(outbound_rtp->rtx_ssrc.has_value());
ssrcs.insert(*outbound_rtp->ssrc);
rtx_ssrcs.insert(*outbound_rtp->rtx_ssrc);
}
EXPECT_EQ(ssrcs.size(), 3u);
EXPECT_EQ(rtx_ssrcs.size(), 3u);
}
TEST_F(PeerConnectionEncodingsIntegrationTest,
EncodingParameterCodecIsEmptyWhenCreatedAudio) {
rtc::scoped_refptr<PeerConnectionTestWrapper> local_pc_wrapper = CreatePc();

View File

@ -839,7 +839,8 @@ CreateOutboundRTPStreamStatsFromVideoSenderInfo(
}
for (const auto& ssrc_group : video_sender_info.ssrc_groups) {
if (ssrc_group.semantics == cricket::kFidSsrcGroupSemantics &&
ssrc_group.ssrcs.size() == 2) {
ssrc_group.ssrcs.size() == 2 &&
video_sender_info.ssrc() == ssrc_group.ssrcs[0]) {
outbound_video->rtx_ssrc = ssrc_group.ssrcs[1];
}
}