Don't delete transport-cc if ccfb is disabled.

This issue would trigger if CCFB was enabled on the sender side
but not on the receiver side.

Bug: webrtc:436463596
Change-Id: Ia624d1a50934a0a4fe6273493adee8a241072fdc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/403260
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45288}
diff --git a/pc/congestion_control_integrationtest.cc b/pc/congestion_control_integrationtest.cc
index 0851bca..e93151c 100644
--- a/pc/congestion_control_integrationtest.cc
+++ b/pc/congestion_control_integrationtest.cc
@@ -85,6 +85,42 @@
   EXPECT_THAT(answer_str, Not(HasSubstr("transport-cc")));
 }
 
+TEST_F(PeerConnectionCongestionControlTest, SendOnlySupportDoesNotEnableCcFb) {
+  // Enable CCFB for sender, do not enable it for receiver
+  SetFieldTrials(kCallerName,
+                 "WebRTC-RFC8888CongestionControlFeedback/Enabled/");
+  SetFieldTrials(kCalleeName,
+                 "WebRTC-RFC8888CongestionControlFeedback/Disabled/");
+  ASSERT_TRUE(CreatePeerConnectionWrappers());
+  ConnectFakeSignalingForSdpOnly();
+  caller()->AddAudioVideoTracks();
+  caller()->CreateAndSetAndSignalOffer();
+  ASSERT_THAT(WaitUntil([&] { return SignalingStateStable(); }, IsTrue()),
+              IsRtcOk());
+  {
+    // Check that the callee parsed the CCFB
+    auto parsed_contents =
+        callee()->pc()->remote_description()->description()->contents();
+    EXPECT_FALSE(parsed_contents.empty());
+    for (const auto& content : parsed_contents) {
+      EXPECT_TRUE(content.media_description()->rtcp_fb_ack_ccfb());
+    }
+  }
+
+  {
+    // Check that the caller did NOT get ccfb in response
+    auto parsed_contents =
+        caller()->pc()->remote_description()->description()->contents();
+    EXPECT_FALSE(parsed_contents.empty());
+    for (const auto& content : parsed_contents) {
+      EXPECT_FALSE(content.media_description()->rtcp_fb_ack_ccfb());
+    }
+  }
+  // Check that the answer does contain transport-cc
+  std::string answer_str = absl::StrCat(*caller()->pc()->remote_description());
+  EXPECT_THAT(answer_str, HasSubstr("transport-cc"));
+}
+
 TEST_F(PeerConnectionCongestionControlTest, NegotiatingCcfbRemovesTsn) {
   SetFieldTrials("WebRTC-RFC8888CongestionControlFeedback/Enabled/");
   ASSERT_TRUE(CreatePeerConnectionWrappers());
diff --git a/pc/media_session.cc b/pc/media_session.cc
index 38dcebe..a0d2543 100644
--- a/pc/media_session.cc
+++ b/pc/media_session.cc
@@ -1341,11 +1341,13 @@
   // RFC 8888 support. Only answer with "ack ccfb" if offer has it and
   // experiment is enabled.
   if (offer_content_description->rtcp_fb_ack_ccfb()) {
-    answer_content->set_rtcp_fb_ack_ccfb(
-        transport_desc_factory_->trials().IsEnabled(
-            "WebRTC-RFC8888CongestionControlFeedback"));
-    for (auto& codec : codecs_to_include) {
-      codec.feedback_params.Remove(FeedbackParam(kRtcpFbParamTransportCc));
+    bool use_ccfb = transport_desc_factory_->trials().IsEnabled(
+        "WebRTC-RFC8888CongestionControlFeedback");
+    if (use_ccfb) {
+      answer_content->set_rtcp_fb_ack_ccfb(use_ccfb);
+      for (auto& codec : codecs_to_include) {
+        codec.feedback_params.Remove(FeedbackParam(kRtcpFbParamTransportCc));
+      }
     }
   }
   if (!SetCodecsInAnswer(offer_content_description, codecs_to_include,