diff options
author | Dylan Reid <dgreid@chromium.org> | 2017-01-04 16:37:32 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-01-05 18:39:56 -0800 |
commit | f0474528cc0cc8d80475bfd63caa8a01fdff74bb (patch) | |
tree | 2c6e085048c9557483678707ba90ae086a4f3033 | |
parent | 674a4da103cdfbb511d164927bcc90a108bfb470 (diff) | |
download | adhd-f0474528cc0cc8d80475bfd63caa8a01fdff74bb.tar.gz |
CRAS: cras_iodev: initialize ramp_action variable
There was a compiler warning with gcc that it could be used
uninitialized. Initializing the variable allows the removal of the
is_ramping variable as a side effect.
Change-Id: Ieb8b91ef7900048db609f63383257799d871dac6
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/424845
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Chinyue Chen <chinyue@chromium.org>
-rw-r--r-- | cras/src/server/cras_iodev.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/cras/src/server/cras_iodev.c b/cras/src/server/cras_iodev.c index fce5d9a0..7c5ad60c 100644 --- a/cras/src/server/cras_iodev.c +++ b/cras/src/server/cras_iodev.c @@ -864,10 +864,13 @@ int cras_iodev_put_output_buffer(struct cras_iodev *iodev, uint8_t *frames, const struct cras_audio_format *fmt = iodev->format; struct cras_fmt_conv * remix_converter = audio_thread_get_global_remix_converter(); - struct cras_ramp_action ramp_action; + struct cras_ramp_action ramp_action = { + .type = CRAS_RAMP_ACTION_NONE, + .scaler = 0.0f, + .increment = 0.0f, + }; float software_volume_scaler; int software_volume_needed = cras_iodev_software_volume_needed(iodev); - int is_ramping = 0; if (iodev->pre_dsp_hook) iodev->pre_dsp_hook(frames, nframes, iodev->ext_format, @@ -875,13 +878,12 @@ int cras_iodev_put_output_buffer(struct cras_iodev *iodev, uint8_t *frames, if (iodev->ramp) { ramp_action = cras_ramp_get_current_action(iodev->ramp); - if (ramp_action.type == CRAS_RAMP_ACTION_PARTIAL) - is_ramping = 1; } /* Mute samples if adjusted volume is 0 or system is muted, plus * that this device is not ramping. */ - if (output_should_mute(iodev) && !is_ramping) { + if (output_should_mute(iodev) && + ramp_action.type != CRAS_RAMP_ACTION_PARTIAL) { const unsigned int frame_bytes = cras_get_format_bytes(fmt); cras_mix_mute_buffer(frames, frame_bytes, nframes); } else { @@ -897,8 +899,7 @@ int cras_iodev_put_output_buffer(struct cras_iodev *iodev, uint8_t *frames, cras_iodev_get_software_volume_scaler(iodev); } - if (iodev->ramp && - ramp_action.type == CRAS_RAMP_ACTION_PARTIAL) { + if (ramp_action.type == CRAS_RAMP_ACTION_PARTIAL) { /* Scale with increment for ramp and possibly * software volume using cras_scale_buffer_increment.*/ float starting_scaler = ramp_action.scaler; |