summaryrefslogtreecommitdiffstats
path: root/voip
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2010-11-15 12:11:32 -0800
committerJean-Michel Trivi <jmtrivi@google.com>2011-01-26 11:20:01 -0800
commit2ba92c71b5684dce700cf848bf157153c156df1d (patch)
tree4a5fd1c92f47a6557552adbb65898c35866d9662 /voip
parent138757db4f19cb626ef5c1d371d4fca004304a08 (diff)
downloadframeworks_base-2ba92c71b5684dce700cf848bf157153c156df1d.zip
frameworks_base-2ba92c71b5684dce700cf848bf157153c156df1d.tar.gz
frameworks_base-2ba92c71b5684dce700cf848bf157153c156df1d.tar.bz2
do not merge bug 3370834 Cherrypick from master
Cherripick from master CL 79833, 79417, 78864, 80332, 87500 Add new audio mode and recording source for audio communications other than telelphony. The audio mode MODE_IN_CALL signals the system the device a phone call is currently underway. There was no way for audio video chat or VoIP applications to signal a call is underway, but not using the telephony resources. This change introduces a new mode to address this. Changes in other parts of the system (java and native) are required to take this new mode into account. The generic AudioPolicyManager is updated to not use its phone state variable directly, but to use two new convenience methods, isInCall() and isStateInCall(int) instead. Add a recording source used to designate a recording stream for voice communications such as VoIP. Update the platform-independent audio policy manager to pass the nature of the audio recording source to the audio policy client interface through the AudioPolicyClientInterface::setParameters() method. SIP calls should set the audio mode to MODE_IN_COMMUNICATION, Audio mode MODE_IN_CALL is reserved for telephony. SIP: Enable built-in echo canceler if available. 1. Always initialize AudioRecord with VOICE_COMMUNICATION. 2. If echo canceler is available, disable our echo suppressor. Note that this CL is intentionally not correcting the getAudioSourceMax() return value in MediaRecorder.java as the new source is hidden here. Change-Id: Ie68cd03c50553101aa2ad838fe9459b2cf151bc8
Diffstat (limited to 'voip')
-rw-r--r--voip/jni/rtp/AudioGroup.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/voip/jni/rtp/AudioGroup.cpp b/voip/jni/rtp/AudioGroup.cpp
index 60abf2a..2cbd023 100644
--- a/voip/jni/rtp/AudioGroup.cpp
+++ b/voip/jni/rtp/AudioGroup.cpp
@@ -483,7 +483,7 @@ public:
ON_HOLD = 0,
MUTED = 1,
NORMAL = 2,
- EC_ENABLED = 3,
+ ECHO_SUPPRESSION = 3,
LAST_MODE = 3,
};
@@ -619,6 +619,10 @@ bool AudioGroup::setMode(int mode)
if (mode < 0 || mode > LAST_MODE) {
return false;
}
+ if (mode == ECHO_SUPPRESSION && AudioSystem::getParameters(
+ 0, String8("ec_supported")) == "ec_supported=yes") {
+ mode = NORMAL;
+ }
if (mMode == mode) {
return true;
}
@@ -775,8 +779,8 @@ bool AudioGroup::DeviceThread::threadLoop()
AudioTrack track;
AudioRecord record;
if (track.set(AudioSystem::VOICE_CALL, sampleRate, AudioSystem::PCM_16_BIT,
- AudioSystem::CHANNEL_OUT_MONO, output) != NO_ERROR ||
- record.set(AUDIO_SOURCE_MIC, sampleRate, AudioSystem::PCM_16_BIT,
+ AudioSystem::CHANNEL_OUT_MONO, output) != NO_ERROR || record.set(
+ AUDIO_SOURCE_VOICE_COMMUNICATION, sampleRate, AudioSystem::PCM_16_BIT,
AudioSystem::CHANNEL_IN_MONO, input) != NO_ERROR) {
LOGE("cannot initialize audio device");
return false;