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

Commit 323f2264 authored by Jeremy Wu's avatar Jeremy Wu
Browse files

floss: prefer SBC over AAC as default

Floss attempts to open AVDTP channel for the codec with the highest
priority for default. Some controllers have issues when closing a
non-SBC AVDTP channel and immediately opening another for SBC.

This CL sets SBC as the highest priority codec so that does not occur.

Bug: 306542979
Flag: EXEMPT floss-only
Test: m Bluetooth
Change-Id: I3fcde3d71c6a34e02df8f7fa62bf9f42f6df9736
parent 3dd526f7
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -292,10 +292,16 @@ std::unique_ptr<A2dpIntf> GetA2dpProfile(const unsigned char* btif) {
}

int A2dpIntf::init() const {
  std::vector<btav_a2dp_codec_config_t> a;
  btav_a2dp_codec_config_t a2dp_config_sbc{
          .codec_type = BTAV_A2DP_CODEC_INDEX_SOURCE_SBC,
          .codec_priority = BTAV_A2DP_CODEC_PRIORITY_HIGHEST,
          // Using default settings for those untouched fields
  };

  std::vector<btav_a2dp_codec_config_t> codec_priorities(1, a2dp_config_sbc);
  std::vector<btav_a2dp_codec_config_t> b;
  std::vector<btav_a2dp_codec_info_t> c;
  return btif_av_source_init(&internal::g_callbacks, 1, a, b, &c);
  return btif_av_source_init(&internal::g_callbacks, 1, codec_priorities, b, &c);
}

uint32_t A2dpIntf::connect(RawAddress addr) const { return btif_av_source_connect(addr); }