Update video tests to clear network interface pointer consistently.
This is related to upcoming changes whereby it will be enforced that calls to SetInterface(<valid ptr>) and SetInterface(nullptr) be matched up correctly. Bug: webrtc:11993 Change-Id: Ic022f9487a7ab297adaced8e620e2384e055673b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217241 Commit-Queue: Tommi <tommi@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33903}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
788d805c38
commit
02e079ff80
@ -1417,6 +1417,10 @@ class WebRtcVideoChannelEncodedFrameCallbackTest : public ::testing::Test {
|
||||
channel_->SetRecvParameters(parameters);
|
||||
}
|
||||
|
||||
~WebRtcVideoChannelEncodedFrameCallbackTest() override {
|
||||
channel_->SetInterface(nullptr);
|
||||
}
|
||||
|
||||
void DeliverKeyFrame(uint32_t ssrc) {
|
||||
webrtc::RtpPacket packet;
|
||||
packet.SetMarker(true);
|
||||
@ -1544,7 +1548,7 @@ class WebRtcVideoChannelBaseTest : public ::testing::Test {
|
||||
webrtc::CreateBuiltinVideoDecoderFactory(),
|
||||
field_trials_) {}
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
// One testcase calls SetUp in a loop, only create call_ once.
|
||||
if (!call_) {
|
||||
webrtc::Call::Config call_config(&event_log_);
|
||||
@ -1586,6 +1590,7 @@ class WebRtcVideoChannelBaseTest : public ::testing::Test {
|
||||
// Make the second renderer available for use by a new stream.
|
||||
EXPECT_TRUE(channel_->SetSink(kSsrc + 2, &renderer2_));
|
||||
}
|
||||
|
||||
// Setup an additional stream just to send video. Defer add recv stream.
|
||||
// This is required if you want to test unsignalled recv of video rtp packets.
|
||||
void SetUpSecondStreamWithNoRecv() {
|
||||
@ -1604,7 +1609,17 @@ class WebRtcVideoChannelBaseTest : public ::testing::Test {
|
||||
EXPECT_TRUE(
|
||||
channel_->SetVideoSend(kSsrc + 2, nullptr, frame_forwarder_2_.get()));
|
||||
}
|
||||
virtual void TearDown() { channel_.reset(); }
|
||||
|
||||
void TearDown() override {
|
||||
channel_->SetInterface(nullptr);
|
||||
channel_.reset();
|
||||
}
|
||||
|
||||
void ResetTest() {
|
||||
TearDown();
|
||||
SetUp();
|
||||
}
|
||||
|
||||
bool SetDefaultCodec() { return SetOneCodec(DefaultCodec()); }
|
||||
|
||||
bool SetOneCodec(const cricket::VideoCodec& codec) {
|
||||
@ -1788,7 +1803,7 @@ TEST_F(WebRtcVideoChannelBaseTest, OverridesRecvBufferSize) {
|
||||
const int kCustomRecvBufferSize = 123456;
|
||||
webrtc::test::ScopedFieldTrials field_trial(
|
||||
"WebRTC-IncreasedReceivebuffers/123456/");
|
||||
SetUp();
|
||||
ResetTest();
|
||||
|
||||
EXPECT_TRUE(SetOneCodec(DefaultCodec()));
|
||||
EXPECT_TRUE(SetSend(true));
|
||||
@ -1804,7 +1819,7 @@ TEST_F(WebRtcVideoChannelBaseTest, OverridesRecvBufferSizeWithSuffix) {
|
||||
const int kCustomRecvBufferSize = 123456;
|
||||
webrtc::test::ScopedFieldTrials field_trial(
|
||||
"WebRTC-IncreasedReceivebuffers/123456_Dogfood/");
|
||||
SetUp();
|
||||
ResetTest();
|
||||
|
||||
EXPECT_TRUE(SetOneCodec(DefaultCodec()));
|
||||
EXPECT_TRUE(SetSend(true));
|
||||
@ -1824,7 +1839,7 @@ TEST_F(WebRtcVideoChannelBaseTest, InvalidRecvBufferSize) {
|
||||
field_trial_string += group;
|
||||
field_trial_string += "/";
|
||||
webrtc::test::ScopedFieldTrials field_trial(field_trial_string);
|
||||
SetUp();
|
||||
ResetTest();
|
||||
|
||||
EXPECT_TRUE(SetOneCodec(DefaultCodec()));
|
||||
EXPECT_TRUE(SetSend(true));
|
||||
@ -1835,8 +1850,6 @@ TEST_F(WebRtcVideoChannelBaseTest, InvalidRecvBufferSize) {
|
||||
|
||||
// Test that stats work properly for a 1-1 call.
|
||||
TEST_F(WebRtcVideoChannelBaseTest, GetStats) {
|
||||
SetUp();
|
||||
|
||||
const int kDurationSec = 3;
|
||||
const int kFps = 10;
|
||||
SendReceiveManyAndGetStats(DefaultCodec(), kDurationSec, kFps);
|
||||
@ -1893,8 +1906,6 @@ TEST_F(WebRtcVideoChannelBaseTest, GetStats) {
|
||||
|
||||
// Test that stats work properly for a conf call with multiple recv streams.
|
||||
TEST_F(WebRtcVideoChannelBaseTest, GetStatsMultipleRecvStreams) {
|
||||
SetUp();
|
||||
|
||||
cricket::FakeVideoRenderer renderer1, renderer2;
|
||||
EXPECT_TRUE(SetOneCodec(DefaultCodec()));
|
||||
cricket::VideoSendParameters parameters;
|
||||
@ -2513,6 +2524,16 @@ class WebRtcVideoChannelTest : public WebRtcVideoEngineTest {
|
||||
ASSERT_TRUE(channel_->SetSendParameters(send_parameters_));
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
channel_->SetInterface(nullptr);
|
||||
channel_ = nullptr;
|
||||
}
|
||||
|
||||
void ResetTest() {
|
||||
TearDown();
|
||||
SetUp();
|
||||
}
|
||||
|
||||
cricket::VideoCodec GetEngineCodec(const std::string& name) {
|
||||
for (const cricket::VideoCodec& engine_codec : engine_.send_codecs()) {
|
||||
if (absl::EqualsIgnoreCase(name, engine_codec.name))
|
||||
@ -3165,7 +3186,7 @@ TEST_F(WebRtcVideoChannelTest, LossNotificationIsEnabledByFieldTrial) {
|
||||
RTC_DCHECK(!override_field_trials_);
|
||||
override_field_trials_ = std::make_unique<webrtc::test::ScopedFieldTrials>(
|
||||
"WebRTC-RtcpLossNotification/Enabled/");
|
||||
SetUp();
|
||||
ResetTest();
|
||||
TestLossNotificationState(true);
|
||||
}
|
||||
|
||||
@ -3173,7 +3194,7 @@ TEST_F(WebRtcVideoChannelTest, LossNotificationCanBeEnabledAndDisabled) {
|
||||
RTC_DCHECK(!override_field_trials_);
|
||||
override_field_trials_ = std::make_unique<webrtc::test::ScopedFieldTrials>(
|
||||
"WebRTC-RtcpLossNotification/Enabled/");
|
||||
SetUp();
|
||||
ResetTest();
|
||||
|
||||
AssignDefaultCodec();
|
||||
VerifyCodecHasDefaultFeedbackParams(default_codec_, true);
|
||||
@ -5248,6 +5269,7 @@ TEST_F(WebRtcVideoChannelTest, TestSetDscpOptions) {
|
||||
channel->SetInterface(network_interface.get());
|
||||
// Default value when DSCP is disabled should be DSCP_DEFAULT.
|
||||
EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface->dscp());
|
||||
channel->SetInterface(nullptr);
|
||||
|
||||
// Default value when DSCP is enabled is also DSCP_DEFAULT, until it is set
|
||||
// through rtp parameters.
|
||||
@ -5277,6 +5299,7 @@ TEST_F(WebRtcVideoChannelTest, TestSetDscpOptions) {
|
||||
EXPECT_TRUE(static_cast<webrtc::Transport*>(channel.get())
|
||||
->SendRtcp(kData, sizeof(kData)));
|
||||
EXPECT_EQ(rtc::DSCP_CS1, network_interface->options().dscp);
|
||||
channel->SetInterface(nullptr);
|
||||
|
||||
// Verify that setting the option to false resets the
|
||||
// DiffServCodePoint.
|
||||
@ -5287,6 +5310,7 @@ TEST_F(WebRtcVideoChannelTest, TestSetDscpOptions) {
|
||||
video_bitrate_allocator_factory_.get())));
|
||||
channel->SetInterface(network_interface.get());
|
||||
EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface->dscp());
|
||||
channel->SetInterface(nullptr);
|
||||
}
|
||||
|
||||
// This test verifies that the RTCP reduced size mode is properly applied to
|
||||
|
||||
@ -3203,6 +3203,7 @@ TEST_P(WebRtcVoiceEngineTestFake, TestSetDscpOptions) {
|
||||
channel->SetInterface(&network_interface);
|
||||
// Default value when DSCP is disabled should be DSCP_DEFAULT.
|
||||
EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface.dscp());
|
||||
channel->SetInterface(nullptr);
|
||||
|
||||
config.enable_dscp = true;
|
||||
channel.reset(static_cast<cricket::WebRtcVoiceMediaChannel*>(
|
||||
@ -3229,6 +3230,7 @@ TEST_P(WebRtcVoiceEngineTestFake, TestSetDscpOptions) {
|
||||
const uint8_t kData[10] = {0};
|
||||
EXPECT_TRUE(channel->SendRtcp(kData, sizeof(kData)));
|
||||
EXPECT_EQ(rtc::DSCP_CS1, network_interface.options().dscp);
|
||||
channel->SetInterface(nullptr);
|
||||
|
||||
// Verify that setting the option to false resets the
|
||||
// DiffServCodePoint.
|
||||
|
||||
Reference in New Issue
Block a user