Add generation of CCFB in answer (RFC8888 support)

Note: This still doesn't enable CCFB - it just completes the signalling.

Bug: webrtc:42225697
Change-Id: I2dfd346075f2adcc438588f592c8f735f4101c89
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/367260
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43348}
This commit is contained in:
Harald Alvestrand 2024-11-01 13:13:57 +00:00 committed by WebRTC LUCI CQ
parent 037ab2627d
commit 9317a307e1
4 changed files with 41 additions and 2 deletions

View File

@ -1326,6 +1326,7 @@ rtc_source_set("webrtc_sdp") {
"../rtc_base:logging",
"../rtc_base:macromagic",
"../rtc_base:net_helper",
"../rtc_base:net_helpers",
"../rtc_base:network_constants",
"../rtc_base:socket_address",
"../rtc_base:ssl",

View File

@ -16,6 +16,7 @@
#include "absl/strings/str_cat.h"
#include "api/peer_connection_interface.h"
#include "pc/test/integration_test_helpers.h"
#include "rtc_base/gunit.h"
#include "test/field_trial.h"
#include "test/gmock.h"
#include "test/gtest.h"
@ -41,4 +42,28 @@ TEST_F(PeerConnectionCongestionControlTest, OfferContainsCcfbIfEnabled) {
EXPECT_THAT(offer_str, HasSubstr("a=rtcp-fb:* ack ccfb\r\n"));
}
TEST_F(PeerConnectionCongestionControlTest, ReceiveOfferSetsCcfbFlag) {
test::ScopedFieldTrials trials(
"WebRTC-RFC8888CongestionControlFeedback/Enabled/");
ASSERT_TRUE(CreatePeerConnectionWrappers());
ConnectFakeSignalingForSdpOnly();
caller()->AddAudioVideoTracks();
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
// Check that the callee parsed it.
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 also parsed it.
parsed_contents =
caller()->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());
}
}
} // namespace webrtc

View File

@ -2169,6 +2169,15 @@ RTCError MediaSessionDescriptionFactory::AddRtpContentForAnswer(
LOG_AND_RETURN_ERROR(RTCErrorType::INTERNAL_ERROR,
"Failed to set codecs in answer");
}
// RFC 8888 support. Only answer with "ack ccfb" if offer has it and
// experiment is enabled.
// TODO: https://issues.webrtc.org/42225697 - disable transport-cc
// when ccfb is negotiated.
if (offer_content_description->rtcp_fb_ack_ccfb()) {
answer_content->set_rtcp_fb_ack_ccfb(
transport_desc_factory_->trials().IsEnabled(
"WebRTC-RFC8888CongestionControlFeedback"));
}
if (!CreateMediaContentAnswer(
offer_content_description, media_description_options, session_options,
filtered_rtp_header_extensions(header_extensions), ssrc_generator(),

View File

@ -21,7 +21,6 @@
#include <optional>
#include <set>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <utility>
#include <vector>
@ -31,6 +30,7 @@
#include "absl/strings/match.h"
#include "absl/strings/string_view.h"
#include "api/candidate.h"
#include "api/jsep.h"
#include "api/jsep_ice_candidate.h"
#include "api/jsep_session_description.h"
#include "api/media_types.h"
@ -61,11 +61,11 @@
#include "rtc_base/ip_address.h"
#include "rtc_base/logging.h"
#include "rtc_base/net_helper.h"
#include "rtc_base/net_helpers.h"
#include "rtc_base/network_constants.h"
#include "rtc_base/socket_address.h"
#include "rtc_base/ssl_fingerprint.h"
#include "rtc_base/string_encode.h"
#include "rtc_base/string_utils.h"
#include "rtc_base/strings/string_builder.h"
using cricket::AudioContentDescription;
@ -3013,6 +3013,10 @@ void UpdateFromWildcardCodecs(cricket::MediaContentDescription* desc) {
for (auto& codec : codecs) {
AddFeedbackParameters(wildcard_codec->feedback_params, &codec);
}
// Special treatment for transport-wide feedback params.
if (wildcard_codec->feedback_params.Has({"ack", "ccfb"})) {
desc->set_rtcp_fb_ack_ccfb(true);
}
desc->set_codecs(codecs);
}