aboutsummaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorMarkus Handell <handellm@webrtc.org>2021-06-22 10:46:48 +0200
committerWebRTC LUCI CQ <webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com>2021-06-22 14:51:04 +0000
commiteb61b7f620c1f84cb9d34c7752cea65fe5d1d721 (patch)
tree4240c7418e1c2a9fde352664bd6927b20fac07f9 /audio
parent6e65f6a4288674ff33614f557c33c9dc871fa2e2 (diff)
downloadwebrtc-upstream-master.tar.gz
ModuleRtcRtcpImpl2: remove Module inheritance.upstream-master
This change achieves an Idle Wakeup savings of 200 Hz. ModuleRtcRtcpImpl2 had Process() logic only active if TMMBR() is enabled in RtcpSender, which it never is. Hence the Module inheritance could be removed. The change removes all known dependencies of the module inheritance, and any related mentions of ProcessThread. Fixed: webrtc:11581 Change-Id: I440942f07187fdb9ac18186dab088633969b340e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/222604 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Markus Handell <handellm@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34358}
Diffstat (limited to 'audio')
-rw-r--r--audio/audio_receive_stream.cc12
-rw-r--r--audio/audio_receive_stream.h1
-rw-r--r--audio/audio_send_stream.cc2
-rw-r--r--audio/audio_send_stream.h1
-rw-r--r--audio/channel_receive.cc27
-rw-r--r--audio/channel_receive.h2
-rw-r--r--audio/channel_send.cc23
-rw-r--r--audio/channel_send.h2
-rw-r--r--audio/voip/audio_channel.cc13
-rw-r--r--audio/voip/audio_channel.h5
-rw-r--r--audio/voip/test/audio_channel_unittest.cc7
-rw-r--r--audio/voip/test/voip_core_unittest.cc34
-rw-r--r--audio/voip/voip_core.cc28
-rw-r--r--audio/voip/voip_core.h8
14 files changed, 26 insertions, 139 deletions
diff --git a/audio/audio_receive_stream.cc b/audio/audio_receive_stream.cc
index 6ec266b68d..d4e9c0ea77 100644
--- a/audio/audio_receive_stream.cc
+++ b/audio/audio_receive_stream.cc
@@ -70,7 +70,6 @@ namespace {
std::unique_ptr<voe::ChannelReceiveInterface> CreateChannelReceive(
Clock* clock,
webrtc::AudioState* audio_state,
- ProcessThread* module_process_thread,
NetEqFactory* neteq_factory,
const webrtc::AudioReceiveStream::Config& config,
RtcEventLog* event_log) {
@@ -78,11 +77,10 @@ std::unique_ptr<voe::ChannelReceiveInterface> CreateChannelReceive(
internal::AudioState* internal_audio_state =
static_cast<internal::AudioState*>(audio_state);
return voe::CreateChannelReceive(
- clock, module_process_thread, neteq_factory,
- internal_audio_state->audio_device_module(), config.rtcp_send_transport,
- event_log, config.rtp.local_ssrc, config.rtp.remote_ssrc,
- config.jitter_buffer_max_packets, config.jitter_buffer_fast_accelerate,
- config.jitter_buffer_min_delay_ms,
+ clock, neteq_factory, internal_audio_state->audio_device_module(),
+ config.rtcp_send_transport, event_log, config.rtp.local_ssrc,
+ config.rtp.remote_ssrc, config.jitter_buffer_max_packets,
+ config.jitter_buffer_fast_accelerate, config.jitter_buffer_min_delay_ms,
config.jitter_buffer_enable_rtx_handling, config.decoder_factory,
config.codec_pair_id, std::move(config.frame_decryptor),
config.crypto_options, std::move(config.frame_transformer));
@@ -92,7 +90,6 @@ std::unique_ptr<voe::ChannelReceiveInterface> CreateChannelReceive(
AudioReceiveStream::AudioReceiveStream(
Clock* clock,
PacketRouter* packet_router,
- ProcessThread* module_process_thread,
NetEqFactory* neteq_factory,
const webrtc::AudioReceiveStream::Config& config,
const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
@@ -104,7 +101,6 @@ AudioReceiveStream::AudioReceiveStream(
event_log,
CreateChannelReceive(clock,
audio_state.get(),
- module_process_thread,
neteq_factory,
config,
event_log)) {}
diff --git a/audio/audio_receive_stream.h b/audio/audio_receive_stream.h
index dc64e94510..61ebc2719f 100644
--- a/audio/audio_receive_stream.h
+++ b/audio/audio_receive_stream.h
@@ -48,7 +48,6 @@ class AudioReceiveStream final : public webrtc::AudioReceiveStream,
public:
AudioReceiveStream(Clock* clock,
PacketRouter* packet_router,
- ProcessThread* module_process_thread,
NetEqFactory* neteq_factory,
const webrtc::AudioReceiveStream::Config& config,
const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
diff --git a/audio/audio_send_stream.cc b/audio/audio_send_stream.cc
index aca7cd38b8..5d7bc71659 100644
--- a/audio/audio_send_stream.cc
+++ b/audio/audio_send_stream.cc
@@ -102,7 +102,6 @@ AudioSendStream::AudioSendStream(
const webrtc::AudioSendStream::Config& config,
const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
TaskQueueFactory* task_queue_factory,
- ProcessThread* module_process_thread,
RtpTransportControllerSendInterface* rtp_transport,
BitrateAllocatorInterface* bitrate_allocator,
RtcEventLog* event_log,
@@ -119,7 +118,6 @@ AudioSendStream::AudioSendStream(
voe::CreateChannelSend(
clock,
task_queue_factory,
- module_process_thread,
config.send_transport,
rtcp_rtt_stats,
event_log,
diff --git a/audio/audio_send_stream.h b/audio/audio_send_stream.h
index 223328b26b..e0b15dc0c9 100644
--- a/audio/audio_send_stream.h
+++ b/audio/audio_send_stream.h
@@ -58,7 +58,6 @@ class AudioSendStream final : public webrtc::AudioSendStream,
const webrtc::AudioSendStream::Config& config,
const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
TaskQueueFactory* task_queue_factory,
- ProcessThread* module_process_thread,
RtpTransportControllerSendInterface* rtp_transport,
BitrateAllocatorInterface* bitrate_allocator,
RtcEventLog* event_log,
diff --git a/audio/channel_receive.cc b/audio/channel_receive.cc
index 150e2074e4..acab1467f4 100644
--- a/audio/channel_receive.cc
+++ b/audio/channel_receive.cc
@@ -86,7 +86,6 @@ class ChannelReceive : public ChannelReceiveInterface {
// Used for receive streams.
ChannelReceive(
Clock* clock,
- ProcessThread* module_process_thread,
NetEqFactory* neteq_factory,
AudioDeviceModule* audio_device_module,
Transport* rtcp_send_transport,
@@ -269,7 +268,6 @@ class ChannelReceive : public ChannelReceiveInterface {
// frame.
int64_t capture_start_ntp_time_ms_ RTC_GUARDED_BY(ts_stats_lock_);
- ProcessThread* const module_process_thread_;
AudioDeviceModule* _audioDeviceModulePtr;
float _outputGain RTC_GUARDED_BY(volume_settings_mutex_);
@@ -507,7 +505,6 @@ void ChannelReceive::SetSourceTracker(SourceTracker* source_tracker) {
ChannelReceive::ChannelReceive(
Clock* clock,
- ProcessThread* module_process_thread,
NetEqFactory* neteq_factory,
AudioDeviceModule* audio_device_module,
Transport* rtcp_send_transport,
@@ -540,15 +537,12 @@ ChannelReceive::ChannelReceive(
rtp_ts_wraparound_handler_(new rtc::TimestampWrapAroundHandler()),
capture_start_rtp_time_stamp_(-1),
capture_start_ntp_time_ms_(-1),
- module_process_thread_(module_process_thread),
_audioDeviceModulePtr(audio_device_module),
_outputGain(1.0f),
associated_send_channel_(nullptr),
frame_decryptor_(frame_decryptor),
crypto_options_(crypto_options),
absolute_capture_time_interpolator_(clock) {
- RTC_DCHECK(worker_thread_);
- RTC_DCHECK(module_process_thread_);
RTC_DCHECK(audio_device_module);
network_thread_checker_.Detach();
@@ -579,20 +573,11 @@ ChannelReceive::ChannelReceive(
// Ensure that RTCP is enabled for the created channel.
rtp_rtcp_->SetRTCPStatus(RtcpMode::kCompound);
-
- // TODO(tommi): This should be an implementation detail of ModuleRtpRtcpImpl2
- // and the pointer to the process thread should be there (which also localizes
- // the problem of getting rid of that dependency).
- module_process_thread_->RegisterModule(rtp_rtcp_.get(), RTC_FROM_HERE);
}
ChannelReceive::~ChannelReceive() {
RTC_DCHECK_RUN_ON(&construction_thread_);
- // Unregister the module before stopping playout etc, to match the order
- // things were set up in the ctor.
- module_process_thread_->DeRegisterModule(rtp_rtcp_.get());
-
// Resets the delegate's callback to ChannelReceive::OnReceivedPayloadData.
if (frame_transformer_delegate_)
frame_transformer_delegate_->Reset();
@@ -1090,7 +1075,6 @@ int64_t ChannelReceive::GetRTT() const {
std::unique_ptr<ChannelReceiveInterface> CreateChannelReceive(
Clock* clock,
- ProcessThread* module_process_thread,
NetEqFactory* neteq_factory,
AudioDeviceModule* audio_device_module,
Transport* rtcp_send_transport,
@@ -1107,12 +1091,11 @@ std::unique_ptr<ChannelReceiveInterface> CreateChannelReceive(
const webrtc::CryptoOptions& crypto_options,
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer) {
return std::make_unique<ChannelReceive>(
- clock, module_process_thread, neteq_factory, audio_device_module,
- rtcp_send_transport, rtc_event_log, local_ssrc, remote_ssrc,
- jitter_buffer_max_packets, jitter_buffer_fast_playout,
- jitter_buffer_min_delay_ms, jitter_buffer_enable_rtx_handling,
- decoder_factory, codec_pair_id, std::move(frame_decryptor),
- crypto_options, std::move(frame_transformer));
+ clock, neteq_factory, audio_device_module, rtcp_send_transport,
+ rtc_event_log, local_ssrc, remote_ssrc, jitter_buffer_max_packets,
+ jitter_buffer_fast_playout, jitter_buffer_min_delay_ms,
+ jitter_buffer_enable_rtx_handling, decoder_factory, codec_pair_id,
+ std::move(frame_decryptor), crypto_options, std::move(frame_transformer));
}
} // namespace voe
diff --git a/audio/channel_receive.h b/audio/channel_receive.h
index 196e441fac..f5afe50f3b 100644
--- a/audio/channel_receive.h
+++ b/audio/channel_receive.h
@@ -44,7 +44,6 @@ namespace webrtc {
class AudioDeviceModule;
class FrameDecryptorInterface;
class PacketRouter;
-class ProcessThread;
class RateLimiter;
class ReceiveStatistics;
class RtcEventLog;
@@ -169,7 +168,6 @@ class ChannelReceiveInterface : public RtpPacketSinkInterface {
std::unique_ptr<ChannelReceiveInterface> CreateChannelReceive(
Clock* clock,
- ProcessThread* module_process_thread,
NetEqFactory* neteq_factory,
AudioDeviceModule* audio_device_module,
Transport* rtcp_send_transport,
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
index 47afc7982b..52dd528504 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -69,7 +69,6 @@ class ChannelSend : public ChannelSendInterface,
ChannelSend(Clock* clock,
TaskQueueFactory* task_queue_factory,
- ProcessThread* module_process_thread,
Transport* rtp_transport,
RtcpRttStats* rtcp_rtt_stats,
RtcEventLog* rtc_event_log,
@@ -180,7 +179,6 @@ class ChannelSend : public ChannelSendInterface,
// voe::Channel into parts with single-threaded semantics, and thereby reduce
// the need for locks.
SequenceChecker worker_thread_checker_;
- SequenceChecker module_process_thread_checker_;
// Methods accessed from audio and video threads are checked for sequential-
// only access. We don't necessarily own and control these threads, so thread
// checkers cannot be used. E.g. Chromium may transfer "ownership" from one
@@ -200,7 +198,6 @@ class ChannelSend : public ChannelSendInterface,
uint32_t _timeStamp RTC_GUARDED_BY(encoder_queue_);
// uses
- ProcessThread* const _moduleProcessThreadPtr;
RmsLevel rms_level_ RTC_GUARDED_BY(encoder_queue_);
bool input_mute_ RTC_GUARDED_BY(volume_settings_mutex_);
bool previous_frame_muted_ RTC_GUARDED_BY(encoder_queue_);
@@ -445,7 +442,6 @@ int32_t ChannelSend::SendRtpAudio(AudioFrameType frameType,
ChannelSend::ChannelSend(
Clock* clock,
TaskQueueFactory* task_queue_factory,
- ProcessThread* module_process_thread,
Transport* rtp_transport,
RtcpRttStats* rtcp_rtt_stats,
RtcEventLog* rtc_event_log,
@@ -459,7 +455,6 @@ ChannelSend::ChannelSend(
: event_log_(rtc_event_log),
_timeStamp(0), // This is just an offset, RTP module will add it's own
// random offset
- _moduleProcessThreadPtr(module_process_thread),
input_mute_(false),
previous_frame_muted_(false),
_includeAudioLevelIndication(false),
@@ -475,9 +470,6 @@ ChannelSend::ChannelSend(
TaskQueueFactory::Priority::NORMAL)),
fixing_timestamp_stall_(
!field_trial::IsDisabled("WebRTC-Audio-FixTimestampStall")) {
- RTC_DCHECK(module_process_thread);
- module_process_thread_checker_.Detach();
-
audio_coding_.reset(AudioCodingModule::Create(AudioCodingModule::Config()));
RtpRtcpInterface::Configuration configuration;
@@ -504,8 +496,6 @@ ChannelSend::ChannelSend(
rtp_sender_audio_ = std::make_unique<RTPSenderAudio>(configuration.clock,
rtp_rtcp_->RtpSender());
- _moduleProcessThreadPtr->RegisterModule(rtp_rtcp_.get(), RTC_FROM_HERE);
-
// Ensure that RTCP is enabled by default for the created channel.
rtp_rtcp_->SetRTCPStatus(RtcpMode::kCompound);
@@ -525,9 +515,6 @@ ChannelSend::~ChannelSend() {
StopSend();
int error = audio_coding_->RegisterTransportCallback(NULL);
RTC_DCHECK_EQ(0, error);
-
- if (_moduleProcessThreadPtr)
- _moduleProcessThreadPtr->DeRegisterModule(rtp_rtcp_.get());
}
void ChannelSend::StartSend() {
@@ -858,7 +845,6 @@ ANAStats ChannelSend::GetANAStatistics() const {
}
RtpRtcpInterface* ChannelSend::GetRtpRtcp() const {
- RTC_DCHECK(module_process_thread_checker_.IsCurrent());
return rtp_rtcp_.get();
}
@@ -930,7 +916,6 @@ void ChannelSend::InitFrameTransformerDelegate(
std::unique_ptr<ChannelSendInterface> CreateChannelSend(
Clock* clock,
TaskQueueFactory* task_queue_factory,
- ProcessThread* module_process_thread,
Transport* rtp_transport,
RtcpRttStats* rtcp_rtt_stats,
RtcEventLog* rtc_event_log,
@@ -942,10 +927,10 @@ std::unique_ptr<ChannelSendInterface> CreateChannelSend(
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
TransportFeedbackObserver* feedback_observer) {
return std::make_unique<ChannelSend>(
- clock, task_queue_factory, module_process_thread, rtp_transport,
- rtcp_rtt_stats, rtc_event_log, frame_encryptor, crypto_options,
- extmap_allow_mixed, rtcp_report_interval_ms, ssrc,
- std::move(frame_transformer), feedback_observer);
+ clock, task_queue_factory, rtp_transport, rtcp_rtt_stats, rtc_event_log,
+ frame_encryptor, crypto_options, extmap_allow_mixed,
+ rtcp_report_interval_ms, ssrc, std::move(frame_transformer),
+ feedback_observer);
}
} // namespace voe
diff --git a/audio/channel_send.h b/audio/channel_send.h
index 2e23ef5d2d..cbdb3ee70a 100644
--- a/audio/channel_send.h
+++ b/audio/channel_send.h
@@ -28,7 +28,6 @@
namespace webrtc {
class FrameEncryptorInterface;
-class ProcessThread;
class RtcEventLog;
class RtpTransportControllerSendInterface;
@@ -126,7 +125,6 @@ class ChannelSendInterface {
std::unique_ptr<ChannelSendInterface> CreateChannelSend(
Clock* clock,
TaskQueueFactory* task_queue_factory,
- ProcessThread* module_process_thread,
Transport* rtp_transport,
RtcpRttStats* rtcp_rtt_stats,
RtcEventLog* rtc_event_log,
diff --git a/audio/voip/audio_channel.cc b/audio/voip/audio_channel.cc
index d11e6d79f9..b4a50eec12 100644
--- a/audio/voip/audio_channel.cc
+++ b/audio/voip/audio_channel.cc
@@ -32,12 +32,10 @@ AudioChannel::AudioChannel(
Transport* transport,
uint32_t local_ssrc,
TaskQueueFactory* task_queue_factory,
- ProcessThread* process_thread,
AudioMixer* audio_mixer,
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory)
- : audio_mixer_(audio_mixer), process_thread_(process_thread) {
+ : audio_mixer_(audio_mixer) {
RTC_DCHECK(task_queue_factory);
- RTC_DCHECK(process_thread);
RTC_DCHECK(audio_mixer);
Clock* clock = Clock::GetRealTimeClock();
@@ -56,9 +54,6 @@ AudioChannel::AudioChannel(
rtp_rtcp_->SetSendingMediaStatus(false);
rtp_rtcp_->SetRTCPStatus(RtcpMode::kCompound);
- // ProcessThread periodically services RTP stack for RTCP.
- process_thread_->RegisterModule(rtp_rtcp_.get(), RTC_FROM_HERE);
-
ingress_ = std::make_unique<AudioIngress>(rtp_rtcp_.get(), clock,
receive_statistics_.get(),
std::move(decoder_factory));
@@ -80,12 +75,10 @@ AudioChannel::~AudioChannel() {
audio_mixer_->RemoveSource(ingress_.get());
- // AudioEgress could hold current global TaskQueueBase that we need to clear
- // before ProcessThread::DeRegisterModule.
+ // TODO(bugs.webrtc.org/11581): unclear if we still need to clear |egress_|
+ // here.
egress_.reset();
ingress_.reset();
-
- process_thread_->DeRegisterModule(rtp_rtcp_.get());
}
bool AudioChannel::StartSend() {
diff --git a/audio/voip/audio_channel.h b/audio/voip/audio_channel.h
index 7b9fa6f74e..7338d9faab 100644
--- a/audio/voip/audio_channel.h
+++ b/audio/voip/audio_channel.h
@@ -22,7 +22,6 @@
#include "audio/voip/audio_egress.h"
#include "audio/voip/audio_ingress.h"
#include "modules/rtp_rtcp/source/rtp_rtcp_impl2.h"
-#include "modules/utility/include/process_thread.h"
#include "rtc_base/ref_count.h"
namespace webrtc {
@@ -35,7 +34,6 @@ class AudioChannel : public rtc::RefCountInterface {
AudioChannel(Transport* transport,
uint32_t local_ssrc,
TaskQueueFactory* task_queue_factory,
- ProcessThread* process_thread,
AudioMixer* audio_mixer,
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory);
~AudioChannel() override;
@@ -120,9 +118,6 @@ class AudioChannel : public rtc::RefCountInterface {
// Synchronization is handled internally by AudioMixer.
AudioMixer* audio_mixer_;
- // Synchronization is handled internally by ProcessThread.
- ProcessThread* process_thread_;
-
// Listed in order for safe destruction of AudioChannel object.
// Synchronization for these are handled internally.
std::unique_ptr<ReceiveStatistics> receive_statistics_;
diff --git a/audio/voip/test/audio_channel_unittest.cc b/audio/voip/test/audio_channel_unittest.cc
index f99d163022..a4f518c5bd 100644
--- a/audio/voip/test/audio_channel_unittest.cc
+++ b/audio/voip/test/audio_channel_unittest.cc
@@ -17,7 +17,6 @@
#include "modules/audio_mixer/audio_mixer_impl.h"
#include "modules/audio_mixer/sine_wave_generator.h"
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
-#include "modules/utility/include/process_thread.h"
#include "rtc_base/logging.h"
#include "test/gmock.h"
#include "test/gtest.h"
@@ -43,7 +42,6 @@ class AudioChannelTest : public ::testing::Test {
AudioChannelTest()
: fake_clock_(kStartTime), wave_generator_(1000.0, kAudioLevel) {
task_queue_factory_ = std::make_unique<MockTaskQueueFactory>(&task_queue_);
- process_thread_ = ProcessThread::Create("ModuleProcessThread");
audio_mixer_ = AudioMixerImpl::Create();
encoder_factory_ = CreateBuiltinAudioEncoderFactory();
decoder_factory_ = CreateBuiltinAudioDecoderFactory();
@@ -66,8 +64,8 @@ class AudioChannelTest : public ::testing::Test {
// simplify network routing logic.
rtc::scoped_refptr<AudioChannel> audio_channel =
rtc::make_ref_counted<AudioChannel>(
- &transport_, ssrc, task_queue_factory_.get(), process_thread_.get(),
- audio_mixer_.get(), decoder_factory_);
+ &transport_, ssrc, task_queue_factory_.get(), audio_mixer_.get(),
+ decoder_factory_);
audio_channel->SetEncoder(kPcmuPayload, kPcmuFormat,
encoder_factory_->MakeAudioEncoder(
kPcmuPayload, kPcmuFormat, absl::nullopt));
@@ -95,7 +93,6 @@ class AudioChannelTest : public ::testing::Test {
rtc::scoped_refptr<AudioMixer> audio_mixer_;
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_;
rtc::scoped_refptr<AudioEncoderFactory> encoder_factory_;
- std::unique_ptr<ProcessThread> process_thread_;
rtc::scoped_refptr<AudioChannel> audio_channel_;
};
diff --git a/audio/voip/test/voip_core_unittest.cc b/audio/voip/test/voip_core_unittest.cc
index 0d407601a3..896d0d98bb 100644
--- a/audio/voip/test/voip_core_unittest.cc
+++ b/audio/voip/test/voip_core_unittest.cc
@@ -14,7 +14,6 @@
#include "api/task_queue/default_task_queue_factory.h"
#include "modules/audio_device/include/mock_audio_device.h"
#include "modules/audio_processing/include/mock_audio_processing.h"
-#include "modules/utility/include/mock/mock_process_thread.h"
#include "test/gtest.h"
#include "test/mock_transport.h"
@@ -41,20 +40,15 @@ class VoipCoreTest : public ::testing::Test {
rtc::scoped_refptr<AudioProcessing> audio_processing =
rtc::make_ref_counted<NiceMock<test::MockAudioProcessing>>();
- auto process_thread = std::make_unique<NiceMock<MockProcessThread>>();
- // Hold the pointer to use for testing.
- process_thread_ = process_thread.get();
-
voip_core_ = std::make_unique<VoipCore>(
std::move(encoder_factory), std::move(decoder_factory),
CreateDefaultTaskQueueFactory(), audio_device_,
- std::move(audio_processing), std::move(process_thread));
+ std::move(audio_processing));
}
std::unique_ptr<VoipCore> voip_core_;
NiceMock<MockTransport> transport_;
rtc::scoped_refptr<test::MockAudioDeviceModule> audio_device_;
- NiceMock<MockProcessThread>* process_thread_;
};
// Validate expected API calls that involves with VoipCore. Some verification is
@@ -192,31 +186,5 @@ TEST_F(VoipCoreTest, StopSendAndPlayoutWithoutStarting) {
EXPECT_EQ(voip_core_->ReleaseChannel(channel), VoipResult::kOk);
}
-// This tests correctness on ProcessThread usage where we expect the first/last
-// channel creation/release triggers its Start/Stop method once only.
-TEST_F(VoipCoreTest, TestProcessThreadOperation) {
- EXPECT_CALL(*process_thread_, Start);
- EXPECT_CALL(*process_thread_, RegisterModule).Times(2);
-
- auto channel_one = voip_core_->CreateChannel(&transport_, 0xdeadc0de);
- auto channel_two = voip_core_->CreateChannel(&transport_, 0xdeadbeef);
-
- EXPECT_CALL(*process_thread_, Stop);
- EXPECT_CALL(*process_thread_, DeRegisterModule).Times(2);
-
- EXPECT_EQ(voip_core_->ReleaseChannel(channel_one), VoipResult::kOk);
- EXPECT_EQ(voip_core_->ReleaseChannel(channel_two), VoipResult::kOk);
-
- EXPECT_CALL(*process_thread_, Start);
- EXPECT_CALL(*process_thread_, RegisterModule);
-
- auto channel_three = voip_core_->CreateChannel(&transport_, absl::nullopt);
-
- EXPECT_CALL(*process_thread_, Stop);
- EXPECT_CALL(*process_thread_, DeRegisterModule);
-
- EXPECT_EQ(voip_core_->ReleaseChannel(channel_three), VoipResult::kOk);
-}
-
} // namespace
} // namespace webrtc
diff --git a/audio/voip/voip_core.cc b/audio/voip/voip_core.cc
index 67ae4c6521..fd66379f4a 100644
--- a/audio/voip/voip_core.cc
+++ b/audio/voip/voip_core.cc
@@ -41,18 +41,12 @@ VoipCore::VoipCore(rtc::scoped_refptr<AudioEncoderFactory> encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory,
std::unique_ptr<TaskQueueFactory> task_queue_factory,
rtc::scoped_refptr<AudioDeviceModule> audio_device_module,
- rtc::scoped_refptr<AudioProcessing> audio_processing,
- std::unique_ptr<ProcessThread> process_thread) {
+ rtc::scoped_refptr<AudioProcessing> audio_processing) {
encoder_factory_ = std::move(encoder_factory);
decoder_factory_ = std::move(decoder_factory);
task_queue_factory_ = std::move(task_queue_factory);
audio_device_module_ = std::move(audio_device_module);
audio_processing_ = std::move(audio_processing);
- process_thread_ = std::move(process_thread);
-
- if (!process_thread_) {
- process_thread_ = ProcessThread::Create("ModuleProcessThread");
- }
audio_mixer_ = AudioMixerImpl::Create();
// AudioTransportImpl depends on audio mixer and audio processing instances.
@@ -138,19 +132,13 @@ ChannelId VoipCore::CreateChannel(Transport* transport,
}
rtc::scoped_refptr<AudioChannel> channel =
- rtc::make_ref_counted<AudioChannel>(
- transport, local_ssrc.value(), task_queue_factory_.get(),
- process_thread_.get(), audio_mixer_.get(), decoder_factory_);
-
- // Check if we need to start the process thread.
- bool start_process_thread = false;
+ rtc::make_ref_counted<AudioChannel>(transport, local_ssrc.value(),
+ task_queue_factory_.get(),
+ audio_mixer_.get(), decoder_factory_);
{
MutexLock lock(&lock_);
- // Start process thread if the channel is the first one.
- start_process_thread = channels_.empty();
-
channel_id = static_cast<ChannelId>(next_channel_id_);
channels_[channel_id] = channel;
next_channel_id_++;
@@ -162,10 +150,6 @@ ChannelId VoipCore::CreateChannel(Transport* transport,
// Set ChannelId in audio channel for logging/debugging purpose.
channel->SetId(channel_id);
- if (start_process_thread) {
- process_thread_->Start();
- }
-
return channel_id;
}
@@ -194,9 +178,9 @@ VoipResult VoipCore::ReleaseChannel(ChannelId channel_id) {
}
if (no_channels_after_release) {
- // Release audio channel first to have it DeRegisterModule first.
+ // TODO(bugs.webrtc.org/11581): unclear if we still need to clear |channel|
+ // here.
channel = nullptr;
- process_thread_->Stop();
// Make sure to stop playout on ADM if it is playing.
if (audio_device_module_->Playing()) {
diff --git a/audio/voip/voip_core.h b/audio/voip/voip_core.h
index b7c1f2947f..359e07272d 100644
--- a/audio/voip/voip_core.h
+++ b/audio/voip/voip_core.h
@@ -33,7 +33,6 @@
#include "modules/audio_device/include/audio_device.h"
#include "modules/audio_mixer/audio_mixer_impl.h"
#include "modules/audio_processing/include/audio_processing.h"
-#include "modules/utility/include/process_thread.h"
#include "rtc_base/synchronization/mutex.h"
namespace webrtc {
@@ -61,8 +60,7 @@ class VoipCore : public VoipEngine,
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory,
std::unique_ptr<TaskQueueFactory> task_queue_factory,
rtc::scoped_refptr<AudioDeviceModule> audio_device_module,
- rtc::scoped_refptr<AudioProcessing> audio_processing,
- std::unique_ptr<ProcessThread> process_thread = nullptr);
+ rtc::scoped_refptr<AudioProcessing> audio_processing);
~VoipCore() override = default;
// Implements VoipEngine interfaces.
@@ -160,10 +158,6 @@ class VoipCore : public VoipEngine,
// Synchronization is handled internally by AudioDeviceModule.
rtc::scoped_refptr<AudioDeviceModule> audio_device_module_;
- // Synchronization is handled internally by ProcessThread.
- // Must be placed before |channels_| for proper destruction.
- std::unique_ptr<ProcessThread> process_thread_;
-
Mutex lock_;
// Member to track a next ChannelId for new AudioChannel.