Loading system/bta/av/bta_av_aact.cc +2 −10 Original line number Diff line number Diff line Loading @@ -66,9 +66,6 @@ static void bta_av_st_rc_timer(tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data); static const size_t SBC_MAX_BITPOOL_OFFSET = 6; static const size_t SBC_MAX_BITPOOL = 53; /* state machine states */ enum { Loading Loading @@ -1930,13 +1927,8 @@ void bta_av_getcap_results (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) &av_sink_codec_info); } if ((uuid_int == UUID_SERVCLASS_AUDIO_SOURCE) && (cfg.codec_info[SBC_MAX_BITPOOL_OFFSET] > SBC_MAX_BITPOOL)) { APPL_TRACE_WARNING("%s: max bitpool length received for SBC is out of range." "Clamping the codec bitpool configuration from %d to %d.", __func__, cfg.codec_info[SBC_MAX_BITPOOL_OFFSET], SBC_MAX_BITPOOL); cfg.codec_info[SBC_MAX_BITPOOL_OFFSET] = SBC_MAX_BITPOOL; if (uuid_int == UUID_SERVCLASS_AUDIO_SOURCE) { A2DP_AdjustCodec(cfg.codec_info); } /* open the stream */ Loading system/stack/a2dp/a2dp_api.cc +16 −0 Original line number Diff line number Diff line Loading @@ -968,3 +968,19 @@ const tA2DP_ENCODER_INTERFACE* A2DP_GetEncoderInterface( LOG_ERROR(LOG_TAG, "%s: unsupported codec type 0x%x", __func__, codec_type); return NULL; } bool A2DP_AdjustCodec(uint8_t* p_codec_info) { tA2DP_CODEC_TYPE codec_type = A2DP_GetCodecType(p_codec_info); switch (codec_type) { case A2DP_MEDIA_CT_SBC: return A2DP_AdjustCodecSbc(p_codec_info); case A2DP_MEDIA_CT_NON_A2DP: return A2DP_VendorAdjustCodec(p_codec_info); default: break; } LOG_ERROR(LOG_TAG, "%s: unsupported codec type 0x%x", __func__, codec_type); return false; } system/stack/a2dp/a2dp_sbc.cc +17 −0 Original line number Diff line number Diff line Loading @@ -1149,3 +1149,20 @@ const tA2DP_ENCODER_INTERFACE* A2DP_GetEncoderInterfaceSbc( return &a2dp_encoder_interface_sbc; } bool A2DP_AdjustCodecSbc(uint8_t* p_codec_info) { tA2DP_SBC_CIE cfg_cie; if (A2DP_ParsSbcInfo(&cfg_cie, p_codec_info, false) != A2DP_SUCCESS) return false; // Updated the max bitpool if (cfg_cie.max_bitpool > A2DP_SBC_MAX_BITPOOL) { LOG_WARN(LOG_TAG, "Updated the SBC codec max bitpool from %d to %d", cfg_cie.max_bitpool, A2DP_SBC_MAX_BITPOOL); cfg_cie.max_bitpool = A2DP_SBC_MAX_BITPOOL; } return (A2DP_BldSbcInfo(AVDT_MEDIA_TYPE_AUDIO, &cfg_cie, p_codec_info) == A2DP_SUCCESS); } system/stack/a2dp/a2dp_vendor.cc +9 −0 Original line number Diff line number Diff line Loading @@ -364,3 +364,12 @@ const tA2DP_ENCODER_INTERFACE* A2DP_VendorGetEncoderInterface( return NULL; } bool A2DP_VendorAdjustCodec(uint8_t* p_codec_info) { // uint32_t vendor_id = A2DP_VendorCodecGetVendorId(p_codec_info); // uint16_t codec_id = A2DP_VendorCodecGetCodecId(p_codec_info); // Add checks based on <vendor_id, codec_id> return false; } system/stack/include/a2dp_api.h +5 −0 Original line number Diff line number Diff line Loading @@ -608,6 +608,11 @@ bool A2DP_BuildCodecHeader(const uint8_t* p_codec_info, BT_HDR* p_buf, const tA2DP_ENCODER_INTERFACE* A2DP_GetEncoderInterface( const uint8_t* p_codec_info); // Adjusts the A2DP codec, based on local support and Bluetooth specification. // |p_codec_info| contains the codec information to adjust. // Returns true if |p_codec_info| is valid and supported, otherwise false. bool A2DP_AdjustCodec(uint8_t* p_codec_info); #ifdef __cplusplus } #endif Loading Loading
system/bta/av/bta_av_aact.cc +2 −10 Original line number Diff line number Diff line Loading @@ -66,9 +66,6 @@ static void bta_av_st_rc_timer(tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data); static const size_t SBC_MAX_BITPOOL_OFFSET = 6; static const size_t SBC_MAX_BITPOOL = 53; /* state machine states */ enum { Loading Loading @@ -1930,13 +1927,8 @@ void bta_av_getcap_results (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data) &av_sink_codec_info); } if ((uuid_int == UUID_SERVCLASS_AUDIO_SOURCE) && (cfg.codec_info[SBC_MAX_BITPOOL_OFFSET] > SBC_MAX_BITPOOL)) { APPL_TRACE_WARNING("%s: max bitpool length received for SBC is out of range." "Clamping the codec bitpool configuration from %d to %d.", __func__, cfg.codec_info[SBC_MAX_BITPOOL_OFFSET], SBC_MAX_BITPOOL); cfg.codec_info[SBC_MAX_BITPOOL_OFFSET] = SBC_MAX_BITPOOL; if (uuid_int == UUID_SERVCLASS_AUDIO_SOURCE) { A2DP_AdjustCodec(cfg.codec_info); } /* open the stream */ Loading
system/stack/a2dp/a2dp_api.cc +16 −0 Original line number Diff line number Diff line Loading @@ -968,3 +968,19 @@ const tA2DP_ENCODER_INTERFACE* A2DP_GetEncoderInterface( LOG_ERROR(LOG_TAG, "%s: unsupported codec type 0x%x", __func__, codec_type); return NULL; } bool A2DP_AdjustCodec(uint8_t* p_codec_info) { tA2DP_CODEC_TYPE codec_type = A2DP_GetCodecType(p_codec_info); switch (codec_type) { case A2DP_MEDIA_CT_SBC: return A2DP_AdjustCodecSbc(p_codec_info); case A2DP_MEDIA_CT_NON_A2DP: return A2DP_VendorAdjustCodec(p_codec_info); default: break; } LOG_ERROR(LOG_TAG, "%s: unsupported codec type 0x%x", __func__, codec_type); return false; }
system/stack/a2dp/a2dp_sbc.cc +17 −0 Original line number Diff line number Diff line Loading @@ -1149,3 +1149,20 @@ const tA2DP_ENCODER_INTERFACE* A2DP_GetEncoderInterfaceSbc( return &a2dp_encoder_interface_sbc; } bool A2DP_AdjustCodecSbc(uint8_t* p_codec_info) { tA2DP_SBC_CIE cfg_cie; if (A2DP_ParsSbcInfo(&cfg_cie, p_codec_info, false) != A2DP_SUCCESS) return false; // Updated the max bitpool if (cfg_cie.max_bitpool > A2DP_SBC_MAX_BITPOOL) { LOG_WARN(LOG_TAG, "Updated the SBC codec max bitpool from %d to %d", cfg_cie.max_bitpool, A2DP_SBC_MAX_BITPOOL); cfg_cie.max_bitpool = A2DP_SBC_MAX_BITPOOL; } return (A2DP_BldSbcInfo(AVDT_MEDIA_TYPE_AUDIO, &cfg_cie, p_codec_info) == A2DP_SUCCESS); }
system/stack/a2dp/a2dp_vendor.cc +9 −0 Original line number Diff line number Diff line Loading @@ -364,3 +364,12 @@ const tA2DP_ENCODER_INTERFACE* A2DP_VendorGetEncoderInterface( return NULL; } bool A2DP_VendorAdjustCodec(uint8_t* p_codec_info) { // uint32_t vendor_id = A2DP_VendorCodecGetVendorId(p_codec_info); // uint16_t codec_id = A2DP_VendorCodecGetCodecId(p_codec_info); // Add checks based on <vendor_id, codec_id> return false; }
system/stack/include/a2dp_api.h +5 −0 Original line number Diff line number Diff line Loading @@ -608,6 +608,11 @@ bool A2DP_BuildCodecHeader(const uint8_t* p_codec_info, BT_HDR* p_buf, const tA2DP_ENCODER_INTERFACE* A2DP_GetEncoderInterface( const uint8_t* p_codec_info); // Adjusts the A2DP codec, based on local support and Bluetooth specification. // |p_codec_info| contains the codec information to adjust. // Returns true if |p_codec_info| is valid and supported, otherwise false. bool A2DP_AdjustCodec(uint8_t* p_codec_info); #ifdef __cplusplus } #endif Loading