Allow to create webrtc::Call with Environment
instead of passing utilities one by one Bug: webrtc:15656 Change-Id: I1f3bf7ae66dcc62bbf17d81c927aabe748b42163 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/328540 Reviewed-by: Emil Lundmark <lndmrk@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#41256}
This commit is contained in:
parent
357947f2f0
commit
3c5850148e
@ -57,6 +57,7 @@ rtc_library("call_interfaces") {
|
|||||||
"../api/audio_codecs:audio_codecs_api",
|
"../api/audio_codecs:audio_codecs_api",
|
||||||
"../api/crypto:frame_encryptor_interface",
|
"../api/crypto:frame_encryptor_interface",
|
||||||
"../api/crypto:options",
|
"../api/crypto:options",
|
||||||
|
"../api/environment",
|
||||||
"../api/metronome",
|
"../api/metronome",
|
||||||
"../api/neteq:neteq_api",
|
"../api/neteq:neteq_api",
|
||||||
"../api/task_queue",
|
"../api/task_queue",
|
||||||
@ -486,8 +487,8 @@ if (rtc_include_tests) {
|
|||||||
"../api:rtp_parameters",
|
"../api:rtp_parameters",
|
||||||
"../api:transport_api",
|
"../api:transport_api",
|
||||||
"../api/audio_codecs:builtin_audio_decoder_factory",
|
"../api/audio_codecs:builtin_audio_decoder_factory",
|
||||||
"../api/rtc_event_log",
|
"../api/environment",
|
||||||
"../api/task_queue:default_task_queue_factory",
|
"../api/environment:environment_factory",
|
||||||
"../api/test/video:function_video_factory",
|
"../api/test/video:function_video_factory",
|
||||||
"../api/transport:field_trial_based_config",
|
"../api/transport:field_trial_based_config",
|
||||||
"../api/units:timestamp",
|
"../api/units:timestamp",
|
||||||
|
|||||||
@ -474,7 +474,8 @@ std::string Call::Stats::ToString(int64_t time_ms) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Call> Call::Create(const CallConfig& config) {
|
std::unique_ptr<Call> Call::Create(const CallConfig& config) {
|
||||||
Clock* clock = Clock::GetRealTimeClock();
|
Clock* clock =
|
||||||
|
config.env.has_value() ? &config.env->clock() : Clock::GetRealTimeClock();
|
||||||
return Create(config, clock,
|
return Create(config, clock,
|
||||||
RtpTransportControllerSendFactory().Create(
|
RtpTransportControllerSendFactory().Create(
|
||||||
config.ExtractTransportConfig(), clock));
|
config.ExtractTransportConfig(), clock));
|
||||||
|
|||||||
@ -14,6 +14,14 @@
|
|||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
CallConfig::CallConfig(const Environment& env,
|
||||||
|
TaskQueueBase* network_task_queue)
|
||||||
|
: env(env),
|
||||||
|
event_log(&env.event_log()),
|
||||||
|
task_queue_factory(&env.task_queue_factory()),
|
||||||
|
trials(&env.field_trials()),
|
||||||
|
network_task_queue_(network_task_queue) {}
|
||||||
|
|
||||||
CallConfig::CallConfig(RtcEventLog* event_log,
|
CallConfig::CallConfig(RtcEventLog* event_log,
|
||||||
TaskQueueBase* network_task_queue /* = nullptr*/)
|
TaskQueueBase* network_task_queue /* = nullptr*/)
|
||||||
: event_log(event_log), network_task_queue_(network_task_queue) {
|
: event_log(event_log), network_task_queue_(network_task_queue) {
|
||||||
|
|||||||
@ -10,6 +10,8 @@
|
|||||||
#ifndef CALL_CALL_CONFIG_H_
|
#ifndef CALL_CALL_CONFIG_H_
|
||||||
#define CALL_CALL_CONFIG_H_
|
#define CALL_CALL_CONFIG_H_
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
|
#include "api/environment/environment.h"
|
||||||
#include "api/fec_controller.h"
|
#include "api/fec_controller.h"
|
||||||
#include "api/field_trials_view.h"
|
#include "api/field_trials_view.h"
|
||||||
#include "api/metronome/metronome.h"
|
#include "api/metronome/metronome.h"
|
||||||
@ -32,12 +34,23 @@ struct CallConfig {
|
|||||||
// If `network_task_queue` is set to nullptr, Call will assume that network
|
// If `network_task_queue` is set to nullptr, Call will assume that network
|
||||||
// related callbacks will be made on the same TQ as the Call instance was
|
// related callbacks will be made on the same TQ as the Call instance was
|
||||||
// constructed on.
|
// constructed on.
|
||||||
|
explicit CallConfig(const Environment& env,
|
||||||
|
TaskQueueBase* network_task_queue = nullptr);
|
||||||
|
|
||||||
|
// TODO(bugs.webrtc.org/15656): Deprecate and delete constructor below.
|
||||||
explicit CallConfig(RtcEventLog* event_log,
|
explicit CallConfig(RtcEventLog* event_log,
|
||||||
TaskQueueBase* network_task_queue = nullptr);
|
TaskQueueBase* network_task_queue = nullptr);
|
||||||
|
|
||||||
CallConfig(const CallConfig&);
|
CallConfig(const CallConfig&);
|
||||||
RtpTransportConfig ExtractTransportConfig() const;
|
|
||||||
~CallConfig();
|
~CallConfig();
|
||||||
|
|
||||||
|
RtpTransportConfig ExtractTransportConfig() const;
|
||||||
|
|
||||||
|
// TODO(bugs.webrtc.org/15656): Make non-optional when constructor that
|
||||||
|
// doesn't pass Environment is removed.
|
||||||
|
absl::optional<Environment> env;
|
||||||
|
|
||||||
// Bitrate config used until valid bitrate estimates are calculated. Also
|
// Bitrate config used until valid bitrate estimates are calculated. Also
|
||||||
// used to cap total bitrate used. This comes from the remote connection.
|
// used to cap total bitrate used. This comes from the remote connection.
|
||||||
BitrateConstraints bitrate_config;
|
BitrateConstraints bitrate_config;
|
||||||
|
|||||||
@ -17,12 +17,11 @@
|
|||||||
|
|
||||||
#include "absl/strings/string_view.h"
|
#include "absl/strings/string_view.h"
|
||||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||||
|
#include "api/environment/environment.h"
|
||||||
|
#include "api/environment/environment_factory.h"
|
||||||
#include "api/media_types.h"
|
#include "api/media_types.h"
|
||||||
#include "api/rtc_event_log/rtc_event_log.h"
|
|
||||||
#include "api/task_queue/default_task_queue_factory.h"
|
|
||||||
#include "api/test/mock_audio_mixer.h"
|
#include "api/test/mock_audio_mixer.h"
|
||||||
#include "api/test/video/function_video_encoder_factory.h"
|
#include "api/test/video/function_video_encoder_factory.h"
|
||||||
#include "api/transport/field_trial_based_config.h"
|
|
||||||
#include "api/units/timestamp.h"
|
#include "api/units/timestamp.h"
|
||||||
#include "api/video/builtin_video_bitrate_allocator_factory.h"
|
#include "api/video/builtin_video_bitrate_allocator_factory.h"
|
||||||
#include "audio/audio_receive_stream.h"
|
#include "audio/audio_receive_stream.h"
|
||||||
@ -54,7 +53,6 @@ using ::webrtc::test::RunLoop;
|
|||||||
|
|
||||||
struct CallHelper {
|
struct CallHelper {
|
||||||
explicit CallHelper(bool use_null_audio_processing) {
|
explicit CallHelper(bool use_null_audio_processing) {
|
||||||
task_queue_factory_ = CreateDefaultTaskQueueFactory();
|
|
||||||
AudioState::Config audio_state_config;
|
AudioState::Config audio_state_config;
|
||||||
audio_state_config.audio_mixer = rtc::make_ref_counted<MockAudioMixer>();
|
audio_state_config.audio_mixer = rtc::make_ref_counted<MockAudioMixer>();
|
||||||
audio_state_config.audio_processing =
|
audio_state_config.audio_processing =
|
||||||
@ -63,10 +61,8 @@ struct CallHelper {
|
|||||||
: rtc::make_ref_counted<NiceMock<MockAudioProcessing>>();
|
: rtc::make_ref_counted<NiceMock<MockAudioProcessing>>();
|
||||||
audio_state_config.audio_device_module =
|
audio_state_config.audio_device_module =
|
||||||
rtc::make_ref_counted<MockAudioDeviceModule>();
|
rtc::make_ref_counted<MockAudioDeviceModule>();
|
||||||
CallConfig config(&event_log_);
|
CallConfig config(CreateEnvironment());
|
||||||
config.audio_state = AudioState::Create(audio_state_config);
|
config.audio_state = AudioState::Create(audio_state_config);
|
||||||
config.task_queue_factory = task_queue_factory_.get();
|
|
||||||
config.trials = &field_trials_;
|
|
||||||
call_ = Call::Create(config);
|
call_ = Call::Create(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,9 +70,6 @@ struct CallHelper {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
RunLoop loop_;
|
RunLoop loop_;
|
||||||
RtcEventLogNull event_log_;
|
|
||||||
FieldTrialBasedConfig field_trials_;
|
|
||||||
std::unique_ptr<TaskQueueFactory> task_queue_factory_;
|
|
||||||
std::unique_ptr<Call> call_;
|
std::unique_ptr<Call> call_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user