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

Commit 5b6407ec authored by Cheney Ni's avatar Cheney Ni Committed by android-build-merger
Browse files

Merge "A2DP: Apply codec offloading preference for hybrid mode"

am: 1e1766e6

Change-Id: I8409653da304154f2701d1659dc836a42ccb0528
parents b09eb3be 1e1766e6
Loading
Loading
Loading
Loading
+7 −7
Original line number Original line Diff line number Diff line
@@ -346,7 +346,8 @@ class BtifAvSource {


  bt_status_t Init(
  bt_status_t Init(
      btav_source_callbacks_t* callbacks, int max_connected_audio_devices,
      btav_source_callbacks_t* callbacks, int max_connected_audio_devices,
      const std::vector<btav_a2dp_codec_config_t>& codec_priorities);
      const std::vector<btav_a2dp_codec_config_t>& codec_priorities,
      const std::vector<btav_a2dp_codec_config_t>& offloading_preference);
  void Cleanup();
  void Cleanup();


  btav_source_callbacks_t* Callbacks() { return callbacks_; }
  btav_source_callbacks_t* Callbacks() { return callbacks_; }
@@ -935,7 +936,8 @@ BtifAvSource::~BtifAvSource() { CleanupAllPeers(); }


bt_status_t BtifAvSource::Init(
bt_status_t BtifAvSource::Init(
    btav_source_callbacks_t* callbacks, int max_connected_audio_devices,
    btav_source_callbacks_t* callbacks, int max_connected_audio_devices,
    const std::vector<btav_a2dp_codec_config_t>& codec_priorities) {
    const std::vector<btav_a2dp_codec_config_t>& codec_priorities,
    const std::vector<btav_a2dp_codec_config_t>& offloading_preference) {
  LOG_INFO(LOG_TAG, "%s: max_connected_audio_devices=%d", __PRETTY_FUNCTION__,
  LOG_INFO(LOG_TAG, "%s: max_connected_audio_devices=%d", __PRETTY_FUNCTION__,
           max_connected_audio_devices);
           max_connected_audio_devices);
  if (enabled_) return BT_STATUS_SUCCESS;
  if (enabled_) return BT_STATUS_SUCCESS;
@@ -954,9 +956,6 @@ bt_status_t BtifAvSource::Init(


  callbacks_ = callbacks;
  callbacks_ = callbacks;
  if (a2dp_offload_enabled_) {
  if (a2dp_offload_enabled_) {
    // TODO: offloading_preference is for framework preference and should be
    // input from upper-layer
    std::vector<btav_a2dp_codec_config_t> offloading_preference(0);
    bluetooth::audio::a2dp::update_codec_offloading_capabilities(
    bluetooth::audio::a2dp::update_codec_offloading_capabilities(
        offloading_preference);
        offloading_preference);
  }
  }
@@ -2647,10 +2646,11 @@ static void bta_av_sink_media_callback(tBTA_AV_EVT event,
// Initializes the AV interface for source mode
// Initializes the AV interface for source mode
static bt_status_t init_src(
static bt_status_t init_src(
    btav_source_callbacks_t* callbacks, int max_connected_audio_devices,
    btav_source_callbacks_t* callbacks, int max_connected_audio_devices,
    std::vector<btav_a2dp_codec_config_t> codec_priorities) {
    const std::vector<btav_a2dp_codec_config_t>& codec_priorities,
    const std::vector<btav_a2dp_codec_config_t>& offloading_preference) {
  BTIF_TRACE_EVENT("%s", __func__);
  BTIF_TRACE_EVENT("%s", __func__);
  return btif_av_source.Init(callbacks, max_connected_audio_devices,
  return btif_av_source.Init(callbacks, max_connected_audio_devices,
                             codec_priorities);
                             codec_priorities, offloading_preference);
}
}


// Initializes the AV interface for sink mode
// Initializes the AV interface for sink mode
+4 −3
Original line number Original line Diff line number Diff line
@@ -303,9 +303,10 @@ typedef struct {
  /**
  /**
   * Register the BtAv callbacks.
   * Register the BtAv callbacks.
   */
   */
  bt_status_t (*init)(btav_source_callbacks_t* callbacks,
  bt_status_t (*init)(
                      int max_connected_audio_devices,
      btav_source_callbacks_t* callbacks, int max_connected_audio_devices,
                      std::vector<btav_a2dp_codec_config_t> codec_priorities);
      const std::vector<btav_a2dp_codec_config_t>& codec_priorities,
      const std::vector<btav_a2dp_codec_config_t>& offloading_preference);


  /** connect to headset */
  /** connect to headset */
  bt_status_t (*connect)(const RawAddress& bd_addr);
  bt_status_t (*connect)(const RawAddress& bd_addr);
+3 −1
Original line number Original line Diff line number Diff line
@@ -146,9 +146,11 @@ class BluetoothAvInterfaceImpl : public BluetoothAvInterface {


    // Right now we only support one connected audio device.
    // Right now we only support one connected audio device.
    int max_connected_audio_devices = 1;
    int max_connected_audio_devices = 1;
    std::vector<btav_a2dp_codec_config_t> offloading_preference(0);
    if (hal_source_iface_->init(
    if (hal_source_iface_->init(
            &av_source_callbacks, max_connected_audio_devices,
            &av_source_callbacks, max_connected_audio_devices,
            std::move(codec_priorities)) != BT_STATUS_SUCCESS) {
            std::move(codec_priorities),
            std::move(offloading_preference)) != BT_STATUS_SUCCESS) {
      LOG(ERROR) << "Failed to initialize HAL A2DP source interface";
      LOG(ERROR) << "Failed to initialize HAL A2DP source interface";
      return false;
      return false;
    }
    }