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

Commit 386c4b93 authored by Pavlin Radoslavov's avatar Pavlin Radoslavov
Browse files

A2DP related API update and cleanup

* Added new A2DP API and use it as appropriate
  - A2D_GetTrackFrequency()
  - A2D_GetTrackChannelCount()
  - A2D_GetNumberOfSubbands()
  - A2D_GetNumberOfBlocks()
  - A2D_GetAllocationMethodCode()
  - A2D_GetChannelModeCode()
  - A2D_GetSamplingFrequencyCode()
  - A2D_GetSinkTrackChannelType()
  - A2D_GetSinkFramesCountToProcess()

* Added corresponding unit tests for the new API

Also, A2DP related cleanup:
 - Renamed A2D_sbc_dump_codec_info to A2D_DumpCodecInfoSbc()
 - Changed the order of tA2D_SBC_CIE.min_bitpool and
   tA2D_SBC_CIE.max_bitpool to reflect the order of the corresponding
   fields in the Bluetooth spec (A2DP spec v1.3, page 21).
 - Added new API A2D_GetMediaType() and the corresponding unit test
 - Renamed AVDT_MEDIA_AUDIO to AVDT_MEDIA_TYPE_AUDIO
 - Renamed tA2D_SBC_CIE.alloc_mthd to alloc_method
 - Renamed A2D_BAD_ALLOC_MTHD to A2D_BAD_ALLOC_METHOD
 - Renamed A2D_NS_ALLOC_MTHD to A2D_NS_ALLOC_METHOD
 - Eliminated usage of A2D_MEDIA_TYPE_AUDIO and replace it with
   AVDT_MEDIA_TYPE_AUDIO.
    Now the media_type value everywhere is the AVDT_MEDIA_TYPE_* value
    without the reserved 4 bits (LSBs).
 - Fixed macro defines in file "stack/avdt/avdt_defs.h"

Bug: 30958229
Change-Id: Id82653e9c9460aeb92d942a9179bb5abdb4bfdec
parent e69c99c3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1880,7 +1880,7 @@ void bta_av_getcap_results (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data)
    cfg.num_protect = p_scb->p_cap->num_protect;
    memcpy(cfg.codec_info, p_scb->p_cap->codec_info, AVDT_CODEC_SIZE);
    memcpy(cfg.protect_info, p_scb->p_cap->protect_info, AVDT_PROTECT_SIZE);
    media_type = p_scb->p_cap->codec_info[BTA_AV_MEDIA_TYPE_IDX] >> 4;
    media_type = A2D_GetMediaType(p_scb->p_cap->codec_info);

    APPL_TRACE_DEBUG("%s: num_codec %d", __func__, p_scb->p_cap->num_codec);
    APPL_TRACE_DEBUG("%s: media type x%x, x%x", __func__, media_type,
@@ -2429,7 +2429,7 @@ void bta_av_start_ok (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data)

    bta_sys_busy(BTA_ID_AV, bta_av_cb.audio_open_cnt, p_scb->peer_addr);

    if(p_scb->media_type == AVDT_MEDIA_AUDIO)
    if(p_scb->media_type == AVDT_MEDIA_TYPE_AUDIO)
    {
        /* in normal logic, conns should be bta_av_cb.audio_count - 1,
         * However, bta_av_stream_chg is not called to increase bta_av_cb.audio_count yet.
+1 −4
Original line number Diff line number Diff line
@@ -135,9 +135,6 @@ enum
/* size of database for service discovery */
#define BTA_AV_DISC_BUF_SIZE        1000

/* offset of media type in codec info byte array */
#define BTA_AV_MEDIA_TYPE_IDX       1

/* maximum length of AVDTP security data */
#define BTA_AV_SECURITY_MAX_LEN     400

@@ -484,7 +481,7 @@ typedef struct
    uint16_t            avdt_version;   /* the avdt version of peer device */
    tBTA_SEC            sec_mask;       /* security mask */
    tA2D_CODEC_TYPE     codec_type;     /* codec type */
    uint8_t             media_type;     /* Media type */
    uint8_t             media_type;     /* Media type: AVDT_MEDIA_TYPE_* */
    bool                cong;           /* true if AVDTP congested */
    tBTA_AV_STATUS      open_status;    /* open failure status */
    tBTA_AV_CHNL        chnl;           /* the channel: audio/video */
+2 −2
Original line number Diff line number Diff line
@@ -552,9 +552,9 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
            /* set up the audio stream control block */
            p_scb->p_act_tbl = (const tBTA_AV_ACT *)bta_av_a2d_action;
            p_scb->p_cos     = &bta_av_a2d_cos;
            p_scb->media_type= AVDT_MEDIA_AUDIO;
            p_scb->media_type= AVDT_MEDIA_TYPE_AUDIO;
            cs.cfg.psc_mask  = AVDT_PSC_TRANS;
            cs.media_type    = AVDT_MEDIA_AUDIO;
            cs.media_type    = AVDT_MEDIA_TYPE_AUDIO;
            cs.mtu           = p_bta_av_cfg->audio_mtu;
            cs.flush_to      = L2CAP_DEFAULT_FLUSH_TO;
            tA2D_CODEC_SEP_INDEX codec_sep_index = A2D_CODEC_SEP_INDEX_SBC;
+4 −0
Original line number Diff line number Diff line
@@ -130,6 +130,10 @@ static bool bta_av_co_audio_peer_supports_codec(tBTA_AV_CO_PEER *p_peer, uint8_t
static bool bta_av_co_audio_peer_src_supports_codec(tBTA_AV_CO_PEER *p_peer, uint8_t *p_src_index);


const uint8_t *bta_av_co_get_codec_info(void)
{
    return bta_av_co_cb.codec_cfg.info;
}

/*******************************************************************************
 **
+3 −0
Original line number Diff line number Diff line
@@ -29,6 +29,9 @@
**  Functions
********************************************************************************/

// Gets the current codec info.
const uint8_t *bta_av_co_get_codec_info(void);

/*******************************************************************************
 **
 ** Function         bta_av_co_cp_is_active
Loading