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

Commit 6c34443d authored by Mingming Yin's avatar Mingming Yin
Browse files

hal: configure HDMI channels based on sink capability.

- configure output HDMI channel count based on sink
  capability when audio.use.hdmi.sink.cap is set to true

CRs-Fixed: 656308
Change-Id: I3dd3226054c68a69a2c29f8bb2f9c27e429ad2dc
parent 584b1d52
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -1072,6 +1072,8 @@ static int stop_output_stream(struct stream_out *out)
int start_output_stream(struct stream_out *out)
{
    int ret = 0;
    int sink_channels = 0;
    char prop_value[PROPERTY_VALUE_MAX] = {0};
    struct audio_usecase *uc_info;
    struct audio_device *adev = out->dev;

@@ -1095,11 +1097,18 @@ int start_output_stream(struct stream_out *out)

    /* This must be called before adding this usecase to the list */
    if (out->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
        property_get("audio.use.hdmi.sink.cap", prop_value, NULL);
        if (!strncmp("true", prop_value, 4)) {
            sink_channels = platform_edid_get_max_channels(out->dev->platform);
            ALOGD("%s: set HDMI channel count[%d] based on sink capability", __func__, sink_channels);
            check_and_set_hdmi_channels(adev, sink_channels);
        } else {
            if (out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD)
                check_and_set_hdmi_channels(adev, out->compr_config.codec->ch_in);
            else
                check_and_set_hdmi_channels(adev, out->config.channels);
        }
    }

    list_add_tail(&adev->usecase_list, &uc_info->list);