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

Skip to content
Commit 91f9377d authored by Cal Archer's avatar Cal Archer Committed by Paul Keith
Browse files

effects: fix volume burst on pause/resume with AudioFX

Resume after pause in Music app often causes loud burst
when AudioFX is enabled.
To reproduce:
- play format that isn't offloaded to DSP (e.g. ogg vorbis, not mp3)
- enable AudioFX (equalizer)
- pause & resume repeatedly

Root cause:
- AudioFX destroys the effects on pause and recreates them on resume.
- AudioFlinger's threadLoop processes the commmand to enable the
  effect before input buffers are filled
- An effect with EFFECT_FLAG_VOLUME_CTRL takes over responsibility for
  volume control.
- AudioFlinger::MixerThread::prepareTracks_l() has two cases,
  "[OK]" (input frame available) and "[NOT READY]" (waiting
  for data).  [NOT READY] clears the input buffers, [OK] triggers
  the volume setting
- threadLoop calls effectChains[i]->process_l() in any case

It should not be a problem since audioflinger clears the buffers when
input isn't ready, so no matter what's the volume setting,
zero input samples should result in zero output. And I confirmed
Effect_process() input and output buffers contain only zeros
in this case. So the only explanation is that the volume is
applied to samples buffered somewhere else.

19:54:28.015  1958  2000 V AudioFlinger::EffectModule: setEnabled 0xb1d7b780 enabled 1

19:54:28.060  1958  1970 V AudioFlinger: track 4096 s=00013614 [NOT READY] on thread 0xb25ac4c0

19:54:28.062  1958  2035 V Bundle  : 	Effect_process Start : Enabled = 1     Called = 0 (       0        0     9600)
19:54:28.063  1958  2035 V Bundle  : 	Effect_process: Effect type is LVM_EQUALIZER
19:54:28.063  1958  2035 V Bundle  : 	Effect_process     Calling process with 1 effects enabled, 1 called: Effect 2

19:54:28.099  1958  1970 V AudioFlinger: track 4096 s=00013614 [OK] on thread 0xb25ac4c0
19:54:28.099  1958  1970 V Bundle  :
19:54:28.099  1958  1970 V Bundle  : Effect_command start
19:54:28.099  1958  1970 V Bundle  : 	Effect_command setting command for LVM_EQUALIZER
19:54:28.099  1958  1970 V Bundle  : 	Effect_command INPUTS are: command 10 cmdSize 8
19:54:28.099  1958  1970 V Bundle  : 	Effect_command NumberEffectsCalled = 0, NumberEffectsEnabled = 1
19:54:28.099  1958  1970 V Bundle  : 	EFFECT_CMD_SET_VOLUME Session: 0, SessionID: 9 VOLUME is -27 dB, effect is 2
19:54:28.099  1958  1970 V Bundle  : 	EFFECT_CMD_SET_VOLUME: Left is 791539, Right is 791539
19:54:28.099  1958  1970 V Bundle  : 	EFFECT_CMD_SET_VOLUME: Left -27dB, Right -27dB, Position 0dB

Work around the issue by initializing the effect volume to -96dB.

BUGBASH-455

Change-Id: I350cf763e6453d5c8acad314096b5206ed490a61
parent 85765d8c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment