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

Commit b4ed4816 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "audio: 24 bit audio output profiles" into oc-dr1-dev

parents 74b5576c df0f886b
Loading
Loading
Loading
Loading
+8 −20
Original line number Diff line number Diff line
@@ -573,7 +573,7 @@ static void usb_print_active_device(void){
    }
}

static bool usb_get_best_match_for_bit_width(
static bool usb_get_best_bit_width(
                            struct listnode *dev_list,
                            unsigned int stream_bit_width,
                            unsigned int *bit_width)
@@ -588,29 +588,17 @@ static bool usb_get_best_match_for_bit_width(
                 "%s: USB bw(%d), stream bw(%d), candidate(%d)",
                 __func__, dev_info->bit_width,
                 stream_bit_width, candidate);
        if (dev_info->bit_width == stream_bit_width) {
            *bit_width = dev_info->bit_width;
            ALOGV("%s: Found match bit-width (%d)",
        if (candidate == 0) {
            ALOGV("%s: candidate bit-width (%d)",
                  __func__, dev_info->bit_width);
            goto exit;
        } else if (candidate == 0) {
                candidate = dev_info->bit_width;
        }
        /*
        * If stream bit is 24, USB supports both 16 bit and 32 bit, then
        *  higher bit width 32 is picked up instead of 16-bit
        */
        else if (ABS_SUB(stream_bit_width, dev_info->bit_width) <
                 ABS_SUB(stream_bit_width, candidate)) {
            candidate = dev_info->bit_width;
        }
        else if ((ABS_SUB(stream_bit_width, dev_info->bit_width) ==
                  ABS_SUB(stream_bit_width, candidate)) &&
                 (dev_info->bit_width > candidate)) {
        } else if (dev_info->bit_width > candidate) {
            candidate = dev_info->bit_width;
            ALOGV("%s: Found better candidate bit-width (%d)",
                  __func__, dev_info->bit_width);
        }
    }
    ALOGV("%s: No match found, use the best candidate bw(%d)",
    ALOGV("%s: Use the best candidate bw(%d)",
          __func__, candidate);
    *bit_width = candidate;
exit:
@@ -788,7 +776,7 @@ static bool usb_audio_backend_apply_policy(struct listnode *dev_list,
        ALOGE("%s: list is empty,fall back to default setting", __func__);
        goto exit;
    }
    usb_get_best_match_for_bit_width(dev_list, *bit_width, bit_width);
    usb_get_best_bit_width(dev_list, *bit_width, bit_width);
    usb_get_best_match_for_channels(dev_list,
                                    *bit_width,
                                    *channel_count,
+7 −3
Original line number Diff line number Diff line
@@ -286,9 +286,13 @@ static int derive_playback_app_type_cfg(struct audio_device *adev,

    app_type_cfg->mode = flags_to_mode(0 /*playback*/, out->flags);
    if (!audio_is_linear_pcm(out->format)) {
        platform_get_default_app_type_v2(adev->platform,
        platform_get_app_type_v2(adev->platform,
                                 PCM_PLAYBACK,
                                 app_type_cfg->mode,
                                 24,
                                 *sample_rate,
                                 app_type);
        ALOGV("Non pcm got app type %d", *app_type);
    } else if (out->format == AUDIO_FORMAT_PCM_16_BIT) {
        platform_get_app_type_v2(adev->platform,
                                 PCM_PLAYBACK,
+1 −13
Original line number Diff line number Diff line
@@ -3728,19 +3728,7 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
            out->config = pcm_config_low_latency;
        }
        if (config->format != audio_format_from_pcm_format(out->config.format)) {
            if (k_enable_extended_precision
                    && pcm_params_format_test(adev->use_case_table[out->usecase],
                            pcm_format_from_audio_format(config->format))) {
            out->config.format = pcm_format_from_audio_format(config->format);
                /* out->format already set to config->format */
            } else {
                /* deny the externally proposed config format
                 * and use the one specified in audio_hw layer configuration.
                 * Note: out->format is returned by out->stream.common.get_format()
                 * and is used to set config->format in the code several lines below.
                 */
                out->format = audio_format_from_pcm_format(out->config.format);
            }
        }
        out->sample_rate = out->config.rate;
    }