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

Side by Side Diff: webrtc/modules/audio_device/android/audio_manager.cc

Issue 1165923002: Removes automatic setting of COMM mode in WebRTC (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Removed CHECK Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 15 matching lines...) Expand all
26 #define ALOGI(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__) 26 #define ALOGI(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__)
27 27
28 namespace webrtc { 28 namespace webrtc {
29 29
30 // AudioManager::JavaAudioManager implementation 30 // AudioManager::JavaAudioManager implementation
31 AudioManager::JavaAudioManager::JavaAudioManager( 31 AudioManager::JavaAudioManager::JavaAudioManager(
32 NativeRegistration* native_reg, rtc::scoped_ptr<GlobalRef> audio_manager) 32 NativeRegistration* native_reg, rtc::scoped_ptr<GlobalRef> audio_manager)
33 : audio_manager_(audio_manager.Pass()), 33 : audio_manager_(audio_manager.Pass()),
34 init_(native_reg->GetMethodId("init", "()Z")), 34 init_(native_reg->GetMethodId("init", "()Z")),
35 dispose_(native_reg->GetMethodId("dispose", "()V")), 35 dispose_(native_reg->GetMethodId("dispose", "()V")),
36 set_communication_mode_( 36 is_communication_mode_enabled_(
37 native_reg->GetMethodId("setCommunicationMode", "(Z)V")) { 37 native_reg->GetMethodId("isCommunicationModeEnabled", "()Z")) {
38 ALOGD("JavaAudioManager::ctor%s", GetThreadInfo().c_str()); 38 ALOGD("JavaAudioManager::ctor%s", GetThreadInfo().c_str());
39 } 39 }
40 40
41 AudioManager::JavaAudioManager::~JavaAudioManager() { 41 AudioManager::JavaAudioManager::~JavaAudioManager() {
42 ALOGD("JavaAudioManager::dtor%s", GetThreadInfo().c_str()); 42 ALOGD("JavaAudioManager::dtor%s", GetThreadInfo().c_str());
43 } 43 }
44 44
45 bool AudioManager::JavaAudioManager::Init() { 45 bool AudioManager::JavaAudioManager::Init() {
46 return audio_manager_->CallBooleanMethod(init_); 46 return audio_manager_->CallBooleanMethod(init_);
47 } 47 }
48 48
49 void AudioManager::JavaAudioManager::Close() { 49 void AudioManager::JavaAudioManager::Close() {
50 audio_manager_->CallVoidMethod(dispose_); 50 audio_manager_->CallVoidMethod(dispose_);
51 } 51 }
52 52
53 void AudioManager::JavaAudioManager::SetCommunicationMode(bool enable) { 53 bool AudioManager::JavaAudioManager::IsCommunicationModeEnabled() {
54 audio_manager_->CallVoidMethod(set_communication_mode_, 54 return audio_manager_->CallBooleanMethod(is_communication_mode_enabled_);
55 static_cast<jboolean>(enable));
56 } 55 }
57 56
58 // AudioManager implementation 57 // AudioManager implementation
59 AudioManager::AudioManager() 58 AudioManager::AudioManager()
60 : j_environment_(JVM::GetInstance()->environment()), 59 : j_environment_(JVM::GetInstance()->environment()),
61 audio_layer_(AudioDeviceModule::kPlatformDefaultAudio), 60 audio_layer_(AudioDeviceModule::kPlatformDefaultAudio),
62 initialized_(false), 61 initialized_(false),
63 hardware_aec_(false), 62 hardware_aec_(false),
64 low_latency_playout_(false), 63 low_latency_playout_(false),
65 delay_estimate_in_milliseconds_(0) { 64 delay_estimate_in_milliseconds_(0) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 bool AudioManager::Close() { 118 bool AudioManager::Close() {
120 ALOGD("Close%s", GetThreadInfo().c_str()); 119 ALOGD("Close%s", GetThreadInfo().c_str());
121 DCHECK(thread_checker_.CalledOnValidThread()); 120 DCHECK(thread_checker_.CalledOnValidThread());
122 if (!initialized_) 121 if (!initialized_)
123 return true; 122 return true;
124 j_audio_manager_->Close(); 123 j_audio_manager_->Close();
125 initialized_ = false; 124 initialized_ = false;
126 return true; 125 return true;
127 } 126 }
128 127
129 void AudioManager::SetCommunicationMode(bool enable) { 128 bool AudioManager::IsCommunicationModeEnabled() const {
130 ALOGD("SetCommunicationMode(%d)%s", enable, GetThreadInfo().c_str()); 129 ALOGD("IsCommunicationModeEnabled()");
131 DCHECK(thread_checker_.CalledOnValidThread()); 130 DCHECK(thread_checker_.CalledOnValidThread());
132 DCHECK(initialized_); 131 return j_audio_manager_->IsCommunicationModeEnabled();
133 j_audio_manager_->SetCommunicationMode(enable);
134 } 132 }
135 133
136 bool AudioManager::IsAcousticEchoCancelerSupported() const { 134 bool AudioManager::IsAcousticEchoCancelerSupported() const {
137 DCHECK(thread_checker_.CalledOnValidThread()); 135 DCHECK(thread_checker_.CalledOnValidThread());
138 return hardware_aec_; 136 return hardware_aec_;
139 } 137 }
140 138
141 bool AudioManager::IsLowLatencyPlayoutSupported() const { 139 bool AudioManager::IsLowLatencyPlayoutSupported() const {
142 DCHECK(thread_checker_.CalledOnValidThread()); 140 DCHECK(thread_checker_.CalledOnValidThread());
143 ALOGD("IsLowLatencyPlayoutSupported()"); 141 ALOGD("IsLowLatencyPlayoutSupported()");
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 return playout_parameters_; 193 return playout_parameters_;
196 } 194 }
197 195
198 const AudioParameters& AudioManager::GetRecordAudioParameters() { 196 const AudioParameters& AudioManager::GetRecordAudioParameters() {
199 CHECK(record_parameters_.is_valid()); 197 CHECK(record_parameters_.is_valid());
200 DCHECK(thread_checker_.CalledOnValidThread()); 198 DCHECK(thread_checker_.CalledOnValidThread());
201 return record_parameters_; 199 return record_parameters_;
202 } 200 }
203 201
204 } // namespace webrtc 202 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698