diff options
author | Pawit Pornkitprasan <p.pawit@gmail.com> | 2012-01-03 15:22:08 +0700 |
---|---|---|
committer | Pawit Pornkitprasan <p.pawit@gmail.com> | 2012-01-03 15:22:08 +0700 |
commit | 04fefe1c30fbe93e0290612fdc0d98e7e2ff9ef9 (patch) | |
tree | 02aebf433706990275cd25d7f911ab953d81e668 | |
parent | d32bdafb88508e897467973befb0944798a1d71e (diff) | |
download | device_samsung_aries-common-04fefe1c30fbe93e0290612fdc0d98e7e2ff9ef9.zip device_samsung_aries-common-04fefe1c30fbe93e0290612fdc0d98e7e2ff9ef9.tar.gz device_samsung_aries-common-04fefe1c30fbe93e0290612fdc0d98e7e2ff9ef9.tar.bz2 |
aries-common: libaudio fixes from crespo
commit c79f9430a7aa73b8163c8be0e749517204e7950a
Author: Eric Laurent <elaurent@google.com>
Date: Thu Sep 8 18:36:19 2011 -0700
audio HAL: fix some audio mode transitions
The logic controlling the CP clock and audio path in setMode()
was incorrect for certain transitions. In particular, the sequence
IN_CALL -> RINGTONE -> IN_COMMUNICATION -> IN_CALL would cause a
loss of call audio.
Change-Id: I4a6bcca32e6e33f965874ad2219f2728b9035e4a
commit 0859b44015b1e137146cb9be9d09579835430880
Author: Eric Laurent <elaurent@google.com>
Date: Thu Mar 17 18:57:48 2011 -0700
Fix issue 4126225: setMicMute() execution time
The cause is that the thread executing setMicMute() can wait for
several seconds before acquiring the input thread mutex when audio
capture is active.
The fix consists in forcing a sleep of the capture thread when
standby() (called by setMicMute()) wants the mutex.
Applied the same fix to output stream and to setParameters() function.
Change-Id: I3e55670d2aad16b67d44ca8582ed16398143ff6e
commit 240a174d3edc05c82821ab89337d3420cbc1564c
Author: UK KIM <w0806.kim@samsung.com>
Date: Sat Feb 19 04:08:30 2011 +0900
SOUND: set incall volume when user starts call.
modem side doesn't store volume setting when device is rebooted.
When audio mode is incall, set current voice volume to modem.
Current incall volume is stored when upper layer sets or AudioService is started.
Change-Id: Icfeb0273dda55354e207d464884ef99f41c5fdec
Signed-off-by: UK KIM <w0806.kim@samsung.com>
Change-Id: I13ff29935913a13a7ff200ae01ac69b01cd06c87
-rw-r--r-- | libaudio/AudioHardware.cpp | 55 | ||||
-rw-r--r-- | libaudio/AudioHardware.h | 3 |
2 files changed, 42 insertions, 16 deletions
diff --git a/libaudio/AudioHardware.cpp b/libaudio/AudioHardware.cpp index 3e28448..771fa5e 100644 --- a/libaudio/AudioHardware.cpp +++ b/libaudio/AudioHardware.cpp @@ -90,6 +90,7 @@ AudioHardware::AudioHardware() : mPcmOpenCnt(0), mMixerOpenCnt(0), mInCallAudioMode(false), + mVoiceVol(1.0f), mInputSource(AUDIO_SOURCE_DEFAULT), mBluetoothNrec(true), mTTYMode(TTY_MODE_OFF), @@ -370,8 +371,10 @@ status_t AudioHardware::setMode(int mode) status = AudioHardwareBase::setMode(mode); LOGV("setMode() : new %d, old %d", mMode, prevMode); if (status == NO_ERROR) { + bool modeNeedsCPActive = mMode == AudioSystem::MODE_IN_CALL || + mMode == AudioSystem::MODE_RINGTONE; // activate call clock in radio when entering in call or ringtone mode - if (prevMode == AudioSystem::MODE_NORMAL) + if (modeNeedsCPActive) { if ((!mActivatedCP) && (mSecRilLibHandle) && (connectRILDIfRequired() == OK)) { setCallClockSync(mRilClient, SOUND_CLOCK_START); @@ -393,9 +396,10 @@ status_t AudioHardware::setMode(int mode) openPcmOut_l(); openMixer_l(); setInputSource_l(AUDIO_SOURCE_DEFAULT); + setVoiceVolume_l(mVoiceVol); mInCallAudioMode = true; } - if (mMode == AudioSystem::MODE_NORMAL && mInCallAudioMode) { + if (mMode != AudioSystem::MODE_IN_CALL && mInCallAudioMode) { setInputSource_l(mInputSource); if (mMixer != NULL) { TRACE_DRIVER_IN(DRV_MIXER_GET) @@ -424,7 +428,7 @@ status_t AudioHardware::setMode(int mode) mInCallAudioMode = false; } - if (mMode == AudioSystem::MODE_NORMAL) { + if (!modeNeedsCPActive) { if(mActivatedCP) mActivatedCP = false; } @@ -573,12 +577,21 @@ size_t AudioHardware::getInputBufferSize(uint32_t sampleRate, int format, int ch return AudioStreamInALSA::getBufferSize(sampleRate, channelCount); } - status_t AudioHardware::setVoiceVolume(float volume) { - LOGD("### setVoiceVolume"); - AutoMutex lock(mLock); + + setVoiceVolume_l(volume); + + return NO_ERROR; +} + +void AudioHardware::setVoiceVolume_l(float volume) +{ + LOGD("### setVoiceVolume_l"); + + mVoiceVol = volume; + if ( (AudioSystem::MODE_IN_CALL == mMode) && (mSecRilLibHandle) && (connectRILDIfRequired() == OK) ) { @@ -622,7 +635,6 @@ status_t AudioHardware::setVoiceVolume(float volume) setCallVolume(mRilClient, type, int_volume); } - return NO_ERROR; } status_t AudioHardware::setMasterVolume(float volume) @@ -1302,12 +1314,16 @@ status_t AudioHardware::AudioStreamOutALSA::standby() { if (mHardware == NULL) return NO_INIT; - AutoMutex lock(mLock); + mSleepReq = true; + { + AutoMutex lock(mLock); + mSleepReq = false; - { // scope for the AudioHardware lock - AutoMutex hwLock(mHardware->lock()); + { // scope for the AudioHardware lock + AutoMutex hwLock(mHardware->lock()); - doStandby_l(); + doStandby_l(); + } } return NO_ERROR; @@ -1420,9 +1436,10 @@ status_t AudioHardware::AudioStreamOutALSA::setParameters(const String8& keyValu if (mHardware == NULL) return NO_INIT; + mSleepReq = true; { AutoMutex lock(mLock); - + mSleepReq = false; if (param.getInt(String8(AudioParameter::keyRouting), device) == NO_ERROR) { if (device != 0) { @@ -1669,12 +1686,16 @@ status_t AudioHardware::AudioStreamInALSA::standby() { if (mHardware == NULL) return NO_INIT; - AutoMutex lock(mLock); + mSleepReq = true; + { + AutoMutex lock(mLock); + mSleepReq = false; - { // scope for AudioHardware lock - AutoMutex hwLock(mHardware->lock()); + { // scope for AudioHardware lock + AutoMutex hwLock(mHardware->lock()); - doStandby_l(); + doStandby_l(); + } } return NO_ERROR; } @@ -1806,8 +1827,10 @@ status_t AudioHardware::AudioStreamInALSA::setParameters(const String8& keyValue if (mHardware == NULL) return NO_INIT; + mSleepReq = true; { AutoMutex lock(mLock); + mSleepReq = false; if (param.getInt(String8(AudioParameter::keyInputSource), value) == NO_ERROR) { AutoMutex hwLock(mHardware->lock()); diff --git a/libaudio/AudioHardware.h b/libaudio/AudioHardware.h index 8a781bf..0fa368c 100644 --- a/libaudio/AudioHardware.h +++ b/libaudio/AudioHardware.h @@ -128,6 +128,8 @@ public: status_t setInputSource_l(audio_source source); + void setVoiceVolume_l(float volume); + static uint32_t getInputSampleRate(uint32_t sampleRate); sp <AudioStreamInALSA> getActiveInput_l(); @@ -163,6 +165,7 @@ private: uint32_t mPcmOpenCnt; uint32_t mMixerOpenCnt; bool mInCallAudioMode; + float mVoiceVol; audio_source mInputSource; bool mBluetoothNrec; |