OSDN Git Service

audiohal: Fix volume changes handling
authorMikhail Naganov <mnaganov@google.com>
Thu, 19 Jan 2017 20:38:39 +0000 (12:38 -0800)
committerMikhail Naganov <mnaganov@google.com>
Thu, 19 Jan 2017 20:52:27 +0000 (12:52 -0800)
commitf4f2ff39746a36b3d657e34ec1724589051b1ec8
tree85824a1ce3c9506048ed05836575657f46cb8f4a
parent6fdbe86350a5678303365c95bd663ac8f75416fc
audiohal: Fix volume changes handling

Some legacy implementations of the effects HAL use the condition
of the reply buffer being NULL as an indication that they shouldn't
apply attenuation to the input audio data. Therefore, separate
methods are needed to distinguish the use cases of delegating the
volume control to the effect, and just informing the effect of the
volume changes.

A new method added to IEffect: volumeChangeNotification that implements
the second use case. The contract of setAndGetVolume method has been
updated to indicate that it is only called in the first use case.

Also updated the wrapper for a generic IEffect commands to pass NULL
pointers to the command and reply buffers in case when the size
of the input or output data is 0, to preserve compatibility with
direct calls from the framework.

Bug: 34368451
Test: volume control works when both Bass Boost and Equalizer are
      enabled in the NXP implementation of the effects

Change-Id: I3c9a5bbdff561802bc94080c51703385a8903282
25 files changed:
audio/effect/2.0/IEffect.hal
audio/effect/2.0/default/AcousticEchoCancelerEffect.cpp
audio/effect/2.0/default/AcousticEchoCancelerEffect.h
audio/effect/2.0/default/AutomaticGainControlEffect.cpp
audio/effect/2.0/default/AutomaticGainControlEffect.h
audio/effect/2.0/default/BassBoostEffect.cpp
audio/effect/2.0/default/BassBoostEffect.h
audio/effect/2.0/default/DownmixEffect.cpp
audio/effect/2.0/default/DownmixEffect.h
audio/effect/2.0/default/Effect.cpp
audio/effect/2.0/default/Effect.h
audio/effect/2.0/default/EnvironmentalReverbEffect.cpp
audio/effect/2.0/default/EnvironmentalReverbEffect.h
audio/effect/2.0/default/EqualizerEffect.cpp
audio/effect/2.0/default/EqualizerEffect.h
audio/effect/2.0/default/LoudnessEnhancerEffect.cpp
audio/effect/2.0/default/LoudnessEnhancerEffect.h
audio/effect/2.0/default/NoiseSuppressionEffect.cpp
audio/effect/2.0/default/NoiseSuppressionEffect.h
audio/effect/2.0/default/PresetReverbEffect.cpp
audio/effect/2.0/default/PresetReverbEffect.h
audio/effect/2.0/default/VirtualizerEffect.cpp
audio/effect/2.0/default/VirtualizerEffect.h
audio/effect/2.0/default/VisualizerEffect.cpp
audio/effect/2.0/default/VisualizerEffect.h