hal: Check channel config when dropping write buffers
If write buffers are dropped make sure that the
channel configuration is not 0 before using it as
a denominator.
Change-Id: Ifbb8fd3cdb5e1a2253e5dd7a74480e06ee7e0821
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 3edc1c0..f5129c5 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -3344,7 +3344,7 @@
if (audio_extn_passthru_should_drop_data(out)) {
ALOGV(" %s : Drop data as compress passthrough session is going on", __func__);
- if (audio_bytes_per_sample(out->format) != 0)
+ if ((audio_bytes_per_sample(out->format) != 0) && (out->config.channels != 0))
out->written += bytes / (out->config.channels * audio_bytes_per_sample(out->format));
ret = -EIO;
goto exit;