Makes some CallTest members private.
This prepares for replacing single instance members with vectors in a
follow up CL.
Bug: webrtc:9510
Change-Id: Ie05436ec89a0af9ce9fe9cece9842a39227246ec
Reviewed-on: https://webrtc-review.googlesource.com/88180
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23968}
diff --git a/call/bitrate_estimator_tests.cc b/call/bitrate_estimator_tests.cc
index 0efb7d5..b3f7856 100644
--- a/call/bitrate_estimator_tests.cc
+++ b/call/bitrate_estimator_tests.cc
@@ -112,17 +112,20 @@
&task_queue_, receiver_call_.get(), payload_type_map_));
receive_transport_->SetReceiver(sender_call_->Receiver());
- video_send_config_ = VideoSendStream::Config(send_transport_.get());
- video_send_config_.rtp.ssrcs.push_back(kVideoSendSsrcs[0]);
- video_send_config_.encoder_settings.encoder_factory =
+ VideoSendStream::Config video_send_config(send_transport_.get());
+ video_send_config.rtp.ssrcs.push_back(kVideoSendSsrcs[0]);
+ video_send_config.encoder_settings.encoder_factory =
&fake_encoder_factory_;
- video_send_config_.rtp.payload_name = "FAKE";
- video_send_config_.rtp.payload_type = kFakeVideoSendPayloadType;
- test::FillEncoderConfiguration(kVideoCodecVP8, 1, &video_encoder_config_);
+ video_send_config.rtp.payload_name = "FAKE";
+ video_send_config.rtp.payload_type = kFakeVideoSendPayloadType;
+ SetVideoSendConfig(video_send_config);
+ VideoEncoderConfig video_encoder_config;
+ test::FillEncoderConfiguration(kVideoCodecVP8, 1, &video_encoder_config);
+ SetVideoEncoderConfig(video_encoder_config);
receive_config_ = VideoReceiveStream::Config(receive_transport_.get());
// receive_config_.decoders will be set by every stream separately.
- receive_config_.rtp.remote_ssrc = video_send_config_.rtp.ssrcs[0];
+ receive_config_.rtp.remote_ssrc = GetVideoSendConfig()->rtp.ssrcs[0];
receive_config_.rtp.local_ssrc = kReceiverLocalVideoSsrc;
receive_config_.rtp.remb = true;
receive_config_.rtp.extensions.push_back(
@@ -158,11 +161,11 @@
send_stream_(nullptr),
frame_generator_capturer_(),
fake_decoder_() {
- test_->video_send_config_.rtp.ssrcs[0]++;
+ test_->GetVideoSendConfig()->rtp.ssrcs[0]++;
send_stream_ = test_->sender_call_->CreateVideoSendStream(
- test_->video_send_config_.Copy(),
- test_->video_encoder_config_.Copy());
- RTC_DCHECK_EQ(1, test_->video_encoder_config_.number_of_streams);
+ test_->GetVideoSendConfig()->Copy(),
+ test_->GetVideoEncoderConfig()->Copy());
+ RTC_DCHECK_EQ(1, test_->GetVideoEncoderConfig()->number_of_streams);
frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create(
kDefaultWidth, kDefaultHeight, absl::nullopt, absl::nullopt,
kDefaultFramerate, Clock::GetRealTimeClock()));
@@ -173,12 +176,12 @@
VideoReceiveStream::Decoder decoder;
decoder.decoder = &fake_decoder_;
- decoder.payload_type = test_->video_send_config_.rtp.payload_type;
- decoder.payload_name = test_->video_send_config_.rtp.payload_name;
+ decoder.payload_type = test_->GetVideoSendConfig()->rtp.payload_type;
+ decoder.payload_name = test_->GetVideoSendConfig()->rtp.payload_name;
test_->receive_config_.decoders.clear();
test_->receive_config_.decoders.push_back(decoder);
test_->receive_config_.rtp.remote_ssrc =
- test_->video_send_config_.rtp.ssrcs[0];
+ test_->GetVideoSendConfig()->rtp.ssrcs[0];
test_->receive_config_.rtp.local_ssrc++;
test_->receive_config_.renderer = &test->fake_renderer_;
video_receive_stream_ = test_->receiver_call_->CreateVideoReceiveStream(
@@ -232,7 +235,7 @@
TEST_F(BitrateEstimatorTest, InstantiatesTOFPerDefaultForVideo) {
task_queue_.SendTask([this]() {
- video_send_config_.rtp.extensions.push_back(
+ GetVideoSendConfig()->rtp.extensions.push_back(
RtpExtension(RtpExtension::kTimestampOffsetUri, kTOFExtensionId));
receiver_log_.PushExpectedLogLine(kSingleStreamLog);
receiver_log_.PushExpectedLogLine(kSingleStreamLog);
@@ -243,7 +246,7 @@
TEST_F(BitrateEstimatorTest, ImmediatelySwitchToASTForVideo) {
task_queue_.SendTask([this]() {
- video_send_config_.rtp.extensions.push_back(
+ GetVideoSendConfig()->rtp.extensions.push_back(
RtpExtension(RtpExtension::kAbsSendTimeUri, kASTExtensionId));
receiver_log_.PushExpectedLogLine(kSingleStreamLog);
receiver_log_.PushExpectedLogLine(kSingleStreamLog);
@@ -256,7 +259,7 @@
TEST_F(BitrateEstimatorTest, SwitchesToASTForVideo) {
task_queue_.SendTask([this]() {
- video_send_config_.rtp.extensions.push_back(
+ GetVideoSendConfig()->rtp.extensions.push_back(
RtpExtension(RtpExtension::kTimestampOffsetUri, kTOFExtensionId));
receiver_log_.PushExpectedLogLine(kSingleStreamLog);
receiver_log_.PushExpectedLogLine(kSingleStreamLog);
@@ -265,7 +268,7 @@
EXPECT_TRUE(receiver_log_.Wait());
task_queue_.SendTask([this]() {
- video_send_config_.rtp.extensions[0] =
+ GetVideoSendConfig()->rtp.extensions[0] =
RtpExtension(RtpExtension::kAbsSendTimeUri, kASTExtensionId);
receiver_log_.PushExpectedLogLine("Switching to absolute send time RBE.");
receiver_log_.PushExpectedLogLine(kAbsSendTimeLog);
@@ -277,7 +280,7 @@
// This test is flaky. See webrtc:5790.
TEST_F(BitrateEstimatorTest, DISABLED_SwitchesToASTThenBackToTOFForVideo) {
task_queue_.SendTask([this]() {
- video_send_config_.rtp.extensions.push_back(
+ GetVideoSendConfig()->rtp.extensions.push_back(
RtpExtension(RtpExtension::kTimestampOffsetUri, kTOFExtensionId));
receiver_log_.PushExpectedLogLine(kSingleStreamLog);
receiver_log_.PushExpectedLogLine(kAbsSendTimeLog);
@@ -287,7 +290,7 @@
EXPECT_TRUE(receiver_log_.Wait());
task_queue_.SendTask([this]() {
- video_send_config_.rtp.extensions[0] =
+ GetVideoSendConfig()->rtp.extensions[0] =
RtpExtension(RtpExtension::kAbsSendTimeUri, kASTExtensionId);
receiver_log_.PushExpectedLogLine(kAbsSendTimeLog);
receiver_log_.PushExpectedLogLine("Switching to absolute send time RBE.");
@@ -296,7 +299,7 @@
EXPECT_TRUE(receiver_log_.Wait());
task_queue_.SendTask([this]() {
- video_send_config_.rtp.extensions[0] =
+ GetVideoSendConfig()->rtp.extensions[0] =
RtpExtension(RtpExtension::kTimestampOffsetUri, kTOFExtensionId);
receiver_log_.PushExpectedLogLine(kAbsSendTimeLog);
receiver_log_.PushExpectedLogLine(
diff --git a/call/call_perf_tests.cc b/call/call_perf_tests.cc
index 40f47fe..bc6d31b 100644
--- a/call/call_perf_tests.cc
+++ b/call/call_perf_tests.cc
@@ -226,10 +226,10 @@
audio_send_config.encoder_factory = CreateBuiltinAudioEncoderFactory();
audio_send_stream = sender_call_->CreateAudioSendStream(audio_send_config);
- video_send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
+ GetVideoSendConfig()->rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
if (fec == FecMode::kOn) {
- video_send_config_.rtp.ulpfec.red_payload_type = kRedPayloadType;
- video_send_config_.rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType;
+ GetVideoSendConfig()->rtp.ulpfec.red_payload_type = kRedPayloadType;
+ GetVideoSendConfig()->rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType;
video_receive_configs_[0].rtp.red_payload_type = kRedPayloadType;
video_receive_configs_[0].rtp.ulpfec_payload_type = kUlpfecPayloadType;
}
diff --git a/test/call_test.cc b/test/call_test.cc
index 60d21ed..641f03c 100644
--- a/test/call_test.cc
+++ b/test/call_test.cc
@@ -35,8 +35,6 @@
send_event_log_(RtcEventLog::CreateNull()),
recv_event_log_(RtcEventLog::CreateNull()),
sender_call_transport_controller_(nullptr),
- video_send_config_(nullptr),
- video_send_stream_(nullptr),
audio_send_config_(nullptr),
audio_send_stream_(nullptr),
fake_encoder_factory_([this]() {
@@ -49,7 +47,9 @@
num_flexfec_streams_(0),
audio_decoder_factory_(CreateBuiltinAudioDecoderFactory()),
audio_encoder_factory_(CreateBuiltinAudioEncoderFactory()),
- task_queue_("CallTestTaskQueue") {}
+ task_queue_("CallTestTaskQueue"),
+ video_send_config_(nullptr),
+ video_send_stream_(nullptr) {}
CallTest::~CallTest() {
task_queue_.SendTask([this]() {
@@ -124,8 +124,8 @@
CreateMatchingReceiveConfigs(receive_transport_.get());
}
if (num_video_streams_ > 0) {
- test->ModifyVideoConfigs(&video_send_config_, &video_receive_configs_,
- &video_encoder_config_);
+ test->ModifyVideoConfigs(GetVideoSendConfig(), &video_receive_configs_,
+ GetVideoEncoderConfig());
}
if (num_audio_streams_ > 0) {
test->ModifyAudioConfigs(&audio_send_config_, &audio_receive_configs_);
@@ -242,9 +242,10 @@
// TODO(brandtr): Update this when we support multistream protection.
if (num_flexfec_streams > 0) {
- video_send_config_.rtp.flexfec.payload_type = kFlexfecPayloadType;
- video_send_config_.rtp.flexfec.ssrc = kFlexfecSendSsrc;
- video_send_config_.rtp.flexfec.protected_media_ssrcs = {kVideoSendSsrcs[0]};
+ GetVideoSendConfig()->rtp.flexfec.payload_type = kFlexfecPayloadType;
+ GetVideoSendConfig()->rtp.flexfec.ssrc = kFlexfecSendSsrc;
+ GetVideoSendConfig()->rtp.flexfec.protected_media_ssrcs = {
+ kVideoSendSsrcs[0]};
}
}
@@ -308,7 +309,7 @@
config.remote_ssrc = kFlexfecSendSsrc;
config.protected_media_ssrcs = {kVideoSendSsrcs[0]};
config.local_ssrc = kReceiverLocalVideoSsrc;
- for (const RtpExtension& extension : video_send_config_.rtp.extensions)
+ for (const RtpExtension& extension : GetVideoSendConfig()->rtp.extensions)
config.rtp_header_extensions.push_back(extension);
flexfec_receive_configs_.push_back(config);
}
@@ -319,7 +320,7 @@
allocated_decoders_.clear();
if (num_video_streams_ > 0) {
std::vector<VideoReceiveStream::Config> new_configs =
- CreateMatchingVideoReceiveConfigs(video_send_config_,
+ CreateMatchingVideoReceiveConfigs(*GetVideoSendConfig(),
rtcp_send_transport);
for (VideoReceiveStream::Config& config : new_configs) {
video_receive_configs_.push_back(config.Copy());
@@ -335,8 +336,7 @@
int height) {
frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create(
width, height, absl::nullopt, absl::nullopt, framerate * speed, clock));
- video_send_stream_->SetSource(frame_generator_capturer_.get(),
- DegradationPreference::MAINTAIN_FRAMERATE);
+ ConnectVideoSourcesToStreams();
}
void CallTest::CreateFrameGeneratorCapturer(int framerate,
@@ -344,8 +344,7 @@
int height) {
frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create(
width, height, absl::nullopt, absl::nullopt, framerate, clock_));
- video_send_stream_->SetSource(frame_generator_capturer_.get(),
- DegradationPreference::MAINTAIN_FRAMERATE);
+ ConnectVideoSourcesToStreams();
}
void CallTest::CreateFakeAudioDevices(
@@ -358,11 +357,8 @@
}
void CallTest::CreateVideoStreams() {
- RTC_DCHECK(video_send_stream_ == nullptr);
RTC_DCHECK(video_receive_streams_.empty());
-
- video_send_stream_ = sender_call_->CreateVideoSendStream(
- video_send_config_.Copy(), video_encoder_config_.Copy());
+ CreateVideoSendStreams();
for (size_t i = 0; i < video_receive_configs_.size(); ++i) {
video_receive_streams_.push_back(receiver_call_->CreateVideoReceiveStream(
video_receive_configs_[i].Copy()));
@@ -371,6 +367,18 @@
AssociateFlexfecStreamsWithVideoStreams();
}
+void CallTest::CreateVideoSendStreams() {
+ RTC_DCHECK(video_send_stream_ == nullptr);
+ video_send_stream_ = sender_call_->CreateVideoSendStream(
+ GetVideoSendConfig()->Copy(), GetVideoEncoderConfig()->Copy());
+}
+
+void CallTest::CreateVideoSendStream(const VideoEncoderConfig& encoder_config) {
+ RTC_DCHECK(video_send_stream_ == nullptr);
+ video_send_stream_ = sender_call_->CreateVideoSendStream(
+ GetVideoSendConfig()->Copy(), encoder_config.Copy());
+}
+
void CallTest::CreateAudioStreams() {
RTC_DCHECK(audio_send_stream_ == nullptr);
RTC_DCHECK(audio_receive_streams_.empty());
@@ -391,6 +399,11 @@
AssociateFlexfecStreamsWithVideoStreams();
}
+void CallTest::ConnectVideoSourcesToStreams() {
+ GetVideoSendStream()->SetSource(frame_generator_capturer_.get(),
+ degradation_preference_);
+}
+
void CallTest::AssociateFlexfecStreamsWithVideoStreams() {
// All FlexFEC streams protect all of the video streams.
for (FlexfecReceiveStream* flexfec_recv_stream : flexfec_receive_streams_) {
@@ -409,15 +422,23 @@
}
void CallTest::Start() {
- if (video_send_stream_)
- video_send_stream_->Start();
- for (VideoReceiveStream* video_recv_stream : video_receive_streams_)
- video_recv_stream->Start();
+ StartVideoStreams();
if (audio_send_stream_) {
audio_send_stream_->Start();
}
for (AudioReceiveStream* audio_recv_stream : audio_receive_streams_)
audio_recv_stream->Start();
+ StartVideoCapture();
+}
+
+void CallTest::StartVideoStreams() {
+ if (video_send_stream_)
+ video_send_stream_->Start();
+ for (VideoReceiveStream* video_recv_stream : video_receive_streams_)
+ video_recv_stream->Start();
+}
+
+void CallTest::StartVideoCapture() {
if (frame_generator_capturer_.get() != NULL)
frame_generator_capturer_->Start();
}
@@ -445,9 +466,7 @@
for (AudioReceiveStream* audio_recv_stream : audio_receive_streams_)
receiver_call_->DestroyAudioReceiveStream(audio_recv_stream);
- if (video_send_stream_)
- sender_call_->DestroyVideoSendStream(video_send_stream_);
- video_send_stream_ = nullptr;
+ DestroyVideoSendStreams();
for (VideoReceiveStream* video_recv_stream : video_receive_streams_)
receiver_call_->DestroyVideoReceiveStream(video_recv_stream);
@@ -459,10 +478,40 @@
allocated_decoders_.clear();
}
+void CallTest::DestroyVideoSendStreams() {
+ if (video_send_stream_)
+ sender_call_->DestroyVideoSendStream(video_send_stream_);
+ video_send_stream_ = nullptr;
+}
+
void CallTest::SetFakeVideoCaptureRotation(VideoRotation rotation) {
frame_generator_capturer_->SetFakeRotation(rotation);
}
+void CallTest::SetVideoDegradation(DegradationPreference preference) {
+ GetVideoSendStream()->SetSource(frame_generator_capturer_.get(), preference);
+}
+
+VideoSendStream::Config* CallTest::GetVideoSendConfig() {
+ return &video_send_config_;
+}
+
+void CallTest::SetVideoSendConfig(const VideoSendStream::Config& config) {
+ video_send_config_ = config.Copy();
+}
+
+VideoEncoderConfig* CallTest::GetVideoEncoderConfig() {
+ return &video_encoder_config_;
+}
+
+void CallTest::SetVideoEncoderConfig(const VideoEncoderConfig& config) {
+ video_encoder_config_ = config.Copy();
+}
+
+VideoSendStream* CallTest::GetVideoSendStream() {
+ return video_send_stream_;
+}
+
constexpr size_t CallTest::kNumSsrcs;
const int CallTest::kDefaultWidth;
const int CallTest::kDefaultHeight;
diff --git a/test/call_test.h b/test/call_test.h
index e14e7e6..12301e8 100644
--- a/test/call_test.h
+++ b/test/call_test.h
@@ -107,17 +107,32 @@
std::unique_ptr<TestAudioDeviceModule::Renderer> renderer);
void CreateVideoStreams();
+ void CreateVideoSendStreams();
+ void CreateVideoSendStream(const VideoEncoderConfig& encoder_config);
void CreateAudioStreams();
void CreateFlexfecStreams();
+ void ConnectVideoSourcesToStreams();
+
void AssociateFlexfecStreamsWithVideoStreams();
void DissociateFlexfecStreamsFromVideoStreams();
void Start();
+ void StartVideoStreams();
+ void StartVideoCapture();
void Stop();
void DestroyStreams();
+ void DestroyVideoSendStreams();
void SetFakeVideoCaptureRotation(VideoRotation rotation);
+ void SetVideoDegradation(DegradationPreference preference);
+
+ VideoSendStream::Config* GetVideoSendConfig();
+ void SetVideoSendConfig(const VideoSendStream::Config& config);
+ VideoEncoderConfig* GetVideoEncoderConfig();
+ void SetVideoEncoderConfig(const VideoEncoderConfig& config);
+ VideoSendStream* GetVideoSendStream();
+
Clock* const clock_;
std::unique_ptr<webrtc::RtcEventLog> send_event_log_;
@@ -125,9 +140,6 @@
std::unique_ptr<Call> sender_call_;
RtpTransportControllerSend* sender_call_transport_controller_;
std::unique_ptr<PacketTransport> send_transport_;
- VideoSendStream::Config video_send_config_;
- VideoEncoderConfig video_encoder_config_;
- VideoSendStream* video_send_stream_;
AudioSendStream::Config audio_send_config_;
AudioSendStream* audio_send_stream_;
@@ -154,6 +166,13 @@
SingleThreadedTaskQueueForTesting task_queue_;
private:
+ VideoSendStream::Config video_send_config_;
+ VideoEncoderConfig video_encoder_config_;
+ VideoSendStream* video_send_stream_;
+
+ DegradationPreference degradation_preference_ =
+ DegradationPreference::MAINTAIN_FRAMERATE;
+
rtc::scoped_refptr<AudioProcessing> apm_send_;
rtc::scoped_refptr<AudioProcessing> apm_recv_;
rtc::scoped_refptr<TestAudioDeviceModule> fake_send_audio_device_;
diff --git a/video/end_to_end_tests/call_operation_tests.cc b/video/end_to_end_tests/call_operation_tests.cc
index 542c1a6..1861058 100644
--- a/video/end_to_end_tests/call_operation_tests.cc
+++ b/video/end_to_end_tests/call_operation_tests.cc
@@ -130,8 +130,8 @@
std::unique_ptr<test::FrameGenerator> frame_generator(
test::FrameGenerator::CreateSquareGenerator(
kWidth, kHeight, absl::nullopt, absl::nullopt));
- video_send_stream_->SetSource(&frame_forwarder,
- DegradationPreference::MAINTAIN_FRAMERATE);
+ GetVideoSendStream()->SetSource(&frame_forwarder,
+ DegradationPreference::MAINTAIN_FRAMERATE);
frame_forwarder.IncomingCapturedFrame(*frame_generator->NextFrame());
});
@@ -186,8 +186,8 @@
frame_generator = test::FrameGenerator::CreateSquareGenerator(
kDefaultWidth, kDefaultHeight, absl::nullopt, absl::nullopt);
- video_send_stream_->SetSource(&frame_forwarder,
- DegradationPreference::MAINTAIN_FRAMERATE);
+ GetVideoSendStream()->SetSource(&frame_forwarder,
+ DegradationPreference::MAINTAIN_FRAMERATE);
frame_forwarder.IncomingCapturedFrame(*frame_generator->NextFrame());
});
@@ -246,15 +246,15 @@
CreateSendConfig(1, 0, 0, sender_transport.get());
CreateMatchingReceiveConfigs(receiver_transport.get());
- video_send_config_.post_encode_callback = &post_encode_observer;
+ GetVideoSendConfig()->post_encode_callback = &post_encode_observer;
CreateVideoStreams();
Start();
frame_generator = test::FrameGenerator::CreateSquareGenerator(
kDefaultWidth, kDefaultHeight, absl::nullopt, absl::nullopt);
- video_send_stream_->SetSource(&forwarder,
- DegradationPreference::MAINTAIN_FRAMERATE);
+ GetVideoSendStream()->SetSource(&forwarder,
+ DegradationPreference::MAINTAIN_FRAMERATE);
forwarder.IncomingCapturedFrame(*frame_generator->NextFrame());
});
diff --git a/video/end_to_end_tests/log_tests.cc b/video/end_to_end_tests/log_tests.cc
index 391c3d0..9f0e019 100644
--- a/video/end_to_end_tests/log_tests.cc
+++ b/video/end_to_end_tests/log_tests.cc
@@ -36,10 +36,10 @@
void LogSend(bool open) {
if (open) {
- video_send_stream_->EnableEncodedFrameRecording(
+ GetVideoSendStream()->EnableEncodedFrameRecording(
std::vector<rtc::PlatformFile>(1, OpenFile(AddFile())), 0);
} else {
- video_send_stream_->DisableEncodedFrameRecording();
+ GetVideoSendStream()->DisableEncodedFrameRecording();
}
}
void LogReceive(bool open) {
diff --git a/video/end_to_end_tests/multi_codec_receive_tests.cc b/video/end_to_end_tests/multi_codec_receive_tests.cc
index b52b458..d4ab3ee 100644
--- a/video/end_to_end_tests/multi_codec_receive_tests.cc
+++ b/video/end_to_end_tests/multi_codec_receive_tests.cc
@@ -204,13 +204,14 @@
}
void MultiCodecReceiveTest::ConfigureEncoder(const CodecConfig& config) {
- video_send_config_.encoder_settings.encoder_factory = config.encoder_factory;
- video_send_config_.rtp.payload_name = config.payload_name;
- video_send_config_.rtp.payload_type =
+ GetVideoSendConfig()->encoder_settings.encoder_factory =
+ config.encoder_factory;
+ GetVideoSendConfig()->rtp.payload_name = config.payload_name;
+ GetVideoSendConfig()->rtp.payload_type =
PayloadNameToPayloadType(config.payload_name);
- video_encoder_config_.codec_type =
+ GetVideoEncoderConfig()->codec_type =
PayloadStringToCodecType(config.payload_name);
- video_encoder_config_.video_stream_factory =
+ GetVideoEncoderConfig()->video_stream_factory =
new rtc::RefCountedObject<VideoStreamFactoryTest>(
config.num_temporal_layers);
}
@@ -236,14 +237,14 @@
// Recreate VideoSendStream with new config (codec, temporal layers).
task_queue_.SendTask([this, i, &configs]() {
frame_generator_capturer_->Stop();
- sender_call_->DestroyVideoSendStream(video_send_stream_);
+ DestroyVideoSendStreams();
observer_.Reset();
ConfigureEncoder(configs[i]);
- video_send_stream_ = sender_call_->CreateVideoSendStream(
- video_send_config_.Copy(), video_encoder_config_.Copy());
- video_send_stream_->Start();
+ CreateVideoSendStreams();
+ GetVideoSendStream()->Start();
CreateFrameGeneratorCapturer(kFps, kWidth / 2, kHeight / 2);
+ ConnectVideoSourcesToStreams();
frame_generator_capturer_->Start();
});
EXPECT_TRUE(observer_.Wait()) << "Timed out waiting for frames.";
diff --git a/video/end_to_end_tests/network_state_tests.cc b/video/end_to_end_tests/network_state_tests.cc
index 7bad1410..8d68161 100644
--- a/video/end_to_end_tests/network_state_tests.cc
+++ b/video/end_to_end_tests/network_state_tests.cc
@@ -87,7 +87,7 @@
sender_call_->SignalChannelNetworkState(network_to_bring_up, kNetworkUp);
CreateSendConfig(1, 0, 0, transport);
- video_send_config_.encoder_settings.encoder_factory = &encoder_factory;
+ GetVideoSendConfig()->encoder_settings.encoder_factory = &encoder_factory;
CreateVideoStreams();
CreateFrameGeneratorCapturer(kDefaultFramerate, kDefaultWidth,
kDefaultHeight);
diff --git a/video/end_to_end_tests/rtp_rtcp_tests.cc b/video/end_to_end_tests/rtp_rtcp_tests.cc
index 0b9e8a8..92ab0c9 100644
--- a/video/end_to_end_tests/rtp_rtcp_tests.cc
+++ b/video/end_to_end_tests/rtp_rtcp_tests.cc
@@ -288,16 +288,16 @@
if (use_rtx) {
for (size_t i = 0; i < kNumSimulcastStreams; ++i) {
- video_send_config_.rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[i]);
+ GetVideoSendConfig()->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[i]);
}
- video_send_config_.rtp.rtx.payload_type = kSendRtxPayloadType;
+ GetVideoSendConfig()->rtp.rtx.payload_type = kSendRtxPayloadType;
}
- video_encoder_config_.video_stream_factory =
+ GetVideoEncoderConfig()->video_stream_factory =
new rtc::RefCountedObject<VideoStreamFactory>();
// Use the same total bitrates when sending a single stream to avoid
// lowering the bitrate estimate and requiring a subsequent rampup.
- one_stream = video_encoder_config_.Copy();
+ one_stream = GetVideoEncoderConfig()->Copy();
// one_stream.streams.resize(1);
one_stream.number_of_streams = 1;
CreateMatchingReceiveConfigs(receive_transport.get());
@@ -316,12 +316,11 @@
for (size_t i = 0; i < 3; ++i) {
task_queue_.SendTask([&]() {
frame_generator_capturer_->Stop();
- sender_call_->DestroyVideoSendStream(video_send_stream_);
+ DestroyVideoSendStreams();
// Re-create VideoSendStream with only one stream.
- video_send_stream_ = sender_call_->CreateVideoSendStream(
- video_send_config_.Copy(), one_stream.Copy());
- video_send_stream_->Start();
+ CreateVideoSendStream(one_stream);
+ GetVideoSendStream()->Start();
if (provoke_rtcpsr_before_rtp) {
// Rapid Resync Request forces sending RTCP Sender Report back.
// Using this request speeds up this test because then there is no need
@@ -340,7 +339,8 @@
// Reconfigure back to use all streams.
task_queue_.SendTask([this]() {
- video_send_stream_->ReconfigureVideoEncoder(video_encoder_config_.Copy());
+ GetVideoSendStream()->ReconfigureVideoEncoder(
+ GetVideoEncoderConfig()->Copy());
});
observer.ResetExpectedSsrcs(kNumSimulcastStreams);
EXPECT_TRUE(observer.Wait())
@@ -348,14 +348,15 @@
// Reconfigure down to one stream.
task_queue_.SendTask([this, &one_stream]() {
- video_send_stream_->ReconfigureVideoEncoder(one_stream.Copy());
+ GetVideoSendStream()->ReconfigureVideoEncoder(one_stream.Copy());
});
observer.ResetExpectedSsrcs(1);
EXPECT_TRUE(observer.Wait()) << "Timed out waiting for single RTP packet.";
// Reconfigure back to use all streams.
task_queue_.SendTask([this]() {
- video_send_stream_->ReconfigureVideoEncoder(video_encoder_config_.Copy());
+ GetVideoSendStream()->ReconfigureVideoEncoder(
+ GetVideoEncoderConfig()->Copy());
});
observer.ResetExpectedSsrcs(kNumSimulcastStreams);
EXPECT_TRUE(observer.Wait())
@@ -493,13 +494,13 @@
CreateSendConfig(kNumVideoStreams, 0, kNumFlexfecStreams,
send_transport.get());
- video_send_config_.encoder_settings.encoder_factory = &encoder_factory;
- video_send_config_.rtp.payload_name = "VP8";
- video_send_config_.rtp.payload_type = kVideoSendPayloadType;
- video_send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
- video_send_config_.rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[0]);
- video_send_config_.rtp.rtx.payload_type = kSendRtxPayloadType;
- video_encoder_config_.codec_type = kVideoCodecVP8;
+ GetVideoSendConfig()->encoder_settings.encoder_factory = &encoder_factory;
+ GetVideoSendConfig()->rtp.payload_name = "VP8";
+ GetVideoSendConfig()->rtp.payload_type = kVideoSendPayloadType;
+ GetVideoSendConfig()->rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
+ GetVideoSendConfig()->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[0]);
+ GetVideoSendConfig()->rtp.rtx.payload_type = kSendRtxPayloadType;
+ GetVideoEncoderConfig()->codec_type = kVideoCodecVP8;
CreateMatchingReceiveConfigs(receive_transport.get());
video_receive_configs_[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
@@ -514,10 +515,10 @@
FlexfecReceiveStream::Config flexfec_receive_config(
receive_transport.get());
flexfec_receive_config.payload_type =
- video_send_config_.rtp.flexfec.payload_type;
- flexfec_receive_config.remote_ssrc = video_send_config_.rtp.flexfec.ssrc;
+ GetVideoSendConfig()->rtp.flexfec.payload_type;
+ flexfec_receive_config.remote_ssrc = GetVideoSendConfig()->rtp.flexfec.ssrc;
flexfec_receive_config.protected_media_ssrcs =
- video_send_config_.rtp.flexfec.protected_media_ssrcs;
+ GetVideoSendConfig()->rtp.flexfec.protected_media_ssrcs;
flexfec_receive_config.local_ssrc = kReceiverLocalVideoSsrc;
flexfec_receive_config.transport_cc = true;
flexfec_receive_config.rtp_header_extensions.emplace_back(
@@ -552,11 +553,10 @@
task_queue_.SendTask([this, &observer]() {
// Ensure monotonicity when the VideoSendStream is recreated.
frame_generator_capturer_->Stop();
- sender_call_->DestroyVideoSendStream(video_send_stream_);
+ DestroyVideoSendStreams();
observer.ResetPacketCount();
- video_send_stream_ = sender_call_->CreateVideoSendStream(
- video_send_config_.Copy(), video_encoder_config_.Copy());
- video_send_stream_->Start();
+ CreateVideoSendStreams();
+ GetVideoSendStream()->Start();
CreateFrameGeneratorCapturer(kFrameRate, kFrameMaxWidth, kFrameMaxHeight);
frame_generator_capturer_->Start();
});
diff --git a/video/end_to_end_tests/stats_tests.cc b/video/end_to_end_tests/stats_tests.cc
index c142693..6d3c89b 100644
--- a/video/end_to_end_tests/stats_tests.cc
+++ b/video/end_to_end_tests/stats_tests.cc
@@ -531,16 +531,16 @@
CreateMatchingReceiveConfigs(receive_transport_.get());
// Modify send and receive configs.
- video_send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
+ GetVideoSendConfig()->rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
video_receive_configs_[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
video_receive_configs_[0].renderer = &test;
// RTT needed for RemoteNtpTimeEstimator for the receive stream.
video_receive_configs_[0].rtp.rtcp_xr.receiver_reference_time_report = true;
// Start with realtime video.
- video_encoder_config_.content_type =
+ GetVideoEncoderConfig()->content_type =
VideoEncoderConfig::ContentType::kRealtimeVideo;
// Second encoder config for the second part of the test uses screenshare
- encoder_config_with_screenshare = video_encoder_config_.Copy();
+ encoder_config_with_screenshare = GetVideoEncoderConfig()->Copy();
encoder_config_with_screenshare.content_type =
VideoEncoderConfig::ContentType::kScreen;
@@ -554,12 +554,10 @@
// Replace old send stream.
task_queue_.SendTask([this, &encoder_config_with_screenshare]() {
- sender_call_->DestroyVideoSendStream(video_send_stream_);
- video_send_stream_ = sender_call_->CreateVideoSendStream(
- video_send_config_.Copy(), encoder_config_with_screenshare.Copy());
- video_send_stream_->SetSource(frame_generator_capturer_.get(),
- DegradationPreference::BALANCED);
- video_send_stream_->Start();
+ DestroyVideoSendStreams();
+ CreateVideoSendStream(encoder_config_with_screenshare);
+ SetVideoDegradation(DegradationPreference::BALANCED);
+ GetVideoSendStream()->Start();
});
// Continue to run test but now with screenshare.
diff --git a/video/picture_id_tests.cc b/video/picture_id_tests.cc
index baacb4a..0da5d0a 100644
--- a/video/picture_id_tests.cc
+++ b/video/picture_id_tests.cc
@@ -290,12 +290,13 @@
FakeNetworkPipe::Config()));
CreateSendConfig(kNumSimulcastStreams, 0, 0, send_transport_.get());
- video_send_config_.encoder_settings.encoder_factory = encoder_factory;
- video_send_config_.rtp.payload_name = payload_name;
- video_encoder_config_.codec_type = PayloadStringToCodecType(payload_name);
- video_encoder_config_.video_stream_factory =
+ GetVideoSendConfig()->encoder_settings.encoder_factory = encoder_factory;
+ GetVideoSendConfig()->rtp.payload_name = payload_name;
+ GetVideoEncoderConfig()->codec_type =
+ PayloadStringToCodecType(payload_name);
+ GetVideoEncoderConfig()->video_stream_factory =
new rtc::RefCountedObject<VideoStreamFactory>(num_temporal_layers_);
- video_encoder_config_.number_of_streams = 1;
+ GetVideoEncoderConfig()->number_of_streams = 1;
});
}
@@ -315,12 +316,13 @@
// Expect continuously increasing picture id, equivalent to no gaps.
observer_->SetMaxExpectedPictureIdGap(0);
for (int ssrc_count : ssrc_counts) {
- video_encoder_config_.number_of_streams = ssrc_count;
+ GetVideoEncoderConfig()->number_of_streams = ssrc_count;
observer_->SetExpectedSsrcs(ssrc_count);
observer_->ResetObservedSsrcs();
// Make sure the picture_id sequence is continuous on reinit and recreate.
task_queue_.SendTask([this]() {
- video_send_stream_->ReconfigureVideoEncoder(video_encoder_config_.Copy());
+ GetVideoSendStream()->ReconfigureVideoEncoder(
+ GetVideoEncoderConfig()->Copy());
});
EXPECT_TRUE(observer_->Wait()) << "Timed out waiting for packets.";
}
@@ -350,15 +352,14 @@
for (int ssrc_count : ssrc_counts) {
task_queue_.SendTask([this, &ssrc_count]() {
frame_generator_capturer_->Stop();
- sender_call_->DestroyVideoSendStream(video_send_stream_);
+ DestroyVideoSendStreams();
- video_encoder_config_.number_of_streams = ssrc_count;
+ GetVideoEncoderConfig()->number_of_streams = ssrc_count;
observer_->SetExpectedSsrcs(ssrc_count);
observer_->ResetObservedSsrcs();
- video_send_stream_ = sender_call_->CreateVideoSendStream(
- video_send_config_.Copy(), video_encoder_config_.Copy());
- video_send_stream_->Start();
+ CreateVideoSendStreams();
+ GetVideoSendStream()->Start();
CreateFrameGeneratorCapturer(kFrameRate, kFrameMaxWidth, kFrameMaxHeight);
frame_generator_capturer_->Start();
});
diff --git a/video/video_send_stream_tests.cc b/video/video_send_stream_tests.cc
index 0595a4c..c868581 100644
--- a/video/video_send_stream_tests.cc
+++ b/video/video_send_stream_tests.cc
@@ -95,8 +95,8 @@
test::NullTransport transport;
CreateSendConfig(1, 0, 0, &transport);
CreateVideoStreams();
- video_send_stream_->Start();
- video_send_stream_->Start();
+ GetVideoSendStream()->Start();
+ GetVideoSendStream()->Start();
DestroyStreams();
DestroyCalls();
});
@@ -109,8 +109,8 @@
test::NullTransport transport;
CreateSendConfig(1, 0, 0, &transport);
CreateVideoStreams();
- video_send_stream_->Stop();
- video_send_stream_->Stop();
+ GetVideoSendStream()->Stop();
+ GetVideoSendStream()->Stop();
DestroyStreams();
DestroyCalls();
});
@@ -1858,13 +1858,11 @@
const VideoEncoderConfig& encoder_config) {
task_queue_.SendTask([this, &send_stream_config, &encoder_config]() {
Stop();
- sender_call_->DestroyVideoSendStream(video_send_stream_);
- video_send_config_ = send_stream_config.Copy();
- video_encoder_config_ = encoder_config.Copy();
- video_send_stream_ = sender_call_->CreateVideoSendStream(
- video_send_config_.Copy(), video_encoder_config_.Copy());
- video_send_stream_->SetSource(frame_generator_capturer_.get(),
- DegradationPreference::MAINTAIN_RESOLUTION);
+ DestroyVideoSendStreams();
+ SetVideoSendConfig(send_stream_config);
+ SetVideoEncoderConfig(encoder_config);
+ CreateVideoSendStreams();
+ SetVideoDegradation(DegradationPreference::MAINTAIN_RESOLUTION);
Start();
});
};
@@ -1939,7 +1937,7 @@
task_queue_.SendTask([this, &transport, &encoder_factory]() {
CreateSenderCall();
CreateSendConfig(1, 0, 0, &transport);
- video_send_config_.encoder_settings.encoder_factory = &encoder_factory;
+ GetVideoSendConfig()->encoder_settings.encoder_factory = &encoder_factory;
CreateVideoStreams();
CreateFrameGeneratorCapturer(kDefaultFramerate, kDefaultWidth,
kDefaultHeight);
@@ -2006,7 +2004,8 @@
CreateSendConfig(1, 0, 0, &transport);
BitrateConstraints bitrate_config;
- bitrate_config.start_bitrate_bps = 2 * video_encoder_config_.max_bitrate_bps;
+ bitrate_config.start_bitrate_bps =
+ 2 * GetVideoEncoderConfig()->max_bitrate_bps;
sender_call_->GetTransportControllerSend()->SetSdpBitrateParameters(
bitrate_config);
@@ -2015,16 +2014,18 @@
// Since this test does not use a capturer, set |internal_source| = true.
// Encoder configuration is otherwise updated on the next video frame.
encoder_factory.SetHasInternalSource(true);
- video_send_config_.encoder_settings.encoder_factory = &encoder_factory;
+ GetVideoSendConfig()->encoder_settings.encoder_factory = &encoder_factory;
CreateVideoStreams();
EXPECT_TRUE(encoder.WaitForStartBitrate());
- EXPECT_EQ(video_encoder_config_.max_bitrate_bps / 1000,
+ EXPECT_EQ(GetVideoEncoderConfig()->max_bitrate_bps / 1000,
encoder.GetStartBitrateKbps());
- video_encoder_config_.max_bitrate_bps = 2 * bitrate_config.start_bitrate_bps;
- video_send_stream_->ReconfigureVideoEncoder(video_encoder_config_.Copy());
+ GetVideoEncoderConfig()->max_bitrate_bps =
+ 2 * bitrate_config.start_bitrate_bps;
+ GetVideoSendStream()->ReconfigureVideoEncoder(
+ GetVideoEncoderConfig()->Copy());
// New bitrate should be reconfigured above the previous max. As there's no
// network connection this shouldn't be flaky, as no bitrate should've been
@@ -2103,24 +2104,25 @@
CreateSendConfig(1, 0, 0, &transport);
sender_call_->SignalChannelNetworkState(MediaType::VIDEO, kNetworkUp);
- video_send_config_.encoder_settings.encoder_factory = &encoder_factory;
+ GetVideoSendConfig()->encoder_settings.encoder_factory = &encoder_factory;
CreateVideoStreams();
// Inject a frame, to force encoder creation.
- video_send_stream_->Start();
- video_send_stream_->SetSource(&forwarder, DegradationPreference::DISABLED);
+ GetVideoSendStream()->Start();
+ GetVideoSendStream()->SetSource(&forwarder,
+ DegradationPreference::DISABLED);
forwarder.IncomingCapturedFrame(CreateVideoFrame(640, 480, 4));
});
EXPECT_TRUE(encoder.WaitForEncoderInit());
- task_queue_.SendTask([this]() { video_send_stream_->Start(); });
+ task_queue_.SendTask([this]() { GetVideoSendStream()->Start(); });
EXPECT_TRUE(encoder.WaitBitrateChanged(true));
- task_queue_.SendTask([this]() { video_send_stream_->Stop(); });
+ task_queue_.SendTask([this]() { GetVideoSendStream()->Stop(); });
EXPECT_TRUE(encoder.WaitBitrateChanged(false));
- task_queue_.SendTask([this]() { video_send_stream_->Start(); });
+ task_queue_.SendTask([this]() { GetVideoSendStream()->Start(); });
EXPECT_TRUE(encoder.WaitBitrateChanged(true));
task_queue_.SendTask([this]() {
@@ -2146,15 +2148,16 @@
CreateSendConfig(2, 0, 0, &transport);
sender_call_->SignalChannelNetworkState(MediaType::VIDEO, kNetworkUp);
- video_send_config_.encoder_settings.encoder_factory = &encoder_factory;
+ GetVideoSendConfig()->encoder_settings.encoder_factory = &encoder_factory;
- video_send_config_.rtp.payload_name = "VP8";
+ GetVideoSendConfig()->rtp.payload_name = "VP8";
CreateVideoStreams();
// Inject a frame, to force encoder creation.
- video_send_stream_->Start();
- video_send_stream_->SetSource(&forwarder, DegradationPreference::DISABLED);
+ GetVideoSendStream()->Start();
+ GetVideoSendStream()->SetSource(&forwarder,
+ DegradationPreference::DISABLED);
forwarder.IncomingCapturedFrame(CreateVideoFrame(640, 480, 4));
});
@@ -2163,14 +2166,15 @@
// When we turn on the simulcast layers it will update the BitrateAllocator,
// which in turn updates the VideoEncoder's bitrate.
task_queue_.SendTask([this]() {
- video_send_stream_->UpdateActiveSimulcastLayers({true, true});
+ GetVideoSendStream()->UpdateActiveSimulcastLayers({true, true});
});
EXPECT_TRUE(encoder.WaitBitrateChanged(true));
- video_encoder_config_.simulcast_layers[0].active = true;
- video_encoder_config_.simulcast_layers[1].active = false;
+ GetVideoEncoderConfig()->simulcast_layers[0].active = true;
+ GetVideoEncoderConfig()->simulcast_layers[1].active = false;
task_queue_.SendTask([this]() {
- video_send_stream_->ReconfigureVideoEncoder(video_encoder_config_.Copy());
+ GetVideoSendStream()->ReconfigureVideoEncoder(
+ GetVideoEncoderConfig()->Copy());
});
// TODO(bugs.webrtc.org/8807): Currently we require a hard reconfiguration to
// update the VideoBitrateAllocator and BitrateAllocator of which layers are
@@ -2182,10 +2186,10 @@
EXPECT_TRUE(encoder.WaitBitrateChanged(true));
// Turning off both simulcast layers should trigger a bitrate change of 0.
- video_encoder_config_.simulcast_layers[0].active = false;
- video_encoder_config_.simulcast_layers[1].active = false;
+ GetVideoEncoderConfig()->simulcast_layers[0].active = false;
+ GetVideoEncoderConfig()->simulcast_layers[1].active = false;
task_queue_.SendTask([this]() {
- video_send_stream_->UpdateActiveSimulcastLayers({false, false});
+ GetVideoSendStream()->UpdateActiveSimulcastLayers({false, false});
});
EXPECT_TRUE(encoder.WaitBitrateChanged(false));
@@ -2231,7 +2235,7 @@
CreateSenderCall();
CreateSendConfig(1, 0, 0, &transport);
- video_send_config_.pre_encode_callback = &observer;
+ GetVideoSendConfig()->pre_encode_callback = &observer;
CreateVideoStreams();
// Prepare five input frames. Send ordinary VideoFrame and texture frames
@@ -2248,19 +2252,19 @@
input_frames.push_back(test::FakeNativeBuffer::CreateFrame(
width, height, 5, 5, kVideoRotation_0));
- video_send_stream_->Start();
+ GetVideoSendStream()->Start();
test::FrameForwarder forwarder;
- video_send_stream_->SetSource(&forwarder,
- DegradationPreference::MAINTAIN_FRAMERATE);
+ GetVideoSendStream()->SetSource(&forwarder,
+ DegradationPreference::MAINTAIN_FRAMERATE);
for (size_t i = 0; i < input_frames.size(); i++) {
forwarder.IncomingCapturedFrame(input_frames[i]);
// Wait until the output frame is received before sending the next input
// frame. Or the previous input frame may be replaced without delivering.
observer.WaitOutputFrame();
}
- video_send_stream_->Stop();
- video_send_stream_->SetSource(nullptr,
- DegradationPreference::MAINTAIN_FRAMERATE);
+ GetVideoSendStream()->Stop();
+ GetVideoSendStream()->SetSource(nullptr,
+ DegradationPreference::MAINTAIN_FRAMERATE);
});
// Test if the input and output frames are the same. render_time_ms and
@@ -3604,16 +3608,16 @@
test::NullTransport transport;
CreateSendConfig(1, 0, 0, &transport);
- video_send_config_.rtp.extensions.clear();
+ GetVideoSendConfig()->rtp.extensions.clear();
if (support_orientation_ext) {
- video_send_config_.rtp.extensions.push_back(
+ GetVideoSendConfig()->rtp.extensions.push_back(
RtpExtension(RtpExtension::kVideoRotationUri, 1));
}
CreateVideoStreams();
test::FrameForwarder forwarder;
- video_send_stream_->SetSource(&forwarder,
- DegradationPreference::MAINTAIN_FRAMERATE);
+ GetVideoSendStream()->SetSource(&forwarder,
+ DegradationPreference::MAINTAIN_FRAMERATE);
EXPECT_TRUE(forwarder.sink_wants().rotation_applied !=
support_orientation_ext);
@@ -3979,14 +3983,12 @@
test::BaseTest* test) {
task_queue_.SendTask([this, &send_stream_config, &encoder_config, &test]() {
Stop();
- sender_call_->DestroyVideoSendStream(video_send_stream_);
- video_send_config_ = send_stream_config.Copy();
- video_encoder_config_ = encoder_config.Copy();
- video_send_stream_ = sender_call_->CreateVideoSendStream(
- video_send_config_.Copy(), video_encoder_config_.Copy());
- video_send_stream_->SetSource(frame_generator_capturer_.get(),
- DegradationPreference::MAINTAIN_RESOLUTION);
- test->OnVideoStreamsCreated(video_send_stream_, video_receive_streams_);
+ DestroyVideoSendStreams();
+ SetVideoSendConfig(send_stream_config);
+ SetVideoEncoderConfig(encoder_config);
+ CreateVideoSendStreams();
+ SetVideoDegradation(DegradationPreference::MAINTAIN_RESOLUTION);
+ test->OnVideoStreamsCreated(GetVideoSendStream(), video_receive_streams_);
Start();
});
};