OSDN Git Service

frameworks: av: fix bug in the volume management
authorBryant Liu <bryant_liu@htc.com>
Thu, 12 Jun 2014 14:02:41 +0000 (22:02 +0800)
committerGlenn Kasten <gkasten@google.com>
Thu, 12 Jun 2014 16:17:38 +0000 (09:17 -0700)
which can cause volume levels to be applied twice. After applying volume
in the effect chain, the remaining volume needs to be converted back to
floating point before providing to mAudioMixer.

Bug: 15583440
Change-Id: I3c884f95b0fa9ad1b554285b069601c850c54776
Signed-off-by: Glenn Kasten <gkasten@google.com>
services/audioflinger/Threads.cpp [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index d08c966..c0daa08
@@ -3428,6 +3428,9 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac
             if (chain != 0 && chain->setVolume_l(&vl, &vr)) {
                 // Do not ramp volume if volume is controlled by effect
                 param = AudioMixer::VOLUME;
+                // Update remaining floating point volume levels
+                vlf = (float)vl / (1 << 24);
+                vrf = (float)vr / (1 << 24);
                 track->mHasVolumeController = true;
             } else {
                 // force no volume ramp when volume controller was just disabled or removed