diff options
| author | Eric Laurent <elaurent@google.com> | 2017-04-12 13:41:03 -0700 |
|---|---|---|
| committer | Eric Laurent <elaurent@google.com> | 2017-04-12 13:41:03 -0700 |
| commit | 882a72dc4a76ff14bb65da0eab029a9f5a258dcd (patch) | |
| tree | e8299d52ce7eb7f86ad7dd72195c69aa50838cf4 /post_proc/bundle.c | |
| parent | f568373527b570e692317c245858cd25da8223bc (diff) | |
| download | platform_hardware_qcom_audio-882a72dc4a76ff14bb65da0eab029a9f5a258dcd.tar.gz platform_hardware_qcom_audio-882a72dc4a76ff14bb65da0eab029a9f5a258dcd.tar.bz2 platform_hardware_qcom_audio-882a72dc4a76ff14bb65da0eab029a9f5a258dcd.zip | |
post processing: add volume command support
By design of the effect offloading mechanism, offloaded implementations
must have the same behavior as non offloaded implementations.
As the non offloaded effects (EQ, Bass boost, Virtualizer ...) from the
AOSP effect bundle implement the EFFECT_FLAG_VOLUME_CTRL flag and
behavior, offloaded effects should.
In order for volume control to work, EFFECT_CMD_SET_VOLUME must be
implemented and return the received volume in the reply data.
Bug: 37281217
Test: Music playback in offload and non offload mode with and without EQ.
Change-Id: I2425f4dce95c8ab877db19cefbaa6226895b4015
Diffstat (limited to 'post_proc/bundle.c')
| -rw-r--r-- | post_proc/bundle.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/post_proc/bundle.c b/post_proc/bundle.c index 73b9ae5..f83e231 100644 --- a/post_proc/bundle.c +++ b/post_proc/bundle.c @@ -668,10 +668,19 @@ int effect_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize, if (context->ops.set_device) context->ops.set_device(context, device); } break; - case EFFECT_CMD_SET_VOLUME: + case EFFECT_CMD_SET_VOLUME: { + // if pReplyData is NULL, VOL_CTRL is delegated to another effect + if (pReplyData == NULL) { + break; + } + if (pCmdData == NULL || cmdSize != 2 * sizeof(uint32_t) || + replySize == NULL || *replySize < 2*sizeof(int32_t)) { + return -EINVAL; + } + memcpy(pReplyData, pCmdData, sizeof(int32_t)*2); + } break; case EFFECT_CMD_SET_AUDIO_MODE: break; - case EFFECT_CMD_OFFLOAD: { output_context_t *out_ctxt; @@ -703,8 +712,6 @@ int effect_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize, add_effect_to_output(out_ctxt, context); } break; - - default: if (cmdCode >= EFFECT_CMD_FIRST_PROPRIETARY && context->ops.command) status = context->ops.command(context, cmdCode, cmdSize, |
