Ensure that CCFB can be set when pr-answer is used.
Adds test
Bug: None
Change-Id: I7e01ab8a31d1620f4157e714490481c7337c69ad
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/413560
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45800}
diff --git a/pc/congestion_control_integrationtest.cc b/pc/congestion_control_integrationtest.cc
index cfde328..4eea57b 100644
--- a/pc/congestion_control_integrationtest.cc
+++ b/pc/congestion_control_integrationtest.cc
@@ -358,6 +358,40 @@
Eq(0));
}
+TEST_F(PeerConnectionCongestionControlTest, CcfbGetsUsedWithPrAnswer) {
+ SetFieldTrials("WebRTC-RFC8888CongestionControlFeedback/Enabled,offer:true/");
+ ASSERT_TRUE(CreatePeerConnectionWrappers());
+ ConnectFakeSignaling();
+ caller()->AddAudioVideoTracks();
+ callee()->SetGeneratedSdpMunger(
+ [](std::unique_ptr<SessionDescriptionInterface>& sdp) {
+ SetSdpType(sdp, SdpType::kPrAnswer);
+ });
+ caller()->CreateAndSetAndSignalOffer();
+ ASSERT_THAT(WaitUntil(
+ [&] {
+ return caller()->pc()->signaling_state() ==
+ PeerConnectionInterface::kHaveRemotePrAnswer;
+ },
+ IsTrue()),
+ IsRtcOk());
+ MediaExpectations media_expectations;
+ media_expectations.CalleeExpectsSomeAudio();
+ media_expectations.CalleeExpectsSomeVideo();
+ ASSERT_TRUE(ExpectNewFrames(media_expectations));
+ auto pc_internal = caller()->pc_internal();
+ EXPECT_THAT(
+ WaitUntil(
+ [&] {
+ return pc_internal->FeedbackAccordingToRfc8888CountForTesting();
+ },
+ Gt(0)),
+ IsRtcOk());
+ // There should be no transport-cc generated.
+ EXPECT_THAT(pc_internal->FeedbackAccordingToTransportCcCountForTesting(),
+ Eq(0));
+}
+
TEST_F(PeerConnectionCongestionControlTest, TransportCcGetsUsed) {
SetFieldTrials("WebRTC-RFC8888CongestionControlFeedback/Disabled/");
ASSERT_TRUE(CreatePeerConnectionWrappers());
diff --git a/pc/sdp_offer_answer.cc b/pc/sdp_offer_answer.cc
index d106e00..f572c1a 100644
--- a/pc/sdp_offer_answer.cc
+++ b/pc/sdp_offer_answer.cc
@@ -5099,8 +5099,8 @@
// If local and remote are both set, we assume that it's safe to trigger
// CCFB.
if (pc_->trials().IsEnabled("WebRTC-RFC8888CongestionControlFeedback")) {
- if (type == SdpType::kAnswer && local_description() &&
- remote_description()) {
+ if ((type == SdpType::kAnswer || type == SdpType::kPrAnswer) &&
+ local_description() && remote_description()) {
std::optional<RtcpFeedbackType> remote_preferred_rtcp_cc_ack_type;
// Verify that the remote agrees on congestion control feedback format.
for (const auto& content :