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

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

Issue 1162583005: Exclude Nexus 6 from OpenSL ES usage (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebased 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 16 matching lines...) Expand all
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 is_communication_mode_enabled_( 36 is_communication_mode_enabled_(
37 native_reg->GetMethodId("isCommunicationModeEnabled", "()Z")) { 37 native_reg->GetMethodId("isCommunicationModeEnabled", "()Z")),
38 is_device_blacklisted_for_open_sles_usage_(
39 native_reg->GetMethodId(
40 "isDeviceBlacklistedForOpenSLESUsage", "()Z")) {
38 ALOGD("JavaAudioManager::ctor%s", GetThreadInfo().c_str()); 41 ALOGD("JavaAudioManager::ctor%s", GetThreadInfo().c_str());
39 } 42 }
40 43
41 AudioManager::JavaAudioManager::~JavaAudioManager() { 44 AudioManager::JavaAudioManager::~JavaAudioManager() {
42 ALOGD("JavaAudioManager::dtor%s", GetThreadInfo().c_str()); 45 ALOGD("JavaAudioManager::dtor%s", GetThreadInfo().c_str());
43 } 46 }
44 47
45 bool AudioManager::JavaAudioManager::Init() { 48 bool AudioManager::JavaAudioManager::Init() {
46 return audio_manager_->CallBooleanMethod(init_); 49 return audio_manager_->CallBooleanMethod(init_);
47 } 50 }
48 51
49 void AudioManager::JavaAudioManager::Close() { 52 void AudioManager::JavaAudioManager::Close() {
50 audio_manager_->CallVoidMethod(dispose_); 53 audio_manager_->CallVoidMethod(dispose_);
51 } 54 }
52 55
53 bool AudioManager::JavaAudioManager::IsCommunicationModeEnabled() { 56 bool AudioManager::JavaAudioManager::IsCommunicationModeEnabled() {
54 return audio_manager_->CallBooleanMethod(is_communication_mode_enabled_); 57 return audio_manager_->CallBooleanMethod(is_communication_mode_enabled_);
55 } 58 }
56 59
60 bool AudioManager::JavaAudioManager::IsDeviceBlacklistedForOpenSLESUsage() {
61 return audio_manager_->CallBooleanMethod(
62 is_device_blacklisted_for_open_sles_usage_);
63 }
64
57 // AudioManager implementation 65 // AudioManager implementation
58 AudioManager::AudioManager() 66 AudioManager::AudioManager()
59 : j_environment_(JVM::GetInstance()->environment()), 67 : j_environment_(JVM::GetInstance()->environment()),
60 audio_layer_(AudioDeviceModule::kPlatformDefaultAudio), 68 audio_layer_(AudioDeviceModule::kPlatformDefaultAudio),
61 initialized_(false), 69 initialized_(false),
62 hardware_aec_(false), 70 hardware_aec_(false),
63 low_latency_playout_(false), 71 low_latency_playout_(false),
64 delay_estimate_in_milliseconds_(0) { 72 delay_estimate_in_milliseconds_(0) {
65 ALOGD("ctor%s", GetThreadInfo().c_str()); 73 ALOGD("ctor%s", GetThreadInfo().c_str());
66 CHECK(j_environment_); 74 CHECK(j_environment_);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 140 }
133 141
134 bool AudioManager::IsAcousticEchoCancelerSupported() const { 142 bool AudioManager::IsAcousticEchoCancelerSupported() const {
135 DCHECK(thread_checker_.CalledOnValidThread()); 143 DCHECK(thread_checker_.CalledOnValidThread());
136 return hardware_aec_; 144 return hardware_aec_;
137 } 145 }
138 146
139 bool AudioManager::IsLowLatencyPlayoutSupported() const { 147 bool AudioManager::IsLowLatencyPlayoutSupported() const {
140 DCHECK(thread_checker_.CalledOnValidThread()); 148 DCHECK(thread_checker_.CalledOnValidThread());
141 ALOGD("IsLowLatencyPlayoutSupported()"); 149 ALOGD("IsLowLatencyPlayoutSupported()");
142 // TODO(henrika): enable again once issue in b/21485703 has been sorted out. 150 // Some devices are blacklisted for usage of OpenSL ES even if they report
143 // This is just a temporary fix. 151 // that low-latency playout is supported. See b/21485703 for details.
144 ALOGW("NOTE: OpenSL ES output is currently disabled!"); 152 return j_audio_manager_->IsDeviceBlacklistedForOpenSLESUsage() ?
145 return false; 153 false : low_latency_playout_;
146 } 154 }
147 155
148 int AudioManager::GetDelayEstimateInMilliseconds() const { 156 int AudioManager::GetDelayEstimateInMilliseconds() const {
149 return delay_estimate_in_milliseconds_; 157 return delay_estimate_in_milliseconds_;
150 } 158 }
151 159
152 void JNICALL AudioManager::CacheAudioParameters(JNIEnv* env, 160 void JNICALL AudioManager::CacheAudioParameters(JNIEnv* env,
153 jobject obj, 161 jobject obj,
154 jint sample_rate, 162 jint sample_rate,
155 jint channels, 163 jint channels,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 return playout_parameters_; 201 return playout_parameters_;
194 } 202 }
195 203
196 const AudioParameters& AudioManager::GetRecordAudioParameters() { 204 const AudioParameters& AudioManager::GetRecordAudioParameters() {
197 CHECK(record_parameters_.is_valid()); 205 CHECK(record_parameters_.is_valid());
198 DCHECK(thread_checker_.CalledOnValidThread()); 206 DCHECK(thread_checker_.CalledOnValidThread());
199 return record_parameters_; 207 return record_parameters_;
200 } 208 }
201 209
202 } // namespace webrtc 210 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698