Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 390e2b19 authored by Amal Paul's avatar Amal Paul Committed by Steve Kondik
Browse files

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
parent e4a52e74
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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() {
+1 −0
Original line number Diff line number Diff line
@@ -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;