summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/test/scenario
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /third_party/libwebrtc/test/scenario
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/test/scenario')
-rw-r--r--third_party/libwebrtc/test/scenario/BUILD.gn4
-rw-r--r--third_party/libwebrtc/test/scenario/audio_stream.cc2
-rw-r--r--third_party/libwebrtc/test/scenario/call_client.cc53
-rw-r--r--third_party/libwebrtc/test/scenario/call_client.h6
-rw-r--r--third_party/libwebrtc/test/scenario/scenario_config.h1
-rw-r--r--third_party/libwebrtc/test/scenario/video_stream.cc18
6 files changed, 37 insertions, 47 deletions
diff --git a/third_party/libwebrtc/test/scenario/BUILD.gn b/third_party/libwebrtc/test/scenario/BUILD.gn
index c3b8847fd1..7ac06c6822 100644
--- a/third_party/libwebrtc/test/scenario/BUILD.gn
+++ b/third_party/libwebrtc/test/scenario/BUILD.gn
@@ -86,10 +86,11 @@ if (rtc_include_tests && !build_with_chromium) {
"../../api:rtp_parameters",
"../../api:sequence_checker",
"../../api:time_controller",
- "../../api:time_controller",
"../../api:transport_api",
"../../api/audio_codecs:builtin_audio_decoder_factory",
"../../api/audio_codecs:builtin_audio_encoder_factory",
+ "../../api/environment",
+ "../../api/environment:environment_factory",
"../../api/rtc_event_log",
"../../api/rtc_event_log:rtc_event_log_factory",
"../../api/task_queue",
@@ -146,7 +147,6 @@ if (rtc_include_tests && !build_with_chromium) {
"../../rtc_base/synchronization:mutex",
"../../rtc_base/task_utils:repeating_task",
"../../system_wrappers",
- "../../system_wrappers:field_trial",
"../../video/config:streams_config",
"../logging:log_writer",
"../network:emulated_network",
diff --git a/third_party/libwebrtc/test/scenario/audio_stream.cc b/third_party/libwebrtc/test/scenario/audio_stream.cc
index 7715555e23..5f7db7acdf 100644
--- a/third_party/libwebrtc/test/scenario/audio_stream.cc
+++ b/third_party/libwebrtc/test/scenario/audio_stream.cc
@@ -14,13 +14,11 @@
#include "test/video_test_constants.h"
#if WEBRTC_ENABLE_PROTOBUF
-RTC_PUSH_IGNORING_WUNDEF()
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
#include "external/webrtc/webrtc/modules/audio_coding/audio_network_adaptor/config.pb.h"
#else
#include "modules/audio_coding/audio_network_adaptor/config.pb.h"
#endif
-RTC_POP_IGNORING_WUNDEF()
#endif
namespace webrtc {
diff --git a/third_party/libwebrtc/test/scenario/call_client.cc b/third_party/libwebrtc/test/scenario/call_client.cc
index fdf36dee08..8845ad6b0f 100644
--- a/third_party/libwebrtc/test/scenario/call_client.cc
+++ b/third_party/libwebrtc/test/scenario/call_client.cc
@@ -13,6 +13,8 @@
#include <memory>
#include <utility>
+#include "api/environment/environment.h"
+#include "api/environment/environment_factory.h"
#include "api/media_types.h"
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/rtc_event_log/rtc_event_log_factory.h"
@@ -60,38 +62,27 @@ CallClientFakeAudio InitAudio(TimeController* time_controller) {
}
std::unique_ptr<Call> CreateCall(
- TimeController* time_controller,
- RtcEventLog* event_log,
+ const Environment& env,
CallClientConfig config,
LoggingNetworkControllerFactory* network_controller_factory,
rtc::scoped_refptr<AudioState> audio_state) {
- CallConfig call_config(event_log);
+ CallConfig call_config(env);
call_config.bitrate_config.max_bitrate_bps =
config.transport.rates.max_rate.bps_or(-1);
call_config.bitrate_config.min_bitrate_bps =
config.transport.rates.min_rate.bps();
call_config.bitrate_config.start_bitrate_bps =
config.transport.rates.start_rate.bps();
- call_config.task_queue_factory = time_controller->GetTaskQueueFactory();
call_config.network_controller_factory = network_controller_factory;
call_config.audio_state = audio_state;
- call_config.pacer_burst_interval = config.pacer_burst_interval;
- call_config.trials = config.field_trials;
- Clock* clock = time_controller->GetClock();
- return Call::Create(call_config, clock,
- RtpTransportControllerSendFactory().Create(
- call_config.ExtractTransportConfig(), clock));
+ return Call::Create(call_config);
}
std::unique_ptr<RtcEventLog> CreateEventLog(
- TaskQueueFactory* task_queue_factory,
- LogWriterFactoryInterface* log_writer_factory) {
- if (!log_writer_factory) {
- return std::make_unique<RtcEventLogNull>();
- }
- auto event_log = RtcEventLogFactory(task_queue_factory)
- .CreateRtcEventLog(RtcEventLog::EncodingType::NewFormat);
- bool success = event_log->StartLogging(log_writer_factory->Create(".rtc.dat"),
+ const Environment& env,
+ LogWriterFactoryInterface& log_writer_factory) {
+ auto event_log = RtcEventLogFactory().Create(env);
+ bool success = event_log->StartLogging(log_writer_factory.Create(".rtc.dat"),
kEventLogOutputIntervalMs);
RTC_CHECK(success);
return event_log;
@@ -219,22 +210,25 @@ CallClient::CallClient(
std::unique_ptr<LogWriterFactoryInterface> log_writer_factory,
CallClientConfig config)
: time_controller_(time_controller),
- clock_(time_controller->GetClock()),
+ env_(CreateEnvironment(time_controller_->CreateTaskQueueFactory(),
+ time_controller_->GetClock())),
log_writer_factory_(std::move(log_writer_factory)),
network_controller_factory_(log_writer_factory_.get(), config.transport),
- task_queue_(time_controller->GetTaskQueueFactory()->CreateTaskQueue(
+ task_queue_(env_.task_queue_factory().CreateTaskQueue(
"CallClient",
TaskQueueFactory::Priority::NORMAL)) {
- config.field_trials = &field_trials_;
SendTask([this, config] {
- event_log_ = CreateEventLog(time_controller_->GetTaskQueueFactory(),
- log_writer_factory_.get());
+ if (log_writer_factory_ != nullptr) {
+ EnvironmentFactory env_factory(env_);
+ env_factory.Set(CreateEventLog(env_, *log_writer_factory_));
+ env_ = env_factory.Create();
+ }
fake_audio_setup_ = InitAudio(time_controller_);
- call_ =
- CreateCall(time_controller_, event_log_.get(), config,
- &network_controller_factory_, fake_audio_setup_.audio_state);
- transport_ = std::make_unique<NetworkNodeTransport>(clock_, call_.get());
+ call_ = CreateCall(env_, config, &network_controller_factory_,
+ fake_audio_setup_.audio_state);
+ transport_ =
+ std::make_unique<NetworkNodeTransport>(&env_.clock(), call_.get());
});
}
@@ -243,9 +237,8 @@ CallClient::~CallClient() {
call_.reset();
fake_audio_setup_ = {};
rtc::Event done;
- event_log_->StopLogging([&done] { done.Set(); });
+ env_.event_log().StopLogging([&done] { done.Set(); });
done.Wait(rtc::Event::kForever);
- event_log_.reset();
});
}
@@ -283,7 +276,7 @@ DataRate CallClient::padding_rate() const {
void CallClient::SetRemoteBitrate(DataRate bitrate) {
RemoteBitrateReport msg;
msg.bandwidth = bitrate;
- msg.receive_time = clock_->CurrentTime();
+ msg.receive_time = env_.clock().CurrentTime();
network_controller_factory_.SetRemoteBitrateEstimate(msg);
}
diff --git a/third_party/libwebrtc/test/scenario/call_client.h b/third_party/libwebrtc/test/scenario/call_client.h
index 3717a7e796..f3c483ef28 100644
--- a/third_party/libwebrtc/test/scenario/call_client.h
+++ b/third_party/libwebrtc/test/scenario/call_client.h
@@ -17,6 +17,7 @@
#include <vector>
#include "api/array_view.h"
+#include "api/environment/environment.h"
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/rtp_parameters.h"
#include "api/test/time_controller.h"
@@ -156,9 +157,8 @@ class CallClient : public EmulatedNetworkReceiverInterface {
void UnBind();
TimeController* const time_controller_;
- Clock* clock_;
+ Environment env_;
const std::unique_ptr<LogWriterFactoryInterface> log_writer_factory_;
- std::unique_ptr<RtcEventLog> event_log_;
LoggingNetworkControllerFactory network_controller_factory_;
CallClientFakeAudio fake_audio_setup_;
std::unique_ptr<Call> call_;
@@ -175,8 +175,6 @@ class CallClient : public EmulatedNetworkReceiverInterface {
std::map<uint32_t, MediaType> ssrc_media_types_;
// Defined last so it's destroyed first.
TaskQueueForTest task_queue_;
-
- const FieldTrialBasedConfig field_trials_;
};
class CallClientPair {
diff --git a/third_party/libwebrtc/test/scenario/scenario_config.h b/third_party/libwebrtc/test/scenario/scenario_config.h
index 9ce99401d7..50845cd677 100644
--- a/third_party/libwebrtc/test/scenario/scenario_config.h
+++ b/third_party/libwebrtc/test/scenario/scenario_config.h
@@ -57,7 +57,6 @@ struct CallClientConfig {
// The number of bites that can be sent in one burst is pacer_burst_interval *
// current bwe. 40ms is the default Chrome setting.
TimeDelta pacer_burst_interval = TimeDelta::Millis(40);
- const FieldTrialsView* field_trials = nullptr;
};
struct PacketStreamConfig {
diff --git a/third_party/libwebrtc/test/scenario/video_stream.cc b/third_party/libwebrtc/test/scenario/video_stream.cc
index 38e42c88e0..eb20f8dbc7 100644
--- a/third_party/libwebrtc/test/scenario/video_stream.cc
+++ b/third_party/libwebrtc/test/scenario/video_stream.cc
@@ -372,9 +372,9 @@ SendVideoStream::SendVideoStream(CallClient* sender,
VideoFrameMatcher* matcher)
: sender_(sender), config_(config) {
video_capturer_ = std::make_unique<FrameGeneratorCapturer>(
- sender_->clock_, CreateFrameGenerator(sender_->clock_, config.source),
- config.source.framerate,
- *sender->time_controller_->GetTaskQueueFactory());
+ &sender_->env_.clock(),
+ CreateFrameGenerator(&sender_->env_.clock(), config.source),
+ config.source.framerate, sender_->env_.task_queue_factory());
video_capturer_->Init();
using Encoder = VideoStreamConfig::Encoder;
@@ -386,9 +386,11 @@ SendVideoStream::SendVideoStream(CallClient* sender,
MutexLock lock(&mutex_);
std::unique_ptr<FakeEncoder> encoder;
if (config_.encoder.codec == Codec::kVideoCodecVP8) {
- encoder = std::make_unique<test::FakeVp8Encoder>(sender_->clock_);
+ encoder = std::make_unique<test::FakeVp8Encoder>(
+ &sender_->env_.clock());
} else if (config_.encoder.codec == Codec::kVideoCodecGeneric) {
- encoder = std::make_unique<test::FakeEncoder>(sender_->clock_);
+ encoder =
+ std::make_unique<test::FakeEncoder>(&sender_->env_.clock());
} else {
RTC_DCHECK_NOTREACHED();
}
@@ -436,7 +438,7 @@ SendVideoStream::SendVideoStream(CallClient* sender,
if (matcher->Active()) {
frame_tap_ = std::make_unique<ForwardingCapturedFrameTap>(
- sender_->clock_, matcher, video_capturer_.get());
+ &sender_->env_.clock(), matcher, video_capturer_.get());
send_stream_->SetSource(frame_tap_.get(),
config.encoder.degradation_preference);
} else {
@@ -565,8 +567,8 @@ ReceiveVideoStream::ReceiveVideoStream(CallClient* receiver,
for (size_t i = 0; i < num_streams; ++i) {
rtc::VideoSinkInterface<VideoFrame>* renderer = &fake_renderer_;
if (matcher->Active()) {
- render_taps_.emplace_back(
- std::make_unique<DecodedFrameTap>(receiver_->clock_, matcher, i));
+ render_taps_.emplace_back(std::make_unique<DecodedFrameTap>(
+ &receiver_->env_.clock(), matcher, i));
renderer = render_taps_.back().get();
}
auto recv_config = CreateVideoReceiveStreamConfig(