Update remaining test utilities to create Call with Environment

Bug: webrtc:15656
Change-Id: I37f8825419556d401a6bef09df804f2c8c03715d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/329340
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41311}
This commit is contained in:
Danil Chapovalov 2023-11-30 15:28:09 +01:00 committed by WebRTC LUCI CQ
parent 9abc4865a4
commit 7b5741c94d
5 changed files with 12 additions and 25 deletions

View File

@ -15,10 +15,8 @@ rtc_library("rtp_replayer") {
"rtp_replayer.h",
]
deps = [
"../../../api/rtc_event_log",
"../../../api/task_queue:default_task_queue_factory",
"../../../api/environment:environment_factory",
"../../../api/test/video:function_video_factory",
"../../../api/transport:field_trial_based_config",
"../../../api/units:timestamp",
"../../../api/video_codecs:video_codecs_api",
"../../../call",

View File

@ -16,8 +16,7 @@
#include <utility>
#include "absl/memory/memory.h"
#include "api/task_queue/default_task_queue_factory.h"
#include "api/transport/field_trial_based_config.h"
#include "api/environment/environment_factory.h"
#include "api/units/timestamp.h"
#include "modules/rtp_rtcp/source/rtp_packet.h"
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
@ -73,13 +72,7 @@ void RtpReplayer::Replay(
}
// Setup the video streams based on the configuration.
webrtc::RtcEventLogNull event_log;
std::unique_ptr<TaskQueueFactory> task_queue_factory =
CreateDefaultTaskQueueFactory();
CallConfig call_config(&event_log);
call_config.task_queue_factory = task_queue_factory.get();
FieldTrialBasedConfig field_trials;
call_config.trials = &field_trials;
CallConfig call_config(CreateEnvironment());
std::unique_ptr<Call> call(Call::Create(call_config));
SetupVideoStreams(&receive_stream_configs, stream_state.get(), call.get());

View File

@ -18,7 +18,6 @@
#include <string>
#include <vector>
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/test/video/function_video_decoder_factory.h"
#include "api/video_codecs/video_decoder.h"
#include "call/call.h"

View File

@ -836,6 +836,8 @@ if (rtc_include_tests) {
"../api:transport_api",
"../api/adaptation:resource_adaptation_api",
"../api/crypto:options",
"../api/environment",
"../api/environment:environment_factory",
"../api/metronome/test:fake_metronome",
"../api/rtc_event_log",
"../api/task_queue",
@ -843,7 +845,6 @@ if (rtc_include_tests) {
"../api/test/metrics:global_metrics_logger_and_exporter",
"../api/test/metrics:metric",
"../api/test/video:function_video_factory",
"../api/transport:field_trial_based_config",
"../api/units:data_rate",
"../api/units:frequency",
"../api/units:time_delta",

View File

@ -14,8 +14,8 @@
#include <utility>
#include <vector>
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/task_queue/default_task_queue_factory.h"
#include "api/environment/environment.h"
#include "api/environment/environment_factory.h"
#include "api/task_queue/task_queue_base.h"
#include "api/test/create_frame_generator.h"
#include "api/test/simulated_network.h"
@ -42,17 +42,13 @@ MultiStreamTester::MultiStreamTester() {
MultiStreamTester::~MultiStreamTester() = default;
void MultiStreamTester::RunTest() {
webrtc::RtcEventLogNull event_log;
auto task_queue_factory = CreateDefaultTaskQueueFactory();
Environment env = CreateEnvironment();
// Use high prioirity since this task_queue used for fake network delivering
// at correct time. Those test tasks should be prefered over code under test
// to make test more stable.
auto task_queue = task_queue_factory->CreateTaskQueue(
auto task_queue = env.task_queue_factory().CreateTaskQueue(
"TaskQueue", TaskQueueFactory::Priority::HIGH);
CallConfig config(&event_log);
test::ScopedKeyValueConfig field_trials;
config.trials = &field_trials;
config.task_queue_factory = task_queue_factory.get();
CallConfig config(env);
std::unique_ptr<Call> sender_call;
std::unique_ptr<Call> receiver_call;
std::unique_ptr<test::DirectTransport> sender_transport;
@ -115,10 +111,10 @@ void MultiStreamTester::RunTest() {
receive_streams[i]->Start();
auto* frame_generator = new test::FrameGeneratorCapturer(
Clock::GetRealTimeClock(),
&env.clock(),
test::CreateSquareFrameGenerator(width, height, absl::nullopt,
absl::nullopt),
30, *task_queue_factory);
30, env.task_queue_factory());
frame_generators[i] = frame_generator;
send_streams[i]->SetSource(frame_generator,
DegradationPreference::MAINTAIN_FRAMERATE);