summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmal Paul <amal@codeaurora.org>2013-02-15 12:25:45 -0800
committerSteve Kondik <shade@chemlab.org>2013-02-19 11:13:52 -0800
commit390e2b19c3bdbacfdf59afdbad1a6818c5f1ed0c (patch)
treeb5ec0e3a6f923e3a1cf7935810002fa12de72c5d
parente4a52e7469c5a7c247424777c2350e6a85ea685e (diff)
downloadframeworks_av-390e2b19c3bdbacfdf59afdbad1a6818c5f1ed0c.zip
frameworks_av-390e2b19c3bdbacfdf59afdbad1a6818c5f1ed0c.tar.gz
frameworks_av-390e2b19c3bdbacfdf59afdbad1a6818c5f1ed0c.tar.bz2
audioflinger: Fix to set correct volume in Tunnel playback
- After a pause and resume, tunnel playback volume is always set to maximum irrespective of the volume value before pause. - The cause for this is, the stream volume is not used to set the volume in directaudiotrack. - Fix is to use the stream volume to set volume during tunnel playback. Change-Id: I59cda146ed88bd5c4186aeb9ae5d165f4a27493f CRs-fixed: 452285
-rw-r--r--services/audioflinger/AudioFlinger.cpp6
-rw-r--r--services/audioflinger/AudioFlinger.h1
2 files changed, 6 insertions, 1 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 0a0529a..e4c055a 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1051,6 +1051,7 @@ status_t AudioFlinger::setStreamVolume(audio_stream_type_t stream, float value,
ALOGV("setStreamVolume for mAudioTracks size %d desc %p",mDirectAudioTracks.size(),desc);
if (desc->mStreamType == stream) {
mStreamTypes[stream].volume = value;
+ desc->mVolumeScale = value;
desc->stream->set_volume(desc->stream,
desc->mVolumeLeft * mStreamTypes[stream].volume,
desc->mVolumeRight* mStreamTypes[stream].volume);
@@ -6163,6 +6164,7 @@ AudioFlinger::DirectAudioTrack::DirectAudioTrack(const sp<AudioFlinger>& audioFl
allocateBufPool();
}
+ outputDesc->mVolumeScale = 1.0;
mDeathRecipient = new PMDeathRecipient(this);
acquireWakeLock();
}
@@ -6247,7 +6249,9 @@ void AudioFlinger::DirectAudioTrack::mute(bool muted) {
void AudioFlinger::DirectAudioTrack::setVolume(float left, float right) {
mOutputDesc->mVolumeLeft = left;
mOutputDesc->mVolumeRight = right;
- mOutputDesc->stream->set_volume(mOutputDesc->stream,left,right);
+ mOutputDesc->stream->set_volume(mOutputDesc->stream,
+ left * mOutputDesc->mVolumeScale,
+ right* mOutputDesc->mVolumeScale);
}
int64_t AudioFlinger::DirectAudioTrack::getTimeStamp() {
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index dcdc55c..cbda3fe 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -2160,6 +2160,7 @@ mutable Mutex mLock; // mutex for process, commands and handl
int mStreamType;
float mVolumeLeft;
float mVolumeRight;
+ float mVolumeScale;
audio_hw_device_t *hwDev;
audio_stream_out_t *stream;
audio_output_flags_t flag;