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

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

Merge "A2DP: Restrict MTU while using SBC middle quality" into sc-dev

parents e922d900 3e00585b
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include "client_interface.h"
#include "codec_status.h"

#include "a2dp_sbc_constants.h"
#include "btif_a2dp_source.h"
#include "btif_av.h"
#include "btif_av_co.h"
@@ -282,7 +283,11 @@ bool a2dp_get_selected_hal_codec_config(CodecConfiguration* codec_config) {
  } else {
    codec_config->peerMtu = peer_param.peer_mtu;
  }
  if (codec_config->peerMtu > MAX_3MBPS_AVDTP_MTU) {
  if (current_codec.codec_type == BTAV_A2DP_CODEC_INDEX_SOURCE_SBC &&
      codec_config->config.sbcConfig().maxBitpool <=
          A2DP_SBC_BITPOOL_MIDDLE_QUALITY) {
    codec_config->peerMtu = MAX_2MBPS_AVDTP_MTU;
  } else if (codec_config->peerMtu > MAX_3MBPS_AVDTP_MTU) {
    codec_config->peerMtu = MAX_3MBPS_AVDTP_MTU;
  }
  LOG(INFO) << __func__ << ": CodecConfiguration=" << toString(*codec_config);
+1 −3
Original line number Diff line number Diff line
@@ -82,8 +82,6 @@ constexpr char kBtmLogTag[] = "A2DP";
/* ACL quota we are letting FW use for A2DP Offload Tx. */
#define BTA_AV_A2DP_OFFLOAD_XMIT_QUOTA 4

#define BTIF_A2DP_MAX_BITPOOL_MQ 35

static void bta_av_offload_codec_builder(tBTA_AV_SCB* p_scb,
                                         tBT_A2DP_OFFLOAD* p_a2dp_offload);

@@ -3159,7 +3157,7 @@ static void bta_av_offload_codec_builder(tBTA_AV_SCB* p_scb,
    case BTAV_A2DP_CODEC_INDEX_SOURCE_SBC:
      codec_type = BTA_AV_CODEC_TYPE_SBC;
      if (A2DP_GetMaxBitpoolSbc(p_scb->cfg.codec_info) <=
          BTIF_A2DP_MAX_BITPOOL_MQ) {
          A2DP_SBC_BITPOOL_MIDDLE_QUALITY) {
        APPL_TRACE_WARNING("%s: Restricting streaming MTU size for MQ Bitpool",
                           __func__);
        mtu = MAX_2MBPS_AVDTP_MTU;
+17 −0
Original line number Diff line number Diff line
@@ -903,6 +903,23 @@ void A2dpCodecConfigSbcSource::debug_codec_dump(int fd) {

  A2dpCodecConfig::debug_codec_dump(fd);

  uint8_t codec_info[AVDT_CODEC_SIZE];
  if (copyOutOtaCodecConfig(codec_info)) {
    dprintf(fd,
            "  Block length                                            : %d\n",
            A2DP_GetNumberOfBlocksSbc(codec_info));
    dprintf(fd,
            "  Number of subbands                                      : %d\n",
            A2DP_GetNumberOfSubbandsSbc(codec_info));
    dprintf(fd,
            "  Allocation method                                       : %d\n",
            A2DP_GetAllocationMethodCodeSbc(codec_info));
    dprintf(
        fd,
        "  Bitpool (min/max)                                       : %d / %d\n",
        A2DP_GetMinBitpoolSbc(codec_info), A2DP_GetMaxBitpoolSbc(codec_info));
  }

  dprintf(fd,
          "  Packet counts (expected/dropped)                        : %zu / "
          "%zu\n",
+1 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@

#define A2DP_SBC_IE_MIN_BITPOOL 2
#define A2DP_SBC_IE_MAX_BITPOOL 250
#define A2DP_SBC_BITPOOL_MIDDLE_QUALITY 35

/* for media payload header */
#define A2DP_SBC_HDR_F_MSK 0x80