diff options
author | Jean-Baptiste Queru <jbq@google.com> | 2009-04-22 17:12:34 -0700 |
---|---|---|
committer | Jean-Baptiste Queru <jbq@google.com> | 2009-04-22 17:12:34 -0700 |
commit | 2bcce3696e2fbb2f54f9e0fd18c40a83b2ba11fc (patch) | |
tree | 0057538044583548295d59f7e7c31bc8f5635f48 /libs | |
parent | 37cb461e21c3328bbd6567696a13dfba14136ac6 (diff) | |
parent | 91a678088520abf63c1484d284629833877ff938 (diff) | |
download | frameworks_native-2bcce3696e2fbb2f54f9e0fd18c40a83b2ba11fc.zip frameworks_native-2bcce3696e2fbb2f54f9e0fd18c40a83b2ba11fc.tar.gz frameworks_native-2bcce3696e2fbb2f54f9e0fd18c40a83b2ba11fc.tar.bz2 |
Merge donut into master
Diffstat (limited to 'libs')
-rw-r--r-- | libs/audioflinger/AudioFlinger.cpp | 46 | ||||
-rw-r--r-- | libs/audioflinger/AudioFlinger.h | 1 | ||||
-rw-r--r-- | libs/audioflinger/AudioHardwareInterface.cpp | 2 |
3 files changed, 15 insertions, 34 deletions
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp index 43df7dd..a4050b3 100644 --- a/libs/audioflinger/AudioFlinger.cpp +++ b/libs/audioflinger/AudioFlinger.cpp @@ -655,16 +655,12 @@ status_t AudioFlinger::setStreamVolume(int stream, float value) if (stream == AudioSystem::VOICE_CALL || stream == AudioSystem::BLUETOOTH_SCO) { - float hwValue = value; + float hwValue; if (stream == AudioSystem::VOICE_CALL) { hwValue = (float)AudioSystem::logToLinear(value)/100.0f; - // FIXME: This is a temporary fix to re-base the internally - // generated in-call audio so that it is never muted, which is - // already the case for the hardware routed in-call audio. - // When audio stream handling is reworked, this should be - // addressed more cleanly. Fixes #1324; see discussion at - // http://review.source.android.com/8224 - value = value * 0.99 + 0.01; + // offset value to reflect actual hardware volume that never reaches 0 + // 1% corresponds roughly to first step in VOICE_CALL stream volume setting (see AudioService.java) + value = 0.01 + 0.99 * value; } else { // (type == AudioSystem::BLUETOOTH_SCO) hwValue = 1.0f; } @@ -681,6 +677,11 @@ status_t AudioFlinger::setStreamVolume(int stream, float value) mA2dpMixerThread->setStreamVolume(stream, value); #endif + mHardwareMixerThread->setStreamVolume(stream, value); +#ifdef WITH_A2DP + mA2dpMixerThread->setStreamVolume(stream, value); +#endif + return ret; } @@ -718,15 +719,14 @@ float AudioFlinger::streamVolume(int stream) const if (uint32_t(stream) >= AudioSystem::NUM_STREAM_TYPES) { return 0.0f; } - float value = mHardwareMixerThread->streamVolume(stream); + float volume = mHardwareMixerThread->streamVolume(stream); + // remove correction applied by setStreamVolume() if (stream == AudioSystem::VOICE_CALL) { - // FIXME: Re-base internally generated in-call audio, - // reverse of above in setStreamVolume. - value = (value - 0.01) / 0.99; + volume = (volume - 0.01) / 0.99 ; } - return value; + return volume; } bool AudioFlinger::streamMute(int stream) const @@ -829,17 +829,12 @@ void AudioFlinger::handleForcedSpeakerRoute(int command) if (mForcedRoute == 0 && !(mSavedRoute & AudioSystem::ROUTE_SPEAKER)) { LOGV("Route forced to Speaker ON %08x", mSavedRoute | AudioSystem::ROUTE_SPEAKER); mHardwareMixerThread->setStreamMute(AudioSystem::MUSIC, true); - mHardwareStatus = AUDIO_HW_SET_MASTER_VOLUME; - mAudioHardware->setMasterVolume(0); usleep(mHardwareMixerThread->latency()*1000); mHardwareStatus = AUDIO_HW_SET_ROUTING; mAudioHardware->setRouting(AudioSystem::MODE_NORMAL, mSavedRoute | AudioSystem::ROUTE_SPEAKER); mHardwareStatus = AUDIO_HW_IDLE; // delay track start so that audio hardware has time to siwtch routes usleep(kStartSleepTime); - mHardwareStatus = AUDIO_HW_SET_MASTER_VOLUME; - mAudioHardware->setMasterVolume(mHardwareMixerThread->masterVolume()); - mHardwareStatus = AUDIO_HW_IDLE; } mForcedRoute = AudioSystem::ROUTE_SPEAKER; } @@ -1497,18 +1492,6 @@ status_t AudioFlinger::MixerThread::addTrack_l(const sp<Track>& track) return status; } -// removeTrack_l() must be called with AudioFlinger::mLock held -void AudioFlinger::MixerThread::removeTrack_l(wp<Track> track, int name) -{ - sp<Track> t = track.promote(); - if (t!=NULL && (t->mState <= TrackBase::STOPPED)) { - t->reset(); - deleteTrackName_l(name); - removeActiveTrack_l(track); - mAudioFlinger->mWaitWorkCV.broadcast(); - } -} - // destroyTrack_l() must be called with AudioFlinger::mLock held void AudioFlinger::MixerThread::destroyTrack_l(const sp<Track>& track) { @@ -1714,7 +1697,7 @@ void* AudioFlinger::MixerThread::TrackBase::getBuffer(uint32_t offset, uint32_t // Check validity of returned pointer in case the track control block would have been corrupted. if (bufferStart < mBuffer || bufferStart > bufferEnd || bufferEnd > mBufferEnd || - cblk->channels == 2 && ((unsigned long)bufferStart & 3) ) { + (cblk->channels == 2 && ((unsigned long)bufferStart & 3))) { LOGE("TrackBase::getBuffer buffer out of range:\n start: %p, end %p , mBuffer %p mBufferEnd %p\n \ server %d, serverBase %d, user %d, userBase %d, channels %d", bufferStart, bufferEnd, mBuffer, mBufferEnd, @@ -1750,7 +1733,6 @@ AudioFlinger::MixerThread::Track::~Track() wp<Track> weak(this); // never create a strong ref from the dtor Mutex::Autolock _l(mMixerThread->mAudioFlinger->mLock); mState = TERMINATED; - mMixerThread->removeTrack_l(weak, mName); } void AudioFlinger::MixerThread::Track::destroy() diff --git a/libs/audioflinger/AudioFlinger.h b/libs/audioflinger/AudioFlinger.h index db5cc74..c7ca9ec 100644 --- a/libs/audioflinger/AudioFlinger.h +++ b/libs/audioflinger/AudioFlinger.h @@ -501,7 +501,6 @@ private: MixerThread& operator = (const MixerThread&); status_t addTrack_l(const sp<Track>& track); - void removeTrack_l(wp<Track> track, int name); void destroyTrack_l(const sp<Track>& track); int getTrackName_l(); void deleteTrackName_l(int name); diff --git a/libs/audioflinger/AudioHardwareInterface.cpp b/libs/audioflinger/AudioHardwareInterface.cpp index ac76a19..cc1bd8f 100644 --- a/libs/audioflinger/AudioHardwareInterface.cpp +++ b/libs/audioflinger/AudioHardwareInterface.cpp @@ -53,7 +53,7 @@ static const char* routeStrings[] = "EARPIECE ", "SPEAKER ", "BLUETOOTH ", - "HEADSET " + "HEADSET ", "BLUETOOTH_A2DP " }; static const char* routeNone = "NONE"; |