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

Commit a96e9b3c authored by Sunny Kapdi's avatar Sunny Kapdi Committed by Pavlin Radoslavov
Browse files

A2DP Offload: Fix Max AVDTP MTU for Offload

Fix the max AVDTP MTU for Offload to what
can fit in a 3DH5 packet after accounting
for AVDTP and L2CAP header.

Also:
 - Moved MAX_2MBPS_AVDTP_MTU and MAX_3MBPS_AVDTP_MTU to the common
   avdt_api.h so it can be used by the rest of the code
 - Removed previously incorrect value of BTA_AV_MAX_A2DP_MTU and
   replace it with the new (correct) value of MAX_3MBPS_AVDTP_MTU
 - Removed duplicate define of MAX_2MBPS_AVDTP_MTU and use
   the one from avdt_api.h

Bug: 78907438
Test: A2DP Streaming
Change-Id: I2c60c34c33e4164c9f7e2e7362bbb600482dec97
parent 22ba5f16
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -79,7 +79,6 @@
/* ACL quota we are letting FW use for A2DP Offload Tx. */
/* ACL quota we are letting FW use for A2DP Offload Tx. */
#define BTA_AV_A2DP_OFFLOAD_XMIT_QUOTA 4
#define BTA_AV_A2DP_OFFLOAD_XMIT_QUOTA 4


#define MAX_2MBPS_AVDTP_MTU 663
#define BTIF_A2DP_MAX_BITPOOL_MQ 35
#define BTIF_A2DP_MAX_BITPOOL_MQ 35


static void bta_av_offload_codec_builder(tBTA_AV_SCB* p_scb,
static void bta_av_offload_codec_builder(tBTA_AV_SCB* p_scb,
@@ -3247,7 +3246,7 @@ static void bta_av_offload_codec_builder(tBTA_AV_SCB* p_scb,
      APPL_TRACE_ERROR("%s: Unknown Codec type ", __func__);
      APPL_TRACE_ERROR("%s: Unknown Codec type ", __func__);
      return;
      return;
  }
  }
  if (mtu > BTA_AV_MAX_A2DP_MTU) mtu = BTA_AV_MAX_A2DP_MTU;
  if (mtu > MAX_3MBPS_AVDTP_MTU) mtu = MAX_3MBPS_AVDTP_MTU;
  p_a2dp_offload->codec_type = codec_type;
  p_a2dp_offload->codec_type = codec_type;
  p_a2dp_offload->max_latency = 0;
  p_a2dp_offload->max_latency = 0;
  p_a2dp_offload->mtu = mtu;
  p_a2dp_offload->mtu = mtu;
+3 −3
Original line number Original line Diff line number Diff line
@@ -134,7 +134,7 @@ const tBTA_AV_CFG bta_av_cfg = {
    BTA_AV_RC_SUPF_CT,     /* AVRCP controller categories */
    BTA_AV_RC_SUPF_CT,     /* AVRCP controller categories */
    BTA_AV_RC_SUPF_TG,     /* AVRCP target categories */
    BTA_AV_RC_SUPF_TG,     /* AVRCP target categories */
    672,                   /* AVDTP signaling channel MTU at L2CAP */
    672,                   /* AVDTP signaling channel MTU at L2CAP */
    BTA_AV_MAX_A2DP_MTU,   /* AVDTP audio transport channel MTU at L2CAP */
    MAX_3MBPS_AVDTP_MTU,   /* AVDTP audio transport channel MTU at L2CAP */
    bta_av_audio_flush_to, /* AVDTP audio transport channel flush
    bta_av_audio_flush_to, /* AVDTP audio transport channel flush
                              timeout */
                              timeout */
    6,                     /* AVDTP audio channel max data queue size */
    6,                     /* AVDTP audio channel max data queue size */
@@ -161,7 +161,7 @@ const tBTA_AV_CFG bta_avk_cfg = {
    BTA_AVK_RC_SUPF_CT,    /* AVRCP controller categories */
    BTA_AVK_RC_SUPF_CT,    /* AVRCP controller categories */
    BTA_AVK_RC_SUPF_TG,    /* AVRCP target categories */
    BTA_AVK_RC_SUPF_TG,    /* AVRCP target categories */
    672,                   /* AVDTP signaling channel MTU at L2CAP */
    672,                   /* AVDTP signaling channel MTU at L2CAP */
    BTA_AV_MAX_A2DP_MTU,   /* AVDTP audio transport channel MTU at L2CAP */
    MAX_3MBPS_AVDTP_MTU,   /* AVDTP audio transport channel MTU at L2CAP */
    bta_av_audio_flush_to, /* AVDTP audio transport channel flush timeout */
    bta_av_audio_flush_to, /* AVDTP audio transport channel flush timeout */
    6,                     /* AVDTP audio channel max data queue size */
    6,                     /* AVDTP audio channel max data queue size */
    false, /* true, to accept AVRC 1.3 group nevigation command */
    false, /* true, to accept AVRC 1.3 group nevigation command */
@@ -186,7 +186,7 @@ const tBTA_AV_CFG bta_av_cfg_compatibility = {
    BTA_AV_RC_SUPF_CT,     /* AVRCP controller categories */
    BTA_AV_RC_SUPF_CT,     /* AVRCP controller categories */
    AVRC_SUPF_TG_CAT1,     /* Only support CAT1 for AVRCP1.3 */
    AVRC_SUPF_TG_CAT1,     /* Only support CAT1 for AVRCP1.3 */
    672,                   /* AVDTP signaling channel MTU at L2CAP */
    672,                   /* AVDTP signaling channel MTU at L2CAP */
    BTA_AV_MAX_A2DP_MTU,   /* AVDTP audio transport channel MTU at L2CAP */
    MAX_3MBPS_AVDTP_MTU,   /* AVDTP audio transport channel MTU at L2CAP */
    bta_av_audio_flush_to, /* AVDTP audio transport channel flush timeout */
    bta_av_audio_flush_to, /* AVDTP audio transport channel flush timeout */
    6,                     /* AVDTP audio channel max data queue size */
    6,                     /* AVDTP audio channel max data queue size */
    false, /* true, to accept AVRC 1.3 group nevigation command */
    false, /* true, to accept AVRC 1.3 group nevigation command */
+0 −5
Original line number Original line Diff line number Diff line
@@ -96,11 +96,6 @@ typedef uint8_t tBTA_AV_HNDL;
#define BTA_AV_NUM_STRS 6
#define BTA_AV_NUM_STRS 6
#endif
#endif


#ifndef BTA_AV_MAX_A2DP_MTU
/*#define BTA_AV_MAX_A2DP_MTU     668 //224 (DM5) * 3 - 4(L2CAP header) */
#define BTA_AV_MAX_A2DP_MTU 1008
#endif

/* operation id list for BTA_AvRemoteCmd */
/* operation id list for BTA_AvRemoteCmd */
typedef uint8_t tBTA_AV_RC;
typedef uint8_t tBTA_AV_RC;


+0 −6
Original line number Original line Diff line number Diff line
@@ -37,12 +37,6 @@
// A2DP AAC encoder interval in milliseconds
// A2DP AAC encoder interval in milliseconds
#define A2DP_AAC_ENCODER_INTERVAL_MS 20
#define A2DP_AAC_ENCODER_INTERVAL_MS 20


/*
 * 2DH5 payload size of:
 * 679 bytes - (4 bytes L2CAP Header + 12 bytes AVDTP Header)
 */
#define MAX_2MBPS_AVDTP_MTU 663

// offset
// offset
#if (BTA_AV_CO_CP_SCMS_T == TRUE)
#if (BTA_AV_CO_CP_SCMS_T == TRUE)
#define A2DP_AAC_OFFSET (AVDT_MEDIA_OFFSET + 1)
#define A2DP_AAC_OFFSET (AVDT_MEDIA_OFFSET + 1)
+0 −5
Original line number Original line Diff line number Diff line
@@ -43,11 +43,6 @@


#define A2DP_SBC_NON_EDR_MAX_RATE 229
#define A2DP_SBC_NON_EDR_MAX_RATE 229


/*
 * 2DH5 payload size of:
 * 679 bytes - (4 bytes L2CAP Header + 12 bytes AVDTP Header)
 */
#define MAX_2MBPS_AVDTP_MTU 663
#define A2DP_SBC_MAX_PCM_ITER_NUM_PER_TICK 3
#define A2DP_SBC_MAX_PCM_ITER_NUM_PER_TICK 3


#define A2DP_SBC_MAX_HQ_FRAME_SIZE_44_1 119
#define A2DP_SBC_MAX_HQ_FRAME_SIZE_44_1 119
Loading