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

Commit 31173c9c authored by Ben Romberger's avatar Ben Romberger Committed by Gerrit - the friendly Code Review server
Browse files

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
parent 3fcdcef2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3344,7 +3344,7 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer,

    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;