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

Commit 715b142a authored by Satish Babu Patakokila's avatar Satish Babu Patakokila Committed by Garmond Leung
Browse files

hal: Fix DSP crash when passthru session is opened for unsupported channels

- DSP crash is seen when device channel configuration is less than
stream channels for passthrough usecases.
- Return error when stream channels are more than max supported
channels by the sink during compress passthrough playback

Change-Id: Icb8f2fd23880be57b3befe4a2a75a19c8ca5acfa
CRs-fixed: 2096943
parent e9ff317e
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -3708,6 +3708,7 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer,
    struct stream_out *out = (struct stream_out *)stream;
    struct audio_device *adev = out->dev;
    ssize_t ret = 0;
    int channels = 0;

    lock_output_stream(out);

@@ -3737,6 +3738,7 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer,
    }

    if (out->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
        channels = platform_edid_get_max_channels(out->dev->platform);
        if (audio_extn_passthru_is_enabled() &&
            !out->is_iec61937_info_available &&
            audio_extn_passthru_is_passthrough_stream(out)) {
@@ -3766,6 +3768,14 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer,
                    out->is_iec61937_info_available = true;
                }
            }

            if ((channels < audio_channel_count_from_out_mask(out->channel_mask)) &&
                (out->compr_config.codec->compr_passthr == PASSTHROUGH) &&
                (out->is_iec61937_info_available == true)) {
                    ALOGE("%s: ERROR: Unsupported channel config in passthrough mode", __func__);
                    ret = -EINVAL;
                    goto exit;
            }
        }
    }