Pass Environment into audio ChannelSend

To make it available for creating AudioEncoders in follow ups

Bug: webrtc:343086059
Change-Id: I24bb8f7e0494e392210cb1001ea0421030d2766b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/352601
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Jakob Ivarsson‎ <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42396}
This commit is contained in:
Danil Chapovalov 2024-05-28 18:16:53 +02:00 committed by WebRTC LUCI CQ
parent 14ee26cb80
commit c157f29216
8 changed files with 62 additions and 104 deletions

View File

@ -58,6 +58,7 @@ rtc_library("audio") {
"../api/crypto:frame_decryptor_interface", "../api/crypto:frame_decryptor_interface",
"../api/crypto:frame_encryptor_interface", "../api/crypto:frame_encryptor_interface",
"../api/crypto:options", "../api/crypto:options",
"../api/environment",
"../api/neteq:neteq_api", "../api/neteq:neteq_api",
"../api/rtc_event_log", "../api/rtc_event_log",
"../api/task_queue", "../api/task_queue",
@ -109,7 +110,6 @@ rtc_library("audio") {
"../rtc_base/system:no_unique_address", "../rtc_base/system:no_unique_address",
"../rtc_base/task_utils:repeating_task", "../rtc_base/task_utils:repeating_task",
"../system_wrappers", "../system_wrappers",
"../system_wrappers:field_trial",
"../system_wrappers:metrics", "../system_wrappers:metrics",
"utility:audio_frame_operations", "utility:audio_frame_operations",
"//third_party/abseil-cpp/absl/functional:any_invocable", "//third_party/abseil-cpp/absl/functional:any_invocable",

View File

@ -44,7 +44,7 @@
namespace webrtc { namespace webrtc {
namespace { namespace {
void UpdateEventLogStreamConfig(RtcEventLog* event_log, void UpdateEventLogStreamConfig(RtcEventLog& event_log,
const AudioSendStream::Config& config, const AudioSendStream::Config& config,
const AudioSendStream::Config* old_config) { const AudioSendStream::Config* old_config) {
using SendCodecSpec = AudioSendStream::Config::SendCodecSpec; using SendCodecSpec = AudioSendStream::Config::SendCodecSpec;
@ -72,7 +72,7 @@ void UpdateEventLogStreamConfig(RtcEventLog* event_log,
rtclog_config->codecs.emplace_back(config.send_codec_spec->format.name, rtclog_config->codecs.emplace_back(config.send_codec_spec->format.name,
config.send_codec_spec->payload_type, 0); config.send_codec_spec->payload_type, 0);
} }
event_log->Log(std::make_unique<RtcEventAudioSendStreamConfig>( event_log.Log(std::make_unique<RtcEventAudioSendStreamConfig>(
std::move(rtclog_config))); std::move(rtclog_config)));
} }
@ -100,65 +100,51 @@ AudioAllocationConfig::AudioAllocationConfig(
namespace internal { namespace internal {
AudioSendStream::AudioSendStream( AudioSendStream::AudioSendStream(
Clock* clock, const Environment& env,
const webrtc::AudioSendStream::Config& config, const webrtc::AudioSendStream::Config& config,
const rtc::scoped_refptr<webrtc::AudioState>& audio_state, const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
TaskQueueFactory* task_queue_factory,
RtpTransportControllerSendInterface* rtp_transport, RtpTransportControllerSendInterface* rtp_transport,
BitrateAllocatorInterface* bitrate_allocator, BitrateAllocatorInterface* bitrate_allocator,
RtcEventLog* event_log,
RtcpRttStats* rtcp_rtt_stats, RtcpRttStats* rtcp_rtt_stats,
const absl::optional<RtpState>& suspended_rtp_state, const absl::optional<RtpState>& suspended_rtp_state)
const FieldTrialsView& field_trials) : AudioSendStream(env,
: AudioSendStream(clock,
config, config,
audio_state, audio_state,
task_queue_factory,
rtp_transport, rtp_transport,
bitrate_allocator, bitrate_allocator,
event_log,
suspended_rtp_state, suspended_rtp_state,
voe::CreateChannelSend(clock, voe::CreateChannelSend(env,
task_queue_factory,
config.send_transport, config.send_transport,
rtcp_rtt_stats, rtcp_rtt_stats,
event_log,
config.frame_encryptor.get(), config.frame_encryptor.get(),
config.crypto_options, config.crypto_options,
config.rtp.extmap_allow_mixed, config.rtp.extmap_allow_mixed,
config.rtcp_report_interval_ms, config.rtcp_report_interval_ms,
config.rtp.ssrc, config.rtp.ssrc,
config.frame_transformer, config.frame_transformer,
rtp_transport, rtp_transport)) {}
field_trials),
field_trials) {}
AudioSendStream::AudioSendStream( AudioSendStream::AudioSendStream(
Clock* clock, const Environment& env,
const webrtc::AudioSendStream::Config& config, const webrtc::AudioSendStream::Config& config,
const rtc::scoped_refptr<webrtc::AudioState>& audio_state, const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
TaskQueueFactory* task_queue_factory,
RtpTransportControllerSendInterface* rtp_transport, RtpTransportControllerSendInterface* rtp_transport,
BitrateAllocatorInterface* bitrate_allocator, BitrateAllocatorInterface* bitrate_allocator,
RtcEventLog* event_log,
const absl::optional<RtpState>& suspended_rtp_state, const absl::optional<RtpState>& suspended_rtp_state,
std::unique_ptr<voe::ChannelSendInterface> channel_send, std::unique_ptr<voe::ChannelSendInterface> channel_send)
const FieldTrialsView& field_trials) : env_(env),
: clock_(clock),
field_trials_(field_trials),
allocate_audio_without_feedback_( allocate_audio_without_feedback_(
field_trials_.IsEnabled("WebRTC-Audio-ABWENoTWCC")), env_.field_trials().IsEnabled("WebRTC-Audio-ABWENoTWCC")),
enable_audio_alr_probing_( enable_audio_alr_probing_(
!field_trials_.IsDisabled("WebRTC-Audio-AlrProbing")), !env_.field_trials().IsDisabled("WebRTC-Audio-AlrProbing")),
allocation_settings_(field_trials_), allocation_settings_(env_.field_trials()),
config_(Config(/*send_transport=*/nullptr)), config_(Config(/*send_transport=*/nullptr)),
audio_state_(audio_state), audio_state_(audio_state),
channel_send_(std::move(channel_send)), channel_send_(std::move(channel_send)),
event_log_(event_log),
use_legacy_overhead_calculation_( use_legacy_overhead_calculation_(
field_trials_.IsEnabled("WebRTC-Audio-LegacyOverhead")), env_.field_trials().IsEnabled("WebRTC-Audio-LegacyOverhead")),
enable_priority_bitrate_( enable_priority_bitrate_(
!field_trials_.IsDisabled("WebRTC-Audio-PriorityBitrate")), !env_.field_trials().IsDisabled("WebRTC-Audio-PriorityBitrate")),
bitrate_allocator_(bitrate_allocator), bitrate_allocator_(bitrate_allocator),
rtp_transport_(rtp_transport), rtp_transport_(rtp_transport),
rtp_rtcp_module_(channel_send_->GetRtpRtcp()), rtp_rtcp_module_(channel_send_->GetRtpRtcp()),
@ -227,7 +213,7 @@ void AudioSendStream::ConfigureStream(
SetParametersCallback callback) { SetParametersCallback callback) {
RTC_LOG(LS_INFO) << "AudioSendStream::ConfigureStream: " RTC_LOG(LS_INFO) << "AudioSendStream::ConfigureStream: "
<< new_config.ToString(); << new_config.ToString();
UpdateEventLogStreamConfig(event_log_, new_config, UpdateEventLogStreamConfig(env_.event_log(), new_config,
first_time ? nullptr : &config_); first_time ? nullptr : &config_);
const auto& old_config = config_; const auto& old_config = config_;
@ -591,7 +577,7 @@ bool AudioSendStream::SetupSendCodec(const Config& new_config) {
// Enable ANA if configured (currently only used by Opus). // Enable ANA if configured (currently only used by Opus).
if (new_config.audio_network_adaptor_config) { if (new_config.audio_network_adaptor_config) {
if (encoder->EnableAudioNetworkAdaptor( if (encoder->EnableAudioNetworkAdaptor(
*new_config.audio_network_adaptor_config, event_log_)) { *new_config.audio_network_adaptor_config, &env_.event_log())) {
RTC_LOG(LS_INFO) << "Audio network adaptor enabled on SSRC " RTC_LOG(LS_INFO) << "Audio network adaptor enabled on SSRC "
<< new_config.rtp.ssrc; << new_config.rtp.ssrc;
} else { } else {
@ -620,7 +606,7 @@ bool AudioSendStream::SetupSendCodec(const Config& new_config) {
red_config.payload_type = *spec.red_payload_type; red_config.payload_type = *spec.red_payload_type;
red_config.speech_encoder = std::move(encoder); red_config.speech_encoder = std::move(encoder);
encoder = std::make_unique<AudioEncoderCopyRed>(std::move(red_config), encoder = std::make_unique<AudioEncoderCopyRed>(std::move(red_config),
field_trials_); env_.field_trials());
format.name = cricket::kRedCodecName; format.name = cricket::kRedCodecName;
} }
@ -692,7 +678,7 @@ void AudioSendStream::ReconfigureANA(const Config& new_config) {
channel_send_->CallEncoder([&](AudioEncoder* encoder) { channel_send_->CallEncoder([&](AudioEncoder* encoder) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_); RTC_DCHECK_RUN_ON(&worker_thread_checker_);
if (encoder->EnableAudioNetworkAdaptor( if (encoder->EnableAudioNetworkAdaptor(
*new_config.audio_network_adaptor_config, event_log_)) { *new_config.audio_network_adaptor_config, &env_.event_log())) {
RTC_LOG(LS_INFO) << "Audio network adaptor enabled on SSRC " RTC_LOG(LS_INFO) << "Audio network adaptor enabled on SSRC "
<< new_config.rtp.ssrc; << new_config.rtp.ssrc;
if (overhead_per_packet_ > 0) { if (overhead_per_packet_ > 0) {

View File

@ -16,6 +16,7 @@
#include <vector> #include <vector>
#include "absl/functional/any_invocable.h" #include "absl/functional/any_invocable.h"
#include "api/environment/environment.h"
#include "api/field_trials_view.h" #include "api/field_trials_view.h"
#include "api/sequence_checker.h" #include "api/sequence_checker.h"
#include "api/task_queue/task_queue_base.h" #include "api/task_queue/task_queue_base.h"
@ -30,7 +31,6 @@
#include "rtc_base/synchronization/mutex.h" #include "rtc_base/synchronization/mutex.h"
namespace webrtc { namespace webrtc {
class RtcEventLog;
class RtcpRttStats; class RtcpRttStats;
class RtpTransportControllerSendInterface; class RtpTransportControllerSendInterface;
@ -55,27 +55,21 @@ class AudioState;
class AudioSendStream final : public webrtc::AudioSendStream, class AudioSendStream final : public webrtc::AudioSendStream,
public webrtc::BitrateAllocatorObserver { public webrtc::BitrateAllocatorObserver {
public: public:
AudioSendStream(Clock* clock, AudioSendStream(const Environment& env,
const webrtc::AudioSendStream::Config& config, const webrtc::AudioSendStream::Config& config,
const rtc::scoped_refptr<webrtc::AudioState>& audio_state, const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
TaskQueueFactory* task_queue_factory,
RtpTransportControllerSendInterface* rtp_transport, RtpTransportControllerSendInterface* rtp_transport,
BitrateAllocatorInterface* bitrate_allocator, BitrateAllocatorInterface* bitrate_allocator,
RtcEventLog* event_log,
RtcpRttStats* rtcp_rtt_stats, RtcpRttStats* rtcp_rtt_stats,
const absl::optional<RtpState>& suspended_rtp_state, const absl::optional<RtpState>& suspended_rtp_state);
const FieldTrialsView& field_trials);
// For unit tests, which need to supply a mock ChannelSend. // For unit tests, which need to supply a mock ChannelSend.
AudioSendStream(Clock* clock, AudioSendStream(const Environment& env,
const webrtc::AudioSendStream::Config& config, const webrtc::AudioSendStream::Config& config,
const rtc::scoped_refptr<webrtc::AudioState>& audio_state, const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
TaskQueueFactory* task_queue_factory,
RtpTransportControllerSendInterface* rtp_transport, RtpTransportControllerSendInterface* rtp_transport,
BitrateAllocatorInterface* bitrate_allocator, BitrateAllocatorInterface* bitrate_allocator,
RtcEventLog* event_log,
const absl::optional<RtpState>& suspended_rtp_state, const absl::optional<RtpState>& suspended_rtp_state,
std::unique_ptr<voe::ChannelSendInterface> channel_send, std::unique_ptr<voe::ChannelSendInterface> channel_send);
const FieldTrialsView& field_trials);
AudioSendStream() = delete; AudioSendStream() = delete;
AudioSendStream(const AudioSendStream&) = delete; AudioSendStream(const AudioSendStream&) = delete;
@ -156,8 +150,7 @@ class AudioSendStream final : public webrtc::AudioSendStream,
void RegisterCngPayloadType(int payload_type, int clockrate_hz) void RegisterCngPayloadType(int payload_type, int clockrate_hz)
RTC_RUN_ON(worker_thread_checker_); RTC_RUN_ON(worker_thread_checker_);
Clock* clock_; const Environment env_;
const FieldTrialsView& field_trials_;
SequenceChecker worker_thread_checker_; SequenceChecker worker_thread_checker_;
rtc::RaceChecker audio_capture_race_checker_; rtc::RaceChecker audio_capture_race_checker_;
@ -171,7 +164,6 @@ class AudioSendStream final : public webrtc::AudioSendStream,
RTC_GUARDED_BY(worker_thread_checker_); RTC_GUARDED_BY(worker_thread_checker_);
rtc::scoped_refptr<webrtc::AudioState> audio_state_; rtc::scoped_refptr<webrtc::AudioState> audio_state_;
const std::unique_ptr<voe::ChannelSendInterface> channel_send_; const std::unique_ptr<voe::ChannelSendInterface> channel_send_;
RtcEventLog* const event_log_;
const bool use_legacy_overhead_calculation_; const bool use_legacy_overhead_calculation_;
const bool enable_priority_bitrate_; const bool enable_priority_bitrate_;

View File

@ -17,14 +17,13 @@
#include <vector> #include <vector>
#include "api/audio/audio_processing_statistics.h" #include "api/audio/audio_processing_statistics.h"
#include "api/task_queue/default_task_queue_factory.h" #include "api/environment/environment_factory.h"
#include "api/test/mock_frame_encryptor.h" #include "api/test/mock_frame_encryptor.h"
#include "audio/audio_state.h" #include "audio/audio_state.h"
#include "audio/conversion.h" #include "audio/conversion.h"
#include "audio/mock_voe_channel_proxy.h" #include "audio/mock_voe_channel_proxy.h"
#include "call/test/mock_bitrate_allocator.h" #include "call/test/mock_bitrate_allocator.h"
#include "call/test/mock_rtp_transport_controller_send.h" #include "call/test/mock_rtp_transport_controller_send.h"
#include "logging/rtc_event_log/mock/mock_rtc_event_log.h"
#include "modules/audio_device/include/mock_audio_device.h" #include "modules/audio_device/include/mock_audio_device.h"
#include "modules/audio_mixer/audio_mixer_impl.h" #include "modules/audio_mixer/audio_mixer_impl.h"
#include "modules/audio_mixer/sine_wave_generator.h" #include "modules/audio_mixer/sine_wave_generator.h"
@ -186,13 +185,12 @@ struct ConfigHelper {
} }
std::unique_ptr<internal::AudioSendStream> CreateAudioSendStream() { std::unique_ptr<internal::AudioSendStream> CreateAudioSendStream() {
return std::unique_ptr<internal::AudioSendStream>( return std::make_unique<internal::AudioSendStream>(
new internal::AudioSendStream( CreateEnvironment(&field_trials, time_controller_.GetClock(),
time_controller_.GetClock(), stream_config_, audio_state_, time_controller_.GetTaskQueueFactory()),
time_controller_.GetTaskQueueFactory(), &rtp_transport_, stream_config_, audio_state_, &rtp_transport_, &bitrate_allocator_,
&bitrate_allocator_, &event_log_, absl::nullopt, absl::nullopt,
std::unique_ptr<voe::ChannelSendInterface>(channel_send_), std::unique_ptr<voe::ChannelSendInterface>(channel_send_));
field_trials));
} }
AudioSendStream::Config& config() { return stream_config_; } AudioSendStream::Config& config() { return stream_config_; }
@ -325,7 +323,6 @@ struct ConfigHelper {
rtc::scoped_refptr<MockAudioProcessing> audio_processing_; rtc::scoped_refptr<MockAudioProcessing> audio_processing_;
AudioProcessingStats audio_processing_stats_; AudioProcessingStats audio_processing_stats_;
::testing::StrictMock<MockNetworkLinkRtcpObserver> rtcp_observer_; ::testing::StrictMock<MockNetworkLinkRtcpObserver> rtcp_observer_;
::testing::NiceMock<MockRtcEventLog> event_log_;
::testing::NiceMock<MockRtpTransportControllerSend> rtp_transport_; ::testing::NiceMock<MockRtpTransportControllerSend> rtp_transport_;
::testing::NiceMock<MockRtpRtcpInterface> rtp_rtcp_; ::testing::NiceMock<MockRtpRtcpInterface> rtp_rtcp_;
::testing::NiceMock<MockLimitObserver> limit_observer_; ::testing::NiceMock<MockLimitObserver> limit_observer_;

View File

@ -62,19 +62,16 @@ class ChannelSend : public ChannelSendInterface,
public RtcpPacketTypeCounterObserver, public RtcpPacketTypeCounterObserver,
public ReportBlockDataObserver { public ReportBlockDataObserver {
public: public:
ChannelSend(Clock* clock, ChannelSend(const Environment& env,
TaskQueueFactory* task_queue_factory,
Transport* rtp_transport, Transport* rtp_transport,
RtcpRttStats* rtcp_rtt_stats, RtcpRttStats* rtcp_rtt_stats,
RtcEventLog* rtc_event_log,
FrameEncryptorInterface* frame_encryptor, FrameEncryptorInterface* frame_encryptor,
const webrtc::CryptoOptions& crypto_options, const webrtc::CryptoOptions& crypto_options,
bool extmap_allow_mixed, bool extmap_allow_mixed,
int rtcp_report_interval_ms, int rtcp_report_interval_ms,
uint32_t ssrc, uint32_t ssrc,
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer, rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
RtpTransportControllerSendInterface* transport_controller, RtpTransportControllerSendInterface* transport_controller);
const FieldTrialsView& field_trials);
~ChannelSend() override; ~ChannelSend() override;
@ -179,6 +176,8 @@ class ChannelSend : public ChannelSendInterface,
void InitFrameTransformerDelegate( void InitFrameTransformerDelegate(
rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer); rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer);
const Environment env_;
// Thread checkers document and lock usage of some methods on voe::Channel to // Thread checkers document and lock usage of some methods on voe::Channel to
// specific threads we know about. The goal is to eventually split up // specific threads we know about. The goal is to eventually split up
// voe::Channel into parts with single-threaded semantics, and thereby reduce // voe::Channel into parts with single-threaded semantics, and thereby reduce
@ -195,8 +194,6 @@ class ChannelSend : public ChannelSendInterface,
const uint32_t ssrc_; const uint32_t ssrc_;
bool sending_ RTC_GUARDED_BY(&worker_thread_checker_) = false; bool sending_ RTC_GUARDED_BY(&worker_thread_checker_) = false;
RtcEventLog* const event_log_;
std::unique_ptr<ModuleRtpRtcpImpl2> rtp_rtcp_; std::unique_ptr<ModuleRtpRtcpImpl2> rtp_rtcp_;
std::unique_ptr<RTPSenderAudio> rtp_sender_audio_; std::unique_ptr<RTPSenderAudio> rtp_sender_audio_;
@ -390,27 +387,24 @@ int32_t ChannelSend::SendRtpAudio(AudioFrameType frameType,
} }
ChannelSend::ChannelSend( ChannelSend::ChannelSend(
Clock* clock, const Environment& env,
TaskQueueFactory* task_queue_factory,
Transport* rtp_transport, Transport* rtp_transport,
RtcpRttStats* rtcp_rtt_stats, RtcpRttStats* rtcp_rtt_stats,
RtcEventLog* rtc_event_log,
FrameEncryptorInterface* frame_encryptor, FrameEncryptorInterface* frame_encryptor,
const webrtc::CryptoOptions& crypto_options, const webrtc::CryptoOptions& crypto_options,
bool extmap_allow_mixed, bool extmap_allow_mixed,
int rtcp_report_interval_ms, int rtcp_report_interval_ms,
uint32_t ssrc, uint32_t ssrc,
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer, rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
RtpTransportControllerSendInterface* transport_controller, RtpTransportControllerSendInterface* transport_controller)
const FieldTrialsView& field_trials) : env_(env),
: ssrc_(ssrc), ssrc_(ssrc),
event_log_(rtc_event_log),
rtp_packet_pacer_proxy_(new RtpPacketSenderProxy()), rtp_packet_pacer_proxy_(new RtpPacketSenderProxy()),
retransmission_rate_limiter_( retransmission_rate_limiter_(
new RateLimiter(clock, kMaxRetransmissionWindowMs)), new RateLimiter(&env_.clock(), kMaxRetransmissionWindowMs)),
frame_encryptor_(frame_encryptor), frame_encryptor_(frame_encryptor),
crypto_options_(crypto_options), crypto_options_(crypto_options),
encoder_queue_(task_queue_factory->CreateTaskQueue( encoder_queue_(env_.task_queue_factory().CreateTaskQueue(
"AudioEncoder", "AudioEncoder",
TaskQueueFactory::Priority::NORMAL)), TaskQueueFactory::Priority::NORMAL)),
encoder_queue_checker_(encoder_queue_.get()), encoder_queue_checker_(encoder_queue_.get()),
@ -421,15 +415,15 @@ ChannelSend::ChannelSend(
configuration.report_block_data_observer = this; configuration.report_block_data_observer = this;
configuration.network_link_rtcp_observer = configuration.network_link_rtcp_observer =
transport_controller->GetRtcpObserver(); transport_controller->GetRtcpObserver();
configuration.clock = (clock ? clock : Clock::GetRealTimeClock()); configuration.clock = &env_.clock();
configuration.audio = true; configuration.audio = true;
configuration.outgoing_transport = rtp_transport; configuration.outgoing_transport = rtp_transport;
configuration.paced_sender = rtp_packet_pacer_proxy_.get(); configuration.paced_sender = rtp_packet_pacer_proxy_.get();
configuration.event_log = event_log_; configuration.event_log = &env_.event_log();
configuration.rtt_stats = rtcp_rtt_stats; configuration.rtt_stats = rtcp_rtt_stats;
if (field_trials.IsDisabled("WebRTC-DisableRtxRateLimiter")) { if (env_.field_trials().IsDisabled("WebRTC-DisableRtxRateLimiter")) {
configuration.retransmission_rate_limiter = configuration.retransmission_rate_limiter =
retransmission_rate_limiter_.get(); retransmission_rate_limiter_.get();
} }
@ -438,7 +432,7 @@ ChannelSend::ChannelSend(
configuration.rtcp_packet_type_counter_observer = this; configuration.rtcp_packet_type_counter_observer = this;
configuration.local_media_ssrc = ssrc; configuration.local_media_ssrc = ssrc;
configuration.field_trials = &field_trials; configuration.field_trials = &env_.field_trials();
rtp_rtcp_ = ModuleRtpRtcpImpl2::Create(configuration); rtp_rtcp_ = ModuleRtpRtcpImpl2::Create(configuration);
rtp_rtcp_->SetSendingMediaStatus(false); rtp_rtcp_->SetSendingMediaStatus(false);
@ -892,24 +886,20 @@ void ChannelSend::InitFrameTransformerDelegate(
} // namespace } // namespace
std::unique_ptr<ChannelSendInterface> CreateChannelSend( std::unique_ptr<ChannelSendInterface> CreateChannelSend(
Clock* clock, const Environment& env,
TaskQueueFactory* task_queue_factory,
Transport* rtp_transport, Transport* rtp_transport,
RtcpRttStats* rtcp_rtt_stats, RtcpRttStats* rtcp_rtt_stats,
RtcEventLog* rtc_event_log,
FrameEncryptorInterface* frame_encryptor, FrameEncryptorInterface* frame_encryptor,
const webrtc::CryptoOptions& crypto_options, const webrtc::CryptoOptions& crypto_options,
bool extmap_allow_mixed, bool extmap_allow_mixed,
int rtcp_report_interval_ms, int rtcp_report_interval_ms,
uint32_t ssrc, uint32_t ssrc,
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer, rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
RtpTransportControllerSendInterface* transport_controller, RtpTransportControllerSendInterface* transport_controller) {
const FieldTrialsView& field_trials) {
return std::make_unique<ChannelSend>( return std::make_unique<ChannelSend>(
clock, task_queue_factory, rtp_transport, rtcp_rtt_stats, rtc_event_log, env, rtp_transport, rtcp_rtt_stats, frame_encryptor, crypto_options,
frame_encryptor, crypto_options, extmap_allow_mixed, extmap_allow_mixed, rtcp_report_interval_ms, ssrc,
rtcp_report_interval_ms, ssrc, std::move(frame_transformer), std::move(frame_transformer), transport_controller);
transport_controller, field_trials);
} }
} // namespace voe } // namespace voe

View File

@ -18,10 +18,9 @@
#include "api/audio/audio_frame.h" #include "api/audio/audio_frame.h"
#include "api/audio_codecs/audio_encoder.h" #include "api/audio_codecs/audio_encoder.h"
#include "api/crypto/crypto_options.h" #include "api/crypto/crypto_options.h"
#include "api/field_trials_view.h" #include "api/environment/environment.h"
#include "api/frame_transformer_interface.h" #include "api/frame_transformer_interface.h"
#include "api/function_view.h" #include "api/function_view.h"
#include "api/task_queue/task_queue_factory.h"
#include "modules/rtp_rtcp/include/report_block_data.h" #include "modules/rtp_rtcp/include/report_block_data.h"
#include "modules/rtp_rtcp/source/rtp_rtcp_interface.h" #include "modules/rtp_rtcp/source/rtp_rtcp_interface.h"
#include "modules/rtp_rtcp/source/rtp_sender_audio.h" #include "modules/rtp_rtcp/source/rtp_sender_audio.h"
@ -29,7 +28,6 @@
namespace webrtc { namespace webrtc {
class FrameEncryptorInterface; class FrameEncryptorInterface;
class RtcEventLog;
class RtpTransportControllerSendInterface; class RtpTransportControllerSendInterface;
struct CallSendStatistics { struct CallSendStatistics {
@ -115,19 +113,16 @@ class ChannelSendInterface {
}; };
std::unique_ptr<ChannelSendInterface> CreateChannelSend( std::unique_ptr<ChannelSendInterface> CreateChannelSend(
Clock* clock, const Environment& env,
TaskQueueFactory* task_queue_factory,
Transport* rtp_transport, Transport* rtp_transport,
RtcpRttStats* rtcp_rtt_stats, RtcpRttStats* rtcp_rtt_stats,
RtcEventLog* rtc_event_log,
FrameEncryptorInterface* frame_encryptor, FrameEncryptorInterface* frame_encryptor,
const webrtc::CryptoOptions& crypto_options, const webrtc::CryptoOptions& crypto_options,
bool extmap_allow_mixed, bool extmap_allow_mixed,
int rtcp_report_interval_ms, int rtcp_report_interval_ms,
uint32_t ssrc, uint32_t ssrc,
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer, rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
RtpTransportControllerSendInterface* transport_controller, RtpTransportControllerSendInterface* transport_controller);
const FieldTrialsView& field_trials);
} // namespace voe } // namespace voe
} // namespace webrtc } // namespace webrtc

View File

@ -61,11 +61,9 @@ class ChannelSendTest : public ::testing::Test {
transport_controller_( transport_controller_(
RtpTransportConfig{.env = env_, RtpTransportConfig{.env = env_,
.bitrate_config = GetBitrateConfig()}) { .bitrate_config = GetBitrateConfig()}) {
channel_ = voe::CreateChannelSend( channel_ = voe::CreateChannelSend(env_, &transport_, nullptr, nullptr,
time_controller_.GetClock(), time_controller_.GetTaskQueueFactory(), crypto_options_, false, kRtcpIntervalMs,
&transport_, nullptr, &env_.event_log(), nullptr, crypto_options_, kSsrc, nullptr, &transport_controller_);
false, kRtcpIntervalMs, kSsrc, nullptr, &transport_controller_,
env_.field_trials());
encoder_factory_ = CreateBuiltinAudioEncoderFactory(); encoder_factory_ = CreateBuiltinAudioEncoderFactory();
SdpAudioFormat opus = SdpAudioFormat("opus", kRtpRateHz, 2); SdpAudioFormat opus = SdpAudioFormat("opus", kRtpRateHz, 2);
std::unique_ptr<AudioEncoder> encoder = std::unique_ptr<AudioEncoder> encoder =

View File

@ -757,10 +757,10 @@ webrtc::AudioSendStream* Call::CreateAudioSendStream(
} }
} }
AudioSendStream* send_stream = new AudioSendStream( AudioSendStream* send_stream =
&env_.clock(), config, config_.audio_state, &env_.task_queue_factory(), new AudioSendStream(env_, config, config_.audio_state,
transport_send_.get(), bitrate_allocator_.get(), &env_.event_log(), transport_send_.get(), bitrate_allocator_.get(),
call_stats_->AsRtcpRttStats(), suspended_rtp_state, trials()); call_stats_->AsRtcpRttStats(), suspended_rtp_state);
RTC_DCHECK(audio_send_ssrcs_.find(config.rtp.ssrc) == RTC_DCHECK(audio_send_ssrcs_.find(config.rtp.ssrc) ==
audio_send_ssrcs_.end()); audio_send_ssrcs_.end());
audio_send_ssrcs_[config.rtp.ssrc] = send_stream; audio_send_ssrcs_[config.rtp.ssrc] = send_stream;