Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Unified Diff: webrtc/media/engine/webrtcvoiceengine.cc

Issue 2446143002: Start using APM directly in WVoMC (not VoEAudioProcessing) (Closed)
Patch Set: android build error Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.h ('k') | webrtc/media/engine/webrtcvoiceengine_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/engine/webrtcvoiceengine.cc
diff --git a/webrtc/media/engine/webrtcvoiceengine.cc b/webrtc/media/engine/webrtcvoiceengine.cc
index 4f6166556acab033171b67b0f01b85fa58e81dc3..ebcd1613946cbf82b07fdbe1f1b36bffa885bcb4 100644
--- a/webrtc/media/engine/webrtcvoiceengine.cc
+++ b/webrtc/media/engine/webrtcvoiceengine.cc
@@ -553,6 +553,9 @@ WebRtcVoiceEngine::WebRtcVoiceEngine(
}
RTC_DCHECK(adm_);
+ apm_ = voe_wrapper_->base()->audio_processing();
+ RTC_DCHECK(apm_);
+
// Save the default AGC configuration settings. This must happen before
// calling ApplyOptions or the default will be overwritten.
int error = voe_wrapper_->processing()->GetAgcConfig(default_agc_config_);
@@ -877,13 +880,8 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
}
}
- // We check audioproc for the benefit of tests, since FakeWebRtcVoiceEngine
- // returns NULL on audio_processing().
- webrtc::AudioProcessing* audioproc = voe_wrapper_->base()->audio_processing();
- if (audioproc) {
- audioproc->SetExtraOptions(config);
- audioproc->ApplyConfig(apm_config);
- }
+ apm()->SetExtraOptions(config);
+ apm()->ApplyConfig(apm_config);
if (options.recording_sample_rate) {
LOG(LS_INFO) << "Recording sample rate is "
@@ -916,10 +914,8 @@ void WebRtcVoiceEngine::SetDefaultDevices() {
LOG_RTCERR1(SetRecordingDevice, in_id);
ret = false;
}
- webrtc::AudioProcessing* ap = voe()->base()->audio_processing();
- if (ap) {
- ap->Initialize();
- }
+
+ apm()->Initialize();
if (voe_wrapper_->hw()->SetPlayoutDevice(out_id) == -1) {
LOG_RTCERR1(SetPlayoutDevice, out_id);
@@ -1040,8 +1036,7 @@ bool WebRtcVoiceEngine::StartAecDump(rtc::PlatformFile file,
return false;
}
StopAecDump();
- if (voe_wrapper_->base()->audio_processing()->StartDebugRecording(
- aec_dump_file_stream, max_size_bytes) !=
+ if (apm()->StartDebugRecording(aec_dump_file_stream, max_size_bytes) !=
webrtc::AudioProcessing::kNoError) {
LOG_RTCERR0(StartDebugRecording);
fclose(aec_dump_file_stream);
@@ -1055,8 +1050,8 @@ void WebRtcVoiceEngine::StartAecDump(const std::string& filename) {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
if (!is_dumping_aec_) {
// Start dumping AEC when we are not dumping.
- if (voe_wrapper_->base()->audio_processing()->StartDebugRecording(
- filename.c_str(), -1) != webrtc::AudioProcessing::kNoError) {
+ if (apm()->StartDebugRecording(filename.c_str(), -1) !=
+ webrtc::AudioProcessing::kNoError) {
LOG_RTCERR1(StartDebugRecording, filename.c_str());
} else {
is_dumping_aec_ = true;
@@ -1068,8 +1063,7 @@ void WebRtcVoiceEngine::StopAecDump() {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
if (is_dumping_aec_) {
// Stop dumping AEC when we are dumping.
- if (voe_wrapper_->base()->audio_processing()->StopDebugRecording() !=
- webrtc::AudioProcessing::kNoError) {
+ if (apm()->StopDebugRecording() != webrtc::AudioProcessing::kNoError) {
LOG_RTCERR0(StopDebugRecording);
}
is_dumping_aec_ = false;
@@ -1087,6 +1081,12 @@ webrtc::AudioDeviceModule* WebRtcVoiceEngine::adm() {
return adm_;
}
+webrtc::AudioProcessing* WebRtcVoiceEngine::apm() {
+ RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
+ RTC_DCHECK(apm_);
+ return apm_;
+}
+
AudioCodecs WebRtcVoiceEngine::CollectRecvCodecs() const {
PayloadTypeMapper mapper;
AudioCodecs out;
@@ -2378,11 +2378,8 @@ bool WebRtcVoiceMediaChannel::MuteStream(uint32_t ssrc, bool muted) {
for (const auto& kv : send_streams_) {
all_muted = all_muted && kv.second->muted();
}
+ engine()->apm()->set_output_will_be_muted(all_muted);
- webrtc::AudioProcessing* ap = engine()->voe()->base()->audio_processing();
- if (ap) {
- ap->set_output_will_be_muted(all_muted);
- }
return true;
}
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.h ('k') | webrtc/media/engine/webrtcvoiceengine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698