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

Commit b9b07216 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "audio_hal_interface: Pass preferred encoding interval as parameter to setup_codec" into main

parents 446f8b39 3c6428f8
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -70,11 +70,12 @@ void cleanup() {
}

// Set up the codec into BluetoothAudio HAL
bool setup_codec(A2dpCodecConfig* a2dp_config, uint16_t peer_mtu) {
bool setup_codec(A2dpCodecConfig* a2dp_config, uint16_t peer_mtu,
                 int preferred_encoding_interval_us) {
  if (HalVersionManager::GetHalTransport() == BluetoothAudioHalTransport::HIDL) {
    return hidl::a2dp::setup_codec(a2dp_config, peer_mtu);
    return hidl::a2dp::setup_codec(a2dp_config, peer_mtu, preferred_encoding_interval_us);
  }
  return aidl::a2dp::setup_codec(a2dp_config, peer_mtu);
  return aidl::a2dp::setup_codec(a2dp_config, peer_mtu, preferred_encoding_interval_us);
}

// Send command to the BluetoothAudio HAL: StartSession, EndSession,
+2 −1
Original line number Diff line number Diff line
@@ -57,7 +57,8 @@ bool init(bluetooth::common::MessageLoopThread* message_loop);
void cleanup();

// Set up the codec into BluetoothAudio HAL
bool setup_codec(A2dpCodecConfig* a2dp_config, uint16_t peer_mtu);
bool setup_codec(A2dpCodecConfig* a2dp_config, uint16_t peer_mtu,
                 int preferred_encoding_interval_us);

// Set low latency buffer mode allowed or disallowed
void set_audio_low_latency_mode_allowed(bool allowed);
+2 −1
Original line number Diff line number Diff line
@@ -248,7 +248,8 @@ void cleanup() {
}

// Set up the codec into BluetoothAudio HAL
bool setup_codec(A2dpCodecConfig* /*a2dp_config*/, uint16_t /*peer_mtu*/) {
bool setup_codec(A2dpCodecConfig* /*a2dp_config*/, uint16_t /*peer_mtu*/,
                 int /*preferred_encoding_interval_us*/) {
  // TODO: setup codec
  return true;
}
+6 −3
Original line number Diff line number Diff line
@@ -309,6 +309,7 @@ bool a2dp_get_selected_hal_codec_config(A2dpCodecConfig* a2dp_config, uint16_t p
}

static bool a2dp_get_selected_hal_pcm_config(A2dpCodecConfig* a2dp_codec_configs,
                                             int preferred_encoding_interval_us,
                                             PcmConfiguration* pcm_config) {
  if (pcm_config == nullptr) {
    return false;
@@ -320,7 +321,7 @@ static bool a2dp_get_selected_hal_pcm_config(A2dpCodecConfig* a2dp_codec_configs
  pcm_config->channelMode = A2dpCodecToHalChannelMode(current_codec);

  if (com::android::bluetooth::flags::a2dp_aidl_encoding_interval()) {
    pcm_config->dataIntervalUs = bta_av_co_get_encoder_preferred_interval_us();
    pcm_config->dataIntervalUs = preferred_encoding_interval_us;
  }

  return pcm_config->sampleRateHz > 0 && pcm_config->bitsPerSample > 0 &&
@@ -457,7 +458,8 @@ void cleanup() {
}

// Set up the codec into BluetoothAudio HAL
bool setup_codec(A2dpCodecConfig* a2dp_config, uint16_t peer_mtu) {
bool setup_codec(A2dpCodecConfig* a2dp_config, uint16_t peer_mtu,
                 int preferred_encoding_interval_us) {
  log::assert_that(a2dp_config != nullptr, "received invalid codec configuration");

  if (!is_hal_enabled()) {
@@ -531,7 +533,8 @@ bool setup_codec(A2dpCodecConfig* a2dp_config, uint16_t peer_mtu) {
    audio_config.set<AudioConfiguration::a2dpConfig>(codec_config);
  } else {
    PcmConfiguration pcm_config{};
    if (!a2dp_get_selected_hal_pcm_config(a2dp_config, &pcm_config)) {
    if (!a2dp_get_selected_hal_pcm_config(a2dp_config, preferred_encoding_interval_us,
                                          &pcm_config)) {
      log::error("Failed to get PcmConfiguration");
      return false;
    }
+2 −1
Original line number Diff line number Diff line
@@ -62,7 +62,8 @@ void cleanup();
/***
 * Set up the codec into BluetoothAudio HAL
 ***/
bool setup_codec(A2dpCodecConfig* a2dp_config, uint16_t peer_mtu);
bool setup_codec(A2dpCodecConfig* a2dp_config, uint16_t peer_mtu,
                 int preferred_encoding_interval_us);

/***
 * Send command to the BluetoothAudio HAL: StartSession, EndSession,
Loading