Moves channel-dependent audio input processing to separate encoder task queue.
First approach to remove parts of the heavy load done for encoding, and
preparation for sending, from native audio thread to separate task queue.
With this change we will give the native input audio thread more time to
"relax" between successive audio captures.
Separate profiling done on Android has verified that the change works well;
the load is now redistributed and the load of the native AudioRecordThread
is reduced. Similar conclusions should be valid for all other OS:es as well.
BUG=NONE
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_compile_dbg,linux_android_rel_ng
Review-Url: https://codereview.webrtc.org/2665693002
Cr-Commit-Position: refs/heads/master@{#17488}
diff --git a/webrtc/voice_engine/shared_data.cc b/webrtc/voice_engine/shared_data.cc
index 57a1a59..e77f52a 100644
--- a/webrtc/voice_engine/shared_data.cc
+++ b/webrtc/voice_engine/shared_data.cc
@@ -27,19 +27,16 @@
_channelManager(_gInstanceCounter),
_engineStatistics(_gInstanceCounter),
_audioDevicePtr(NULL),
- _moduleProcessThreadPtr(
- ProcessThread::Create("VoiceProcessThread")) {
- Trace::CreateTrace();
- if (OutputMixer::Create(_outputMixerPtr, _gInstanceCounter) == 0)
- {
- _outputMixerPtr->SetEngineInformation(_engineStatistics);
- }
- if (TransmitMixer::Create(_transmitMixerPtr, _gInstanceCounter) == 0)
- {
- _transmitMixerPtr->SetEngineInformation(*_moduleProcessThreadPtr,
- _engineStatistics,
- _channelManager);
- }
+ _moduleProcessThreadPtr(ProcessThread::Create("VoiceProcessThread")),
+ encoder_queue_("AudioEncoderQueue") {
+ Trace::CreateTrace();
+ if (OutputMixer::Create(_outputMixerPtr, _gInstanceCounter) == 0) {
+ _outputMixerPtr->SetEngineInformation(_engineStatistics);
+ }
+ if (TransmitMixer::Create(_transmitMixerPtr, _gInstanceCounter) == 0) {
+ _transmitMixerPtr->SetEngineInformation(*_moduleProcessThreadPtr,
+ _engineStatistics, _channelManager);
+ }
}
SharedData::~SharedData()
@@ -53,6 +50,11 @@
Trace::ReturnTrace();
}
+rtc::TaskQueue* SharedData::encoder_queue() {
+ RTC_DCHECK_RUN_ON(&construction_thread_);
+ return &encoder_queue_;
+}
+
void SharedData::set_audio_device(
const rtc::scoped_refptr<AudioDeviceModule>& audio_device) {
_audioDevicePtr = audio_device;