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

Commit a76ad745 authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by android-build-merger
Browse files

Hearing Aid Audio Source 24000 sample rate support

am: 30869f36

Change-Id: Idb2078537dddb74688bf46cb287372447ed9fdb5
parents ebdb3916 30869f36
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -474,6 +474,7 @@ static int ha_read_input_audio_config(struct ha_stream_common* common) {

  switch (sample_rate) {
    case 16000:
    case 24000:
    case 44100:
    case 48000:
      common->cfg.rate = sample_rate;
@@ -564,6 +565,9 @@ static int ha_read_output_audio_config(
    case BTAV_A2DP_CODEC_SAMPLE_RATE_16000:
      stream_config.rate = 16000;
      break;
    case BTAV_A2DP_CODEC_SAMPLE_RATE_24000:
      stream_config.rate = 24000;
      break;
    case BTAV_A2DP_CODEC_SAMPLE_RATE_NONE:
    default:
      ERROR("Invalid sample rate: 0x%x", codec_config->sample_rate);
@@ -670,6 +674,9 @@ static int ha_write_output_audio_config(struct ha_stream_common* common) {
    case 16000:
      codec_config.sample_rate = BTAV_A2DP_CODEC_SAMPLE_RATE_16000;
      break;
    case 24000:
      codec_config.sample_rate = BTAV_A2DP_CODEC_SAMPLE_RATE_24000;
      break;
    default:
      ERROR("Invalid sample rate: %" PRIu32, common->cfg.rate);
      return -1;
@@ -997,6 +1004,9 @@ size_t audio_ha_hw_stream_compute_buffer_size(
    case BTAV_A2DP_CODEC_SAMPLE_RATE_16000:
      sample_rate = 16000;
      break;
    case BTAV_A2DP_CODEC_SAMPLE_RATE_24000:
      sample_rate = 24000;
      break;
    case BTAV_A2DP_CODEC_SAMPLE_RATE_NONE:
    default:
      ERROR("Invalid sample rate: 0x%x", codec_sample_rate);
@@ -1224,6 +1234,10 @@ static char* out_get_parameters(const struct audio_stream* stream,
      if (!param.empty()) param += "|";
      param += "16000";
    }
    if (codec_capability.sample_rate & BTAV_A2DP_CODEC_SAMPLE_RATE_24000) {
      if (!param.empty()) param += "|";
      param += "24000";
    }
    if (param.empty()) {
      ERROR("Invalid codec capability sample_rate=0x%x",
            codec_capability.sample_rate);