Exclude Nexus 6 from OpenSL ES usage
BUG=b/21485703 R=glaznev@webrtc.org Review URL: https://codereview.webrtc.org/1162583005 Cr-Commit-Position: refs/heads/master@{#9397}
This commit is contained in:
parent
72e9f04447
commit
8a8971820b
@ -34,7 +34,10 @@ AudioManager::JavaAudioManager::JavaAudioManager(
|
||||
init_(native_reg->GetMethodId("init", "()Z")),
|
||||
dispose_(native_reg->GetMethodId("dispose", "()V")),
|
||||
is_communication_mode_enabled_(
|
||||
native_reg->GetMethodId("isCommunicationModeEnabled", "()Z")) {
|
||||
native_reg->GetMethodId("isCommunicationModeEnabled", "()Z")),
|
||||
is_device_blacklisted_for_open_sles_usage_(
|
||||
native_reg->GetMethodId(
|
||||
"isDeviceBlacklistedForOpenSLESUsage", "()Z")) {
|
||||
ALOGD("JavaAudioManager::ctor%s", GetThreadInfo().c_str());
|
||||
}
|
||||
|
||||
@ -54,6 +57,11 @@ bool AudioManager::JavaAudioManager::IsCommunicationModeEnabled() {
|
||||
return audio_manager_->CallBooleanMethod(is_communication_mode_enabled_);
|
||||
}
|
||||
|
||||
bool AudioManager::JavaAudioManager::IsDeviceBlacklistedForOpenSLESUsage() {
|
||||
return audio_manager_->CallBooleanMethod(
|
||||
is_device_blacklisted_for_open_sles_usage_);
|
||||
}
|
||||
|
||||
// AudioManager implementation
|
||||
AudioManager::AudioManager()
|
||||
: j_environment_(JVM::GetInstance()->environment()),
|
||||
@ -139,10 +147,10 @@ bool AudioManager::IsAcousticEchoCancelerSupported() const {
|
||||
bool AudioManager::IsLowLatencyPlayoutSupported() const {
|
||||
DCHECK(thread_checker_.CalledOnValidThread());
|
||||
ALOGD("IsLowLatencyPlayoutSupported()");
|
||||
// TODO(henrika): enable again once issue in b/21485703 has been sorted out.
|
||||
// This is just a temporary fix.
|
||||
ALOGW("NOTE: OpenSL ES output is currently disabled!");
|
||||
return false;
|
||||
// Some devices are blacklisted for usage of OpenSL ES even if they report
|
||||
// that low-latency playout is supported. See b/21485703 for details.
|
||||
return j_audio_manager_->IsDeviceBlacklistedForOpenSLESUsage() ?
|
||||
false : low_latency_playout_;
|
||||
}
|
||||
|
||||
int AudioManager::GetDelayEstimateInMilliseconds() const {
|
||||
|
@ -98,12 +98,14 @@ class AudioManager {
|
||||
bool Init();
|
||||
void Close();
|
||||
bool IsCommunicationModeEnabled();
|
||||
bool IsDeviceBlacklistedForOpenSLESUsage();
|
||||
|
||||
private:
|
||||
rtc::scoped_ptr<GlobalRef> audio_manager_;
|
||||
jmethodID init_;
|
||||
jmethodID dispose_;
|
||||
jmethodID is_communication_mode_enabled_;
|
||||
jmethodID is_device_blacklisted_for_open_sles_usage_;
|
||||
};
|
||||
|
||||
AudioManager();
|
||||
|
@ -108,6 +108,17 @@ class WebRtcAudioManager {
|
||||
return (audioManager.getMode() == AudioManager.MODE_IN_COMMUNICATION);
|
||||
}
|
||||
|
||||
private boolean isDeviceBlacklistedForOpenSLESUsage() {
|
||||
boolean blacklisted =
|
||||
WebRtcAudioUtils.deviceIsBlacklistedForOpenSLESUsage();
|
||||
if (blacklisted) {
|
||||
// TODO(henrika): enable again for all devices once issue in b/21485703
|
||||
// has been resolved.
|
||||
Loge(Build.MODEL + " is blacklisted for OpenSL ES usage!");
|
||||
}
|
||||
return blacklisted;
|
||||
}
|
||||
|
||||
private void storeAudioParameters() {
|
||||
// Only mono is supported currently (in both directions).
|
||||
// TODO(henrika): add support for stereo playout.
|
||||
|
@ -35,6 +35,13 @@ public final class WebRtcAudioUtils {
|
||||
"D6503", // Sony Xperia Z2 D6503
|
||||
};
|
||||
|
||||
// List of devices where we have seen issues (e.g. bad audio quality) using
|
||||
// the low latency ouput mode in combination with OpenSL ES.
|
||||
// The device name is given by Build.MODEL.
|
||||
private static final String[] BLACKLISTED_OPEN_SL_ES_MODELS = new String[] {
|
||||
"Nexus 6", // Nexus 6
|
||||
};
|
||||
|
||||
// Use 44.1kHz as the default sampling rate.
|
||||
private static final int SAMPLE_RATE_HZ = 44100;
|
||||
|
||||
@ -76,6 +83,13 @@ public final class WebRtcAudioUtils {
|
||||
return blackListedModels.contains(Build.MODEL);
|
||||
}
|
||||
|
||||
// Returns true if the device is blacklisted for OpenSL ES usage.
|
||||
public static boolean deviceIsBlacklistedForOpenSLESUsage() {
|
||||
List<String> blackListedModels =
|
||||
Arrays.asList(BLACKLISTED_OPEN_SL_ES_MODELS);
|
||||
return blackListedModels.contains(Build.MODEL);
|
||||
}
|
||||
|
||||
// Returns true if the device supports Acoustic Echo Canceler (AEC).
|
||||
public static boolean isAcousticEchoCancelerSupported() {
|
||||
// AcousticEchoCanceler was added in API level 16 (Jelly Bean).
|
||||
|
Loading…
x
Reference in New Issue
Block a user