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

Commit 66f2fc29 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Update the A2DP codec setup and selection mechanism"

parents 72afff0f 26fcb4d8
Loading
Loading
Loading
Loading
+31 −19
Original line number Diff line number Diff line
@@ -457,6 +457,7 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
        p_bta_av_cfg  = (tBTA_AV_CFG *) &bta_av_cfg;
    }

    APPL_TRACE_DEBUG("%s: profile: 0x%x", __func__, profile_initialized);
    if (p_bta_av_cfg == NULL)
    {
        APPL_TRACE_ERROR("AV configuration is null!");
@@ -563,7 +564,10 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
            cs.media_type    = AVDT_MEDIA_TYPE_AUDIO;
            cs.mtu           = p_bta_av_cfg->audio_mtu;
            cs.flush_to      = L2CAP_DEFAULT_FLUSH_TO;
            tA2DP_CODEC_SEP_INDEX codec_sep_index = A2DP_CODEC_SEP_INDEX_SBC;
            tA2DP_CODEC_SEP_INDEX codec_sep_index_min =
                A2DP_CODEC_SEP_INDEX_SOURCE_MIN;
            tA2DP_CODEC_SEP_INDEX codec_sep_index_max =
                A2DP_CODEC_SEP_INDEX_SOURCE_MAX;

#if (AVDT_REPORTING == TRUE)
            if(bta_av_cb.features & BTA_AV_FEAT_REPORT)
@@ -578,13 +582,15 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
            if (profile_initialized == UUID_SERVCLASS_AUDIO_SOURCE)
            {
                cs.tsep = AVDT_TSEP_SRC;
                codec_sep_index = A2DP_CODEC_SEP_INDEX_SBC;
                codec_sep_index_min = A2DP_CODEC_SEP_INDEX_SOURCE_MIN;
                codec_sep_index_max = A2DP_CODEC_SEP_INDEX_SOURCE_MAX;
            }
            else if (profile_initialized == UUID_SERVCLASS_AUDIO_SINK)
            {
                cs.tsep = AVDT_TSEP_SNK;
                cs.p_sink_data_cback = bta_av_sink_data_cback;
                codec_sep_index = A2DP_CODEC_SEP_INDEX_SBC_SINK;
                codec_sep_index_min = A2DP_CODEC_SEP_INDEX_SINK_MIN;
                codec_sep_index_max = A2DP_CODEC_SEP_INDEX_SINK_MAX;
            }

            /* Initialize handles to zero */
@@ -595,9 +601,16 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)

            /* keep the configuration in the stream control block */
            memcpy(&p_scb->cfg, &cs.cfg, sizeof(tAVDT_CFG));
            if ((*bta_av_a2dp_cos.init)(codec_sep_index, &cs.cfg)) {
                if (AVDT_CreateStream(&p_scb->seps[codec_sep_index].av_handle, &cs)
                    == AVDT_SUCCESS) {
            for (int i = 0; i < A2DP_CODEC_SEP_INDEX_MAX; i++) {
                tA2DP_CODEC_SEP_INDEX codec_sep_index =
                    static_cast<tA2DP_CODEC_SEP_INDEX>(i);
                if (!(*bta_av_a2dp_cos.init)(codec_sep_index, &cs.cfg)) {
                    continue;
                }
                if (AVDT_CreateStream(&p_scb->seps[codec_sep_index].av_handle,
                                      &cs) != AVDT_SUCCESS) {
                    continue;
                }
                /* Save a copy of the codec */
                memcpy(p_scb->seps[codec_sep_index].codec_info,
                       cs.cfg.codec_info, AVDT_CODEC_SIZE);
@@ -612,7 +625,6 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
                    p_scb->seps[codec_sep_index].p_app_sink_data_cback = NULL;
                }
            }
            }

            if(!bta_av_cb.reg_audio)
            {
+137 −129

File changed.

Preview size limit exceeded, changes collapsed.

+0 −5
Original line number Diff line number Diff line
@@ -1145,11 +1145,6 @@
#define AVDT_NUM_TC_TBL             6
#endif

/* Maximum size in bytes of the codec capabilities information element. */
#ifndef AVDT_CODEC_SIZE
#define AVDT_CODEC_SIZE             10
#endif

/* Maximum size in bytes of the content protection information element. */
#ifndef AVDT_PROTECT_SIZE
#define AVDT_PROTECT_SIZE           90
+17 −8

File changed.

Preview size limit exceeded, changes collapsed.

+2 −2
Original line number Diff line number Diff line
@@ -355,7 +355,7 @@ void A2DP_InitDefaultCodecSbc(uint8_t* p_codec_info) {
  }
}

bool A2DP_SetCodecSbc(const tA2DP_FEEDING_PARAMS* p_feeding_params,
bool A2DP_SetSourceCodecSbc(const tA2DP_FEEDING_PARAMS* p_feeding_params,
                            uint8_t* p_codec_info) {
  tA2DP_SBC_CIE sbc_config = a2dp_sbc_default_config;

Loading