Minor fix for improving logging of supported platform effects

BUG=NONE
R=magjed@webrtc.org

Review URL: https://codereview.webrtc.org/1370443003 .

Cr-Commit-Position: refs/heads/master@{#10053}
This commit is contained in:
henrika
2015-09-24 15:58:38 +02:00
parent 6b8d355168
commit 9236bb1e08

View File

@ -211,10 +211,10 @@ class WebRtcAudioEffects {
for (Descriptor d : AudioEffect.queryEffects()) { for (Descriptor d : AudioEffect.queryEffects()) {
if (effectTypeIsVoIP(d.type)) { if (effectTypeIsVoIP(d.type)) {
// Only log information for VoIP effects (AEC, AEC and NS). // Only log information for VoIP effects (AEC, AEC and NS).
Logging.d(TAG, "name: " + d.name + ", " + Logging.d(TAG, "name: " + d.name + ", "
"mode: " + d.connectMode + ", " + + "mode: " + d.connectMode + ", "
"implementor: " + d.implementor + ", " + + "implementor: " + d.implementor + ", "
"UUID: " + d.uuid); + "UUID: " + d.uuid);
} }
} }
} }
@ -292,10 +292,11 @@ class WebRtcAudioEffects {
if (aec.setEnabled(enable) != AudioEffect.SUCCESS) { if (aec.setEnabled(enable) != AudioEffect.SUCCESS) {
Logging.e(TAG, "Failed to set the AcousticEchoCanceler state"); Logging.e(TAG, "Failed to set the AcousticEchoCanceler state");
} }
Logging.d(TAG, "AcousticEchoCanceler: was " + Logging.d(TAG, "AcousticEchoCanceler: was "
(enabled ? "enabled" : "disabled") + + (enabled ? "enabled" : "disabled")
", enable: " + enable + ", is now: " + + ", enable: " + enable + ", is now: "
(aec.getEnabled() ? "enabled" : "disabled")); + (aec.getEnabled() ? "enabled" : "disabled")
+ ", has control: " + aec.hasControl());
} else { } else {
Logging.e(TAG, "Failed to create the AcousticEchoCanceler instance"); Logging.e(TAG, "Failed to create the AcousticEchoCanceler instance");
} }
@ -311,10 +312,11 @@ class WebRtcAudioEffects {
if (agc.setEnabled(enable) != AudioEffect.SUCCESS) { if (agc.setEnabled(enable) != AudioEffect.SUCCESS) {
Logging.e(TAG, "Failed to set the AutomaticGainControl state"); Logging.e(TAG, "Failed to set the AutomaticGainControl state");
} }
Logging.d(TAG, "AutomaticGainControl: was " + Logging.d(TAG, "AutomaticGainControl: was "
(enabled ? "enabled" : "disabled") + + (enabled ? "enabled" : "disabled")
", enable: " + enable + ", is now: " + + ", enable: " + enable + ", is now: "
(agc.getEnabled() ? "enabled" : "disabled")); + (agc.getEnabled() ? "enabled" : "disabled")
+ ", has control: " + agc.hasControl());
} else { } else {
Logging.e(TAG, "Failed to create the AutomaticGainControl instance"); Logging.e(TAG, "Failed to create the AutomaticGainControl instance");
} }
@ -330,10 +332,11 @@ class WebRtcAudioEffects {
if (ns.setEnabled(enable) != AudioEffect.SUCCESS) { if (ns.setEnabled(enable) != AudioEffect.SUCCESS) {
Logging.e(TAG, "Failed to set the NoiseSuppressor state"); Logging.e(TAG, "Failed to set the NoiseSuppressor state");
} }
Logging.d(TAG, "NoiseSuppressor: was " + Logging.d(TAG, "NoiseSuppressor: was "
(enabled ? "enabled" : "disabled") + + (enabled ? "enabled" : "disabled")
", enable: " + enable + ", is now: " + + ", enable: " + enable + ", is now: "
(ns.getEnabled() ? "enabled" : "disabled")); + (ns.getEnabled() ? "enabled" : "disabled")
+ ", has control: " + ns.hasControl());
} else { } else {
Logging.e(TAG, "Failed to create the NoiseSuppressor instance"); Logging.e(TAG, "Failed to create the NoiseSuppressor instance");
} }
@ -361,11 +364,18 @@ class WebRtcAudioEffects {
// Returns true for effect types in |type| that are of "VoIP" types: // Returns true for effect types in |type| that are of "VoIP" types:
// Acoustic Echo Canceler (AEC) or Automatic Gain Control (AGC) or // Acoustic Echo Canceler (AEC) or Automatic Gain Control (AGC) or
// Noise Suppressor (NS). // Noise Suppressor (NS). Note that, an extra check for support is needed
// in each comparison since some devices includes effects in the
// AudioEffect.Descriptor array that are actually not available on the device.
// As an example: Samsung Galaxy S6 includes an AGC in the descriptor but
// AutomaticGainControl.isAvailable() returns false.
private boolean effectTypeIsVoIP(UUID type) { private boolean effectTypeIsVoIP(UUID type) {
return AudioEffect.EFFECT_TYPE_AEC.equals(type) return (AudioEffect.EFFECT_TYPE_AEC.equals(type)
|| AudioEffect.EFFECT_TYPE_AGC.equals(type) && isAcousticEchoCancelerSupported())
|| AudioEffect.EFFECT_TYPE_NS.equals(type); || (AudioEffect.EFFECT_TYPE_AGC.equals(type)
&& isAutomaticGainControlSupported())
|| (AudioEffect.EFFECT_TYPE_NS.equals(type)
&& isNoiseSuppressorSupported());
} }
// Helper method which throws an exception when an assertion has failed. // Helper method which throws an exception when an assertion has failed.