webrtc/video/end_to_end_tests/config_tests.cc
Per K 217b384c1b Remove rtp header extension from config of Call audio and video receivers
These configurations are no longer used by call. Header extensions are identified once when demuxing packets in WebrtcVideoEngine::OnPacketReceived and WebrtcVoiceEngine::OnPacketReceived.

Change-Id: I49de9005f0aa9ab32f2c5d3abcdd8bd12343022d
Bug: webrtc:7135
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291480
Owners-Override: Per Kjellander <perkj@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39236}
2023-01-31 11:58:43 +00:00

111 lines
4.8 KiB
C++

/*
* Copyright 2018 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include <map>
#include <vector>
#include "api/crypto/crypto_options.h"
#include "api/rtp_headers.h"
#include "call/flexfec_receive_stream.h"
#include "call/rtp_config.h"
#include "call/video_receive_stream.h"
#include "call/video_send_stream.h"
#include "test/call_test.h"
#include "test/gtest.h"
#include "test/null_transport.h"
namespace webrtc {
class ConfigEndToEndTest : public test::CallTest {};
namespace {
void VerifyEmptyNackConfig(const NackConfig& config) {
EXPECT_EQ(0, config.rtp_history_ms)
<< "Enabling NACK requires rtcp-fb: nack negotiation.";
}
void VerifyEmptyUlpfecConfig(const UlpfecConfig& config) {
EXPECT_EQ(-1, config.ulpfec_payload_type)
<< "Enabling ULPFEC requires rtpmap: ulpfec negotiation.";
EXPECT_EQ(-1, config.red_payload_type)
<< "Enabling ULPFEC requires rtpmap: red negotiation.";
EXPECT_EQ(-1, config.red_rtx_payload_type)
<< "Enabling RTX in ULPFEC requires rtpmap: rtx negotiation.";
}
void VerifyEmptyFlexfecConfig(const RtpConfig::Flexfec& config) {
EXPECT_EQ(-1, config.payload_type)
<< "Enabling FlexFEC requires rtpmap: flexfec negotiation.";
EXPECT_EQ(0U, config.ssrc)
<< "Enabling FlexFEC requires ssrc-group: FEC-FR negotiation.";
EXPECT_TRUE(config.protected_media_ssrcs.empty())
<< "Enabling FlexFEC requires ssrc-group: FEC-FR negotiation.";
}
} // namespace
TEST_F(ConfigEndToEndTest, VerifyDefaultSendConfigParameters) {
VideoSendStream::Config default_send_config(nullptr);
EXPECT_FALSE(default_send_config.rtp.lntf.enabled)
<< "Enabling LNTF require rtcp-fb: goog-lntf negotiation.";
EXPECT_EQ(0, default_send_config.rtp.nack.rtp_history_ms)
<< "Enabling NACK require rtcp-fb: nack negotiation.";
EXPECT_TRUE(default_send_config.rtp.rtx.ssrcs.empty())
<< "Enabling RTX requires rtpmap: rtx negotiation.";
EXPECT_TRUE(default_send_config.rtp.extensions.empty())
<< "Enabling RTP extensions require negotiation.";
EXPECT_EQ(nullptr, default_send_config.frame_encryptor)
<< "Enabling Frame Encryption requires a frame encryptor to be attached";
EXPECT_FALSE(
default_send_config.crypto_options.sframe.require_frame_encryption)
<< "Enabling Require Frame Encryption means an encryptor must be "
"attached";
VerifyEmptyNackConfig(default_send_config.rtp.nack);
VerifyEmptyUlpfecConfig(default_send_config.rtp.ulpfec);
VerifyEmptyFlexfecConfig(default_send_config.rtp.flexfec);
}
TEST_F(ConfigEndToEndTest, VerifyDefaultVideoReceiveConfigParameters) {
VideoReceiveStreamInterface::Config default_receive_config(nullptr);
EXPECT_EQ(RtcpMode::kCompound, default_receive_config.rtp.rtcp_mode)
<< "Reduced-size RTCP require rtcp-rsize to be negotiated.";
EXPECT_FALSE(default_receive_config.rtp.lntf.enabled)
<< "Enabling LNTF require rtcp-fb: goog-lntf negotiation.";
EXPECT_FALSE(
default_receive_config.rtp.rtcp_xr.receiver_reference_time_report)
<< "RTCP XR settings require rtcp-xr to be negotiated.";
EXPECT_EQ(0U, default_receive_config.rtp.rtx_ssrc)
<< "Enabling RTX requires ssrc-group: FID negotiation";
EXPECT_TRUE(default_receive_config.rtp.rtx_associated_payload_types.empty())
<< "Enabling RTX requires rtpmap: rtx negotiation.";
VerifyEmptyNackConfig(default_receive_config.rtp.nack);
EXPECT_EQ(-1, default_receive_config.rtp.ulpfec_payload_type)
<< "Enabling ULPFEC requires rtpmap: ulpfec negotiation.";
EXPECT_EQ(-1, default_receive_config.rtp.red_payload_type)
<< "Enabling ULPFEC requires rtpmap: red negotiation.";
EXPECT_EQ(nullptr, default_receive_config.frame_decryptor)
<< "Enabling Frame Decryption requires a frame decryptor to be attached";
EXPECT_FALSE(
default_receive_config.crypto_options.sframe.require_frame_encryption)
<< "Enabling Require Frame Encryption means a decryptor must be attached";
}
TEST_F(ConfigEndToEndTest, VerifyDefaultFlexfecReceiveConfigParameters) {
test::NullTransport rtcp_send_transport;
FlexfecReceiveStream::Config default_receive_config(&rtcp_send_transport);
EXPECT_EQ(-1, default_receive_config.payload_type)
<< "Enabling FlexFEC requires rtpmap: flexfec negotiation.";
EXPECT_EQ(0U, default_receive_config.rtp.remote_ssrc)
<< "Enabling FlexFEC requires ssrc-group: FEC-FR negotiation.";
EXPECT_TRUE(default_receive_config.protected_media_ssrcs.empty())
<< "Enabling FlexFEC requires ssrc-group: FEC-FR negotiation.";
}
} // namespace webrtc