summaryrefslogtreecommitdiffstats
path: root/libs/audioflinger/AudioFlinger.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/audioflinger/AudioFlinger.cpp')
-rw-r--r--libs/audioflinger/AudioFlinger.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp
index c330bc8..918b01f 100644
--- a/libs/audioflinger/AudioFlinger.cpp
+++ b/libs/audioflinger/AudioFlinger.cpp
@@ -800,13 +800,21 @@ status_t AudioFlinger::setStreamVolume(int stream, float value)
return BAD_VALUE;
}
- mStreamTypes[stream].volume = value;
status_t ret = NO_ERROR;
if (stream == AudioTrack::VOICE_CALL) {
AutoMutex lock(mHardwareLock);
mHardwareStatus = AUDIO_SET_VOICE_VOLUME;
ret = mAudioHardware->setVoiceVolume(value);
mHardwareStatus = AUDIO_HW_IDLE;
+ // 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
+ mStreamTypes[stream].volume = value * (1.0 - 1.0 / 6.0) + (1.0 / 6.0);
+ } else {
+ mStreamTypes[stream].volume = value;
}
return ret;
}
@@ -830,6 +838,11 @@ float AudioFlinger::streamVolume(int stream) const
if (uint32_t(stream) >= AudioTrack::NUM_STREAM_TYPES) {
return 0.0f;
}
+ if (stream == AudioTrack::VOICE_CALL) {
+ // FIXME: Re-base internally generated in-call audio,
+ // reverse of above in setStreamVolume.
+ return (mStreamTypes[stream].volume - (1.0 / 6.0)) / (1.0 - 1.0 / 6.0);
+ }
return mStreamTypes[stream].volume;
}