Loading system/audio_hal_interface/a2dp_encoding.cc +1 −1 Original line number Diff line number Diff line Loading @@ -277,7 +277,7 @@ bool a2dp_get_selected_hal_codec_config(CodecConfiguration* codec_config) { RawAddress peer_addr = btif_av_source_active_peer(); tA2DP_ENCODER_INIT_PEER_PARAMS peer_param; bta_av_co_get_peer_params(peer_addr, &peer_param); int effectiveMtu = a2dp_config->getEffectiveMtu(); int effectiveMtu = bta_av_co_get_encoder_effective_frame_size(); if (effectiveMtu > 0 && effectiveMtu < peer_param.peer_mtu) { codec_config->peerMtu = effectiveMtu; } else { Loading system/bta/av/bta_av_aact.cc +7 −0 Original line number Diff line number Diff line Loading @@ -3044,6 +3044,13 @@ void bta_av_vendor_offload_start(tBTA_AV_SCB* p_scb, ARRAY_TO_STREAM(p_param, offload_start->codec_info, (int8_t)sizeof(offload_start->codec_info)); p_scb->offload_started = true; LOG_INFO( "codec: %#x, sample rate: %#x, bit depth: %#x, channel: %#x, bitrate: " "%#x, ACL: %#x, L2CAP: %#x, MTU: %#x", offload_start->codec_type, offload_start->sample_rate, offload_start->bits_per_sample, offload_start->ch_mode, offload_start->encoded_audio_bitrate, offload_start->acl_hdl, offload_start->l2c_rcid, offload_start->mtu); BTM_VendorSpecificCommand(HCI_CONTROLLER_A2DP, p_param - param, param, offload_vendor_callback); } Loading system/btif/co/bta_av_co.cc +17 −0 Original line number Diff line number Diff line Loading @@ -428,6 +428,13 @@ class BtaAvCo { */ bool SetCodecAudioConfig(const btav_a2dp_codec_config_t& codec_audio_config); /** * Get the Source encoder maximum frame size for the current codec. * * @return the effective frame size for the current codec */ int GetSourceEncoderEffectiveFrameSize(); /** * Report the source codec state for a peer * Loading Loading @@ -1642,6 +1649,12 @@ bool BtaAvCo::SetCodecAudioConfig( return true; } int BtaAvCo::GetSourceEncoderEffectiveFrameSize() { std::lock_guard<std::recursive_mutex> lock(codec_lock_); return A2DP_GetEecoderEffectiveFrameSize(codec_config_); } bool BtaAvCo::ReportSourceCodecState(BtaAvCoPeer* p_peer) { btav_a2dp_codec_config_t codec_config; std::vector<btav_a2dp_codec_config_t> codecs_local_capabilities; Loading Loading @@ -2201,6 +2214,10 @@ bool bta_av_co_set_codec_audio_config( return bta_av_co_cb.SetCodecAudioConfig(codec_audio_config); } int bta_av_co_get_encoder_effective_frame_size() { return bta_av_co_cb.GetSourceEncoderEffectiveFrameSize(); } btav_a2dp_scmst_info_t bta_av_co_get_scmst_info( const RawAddress& peer_address) { BtaAvCoPeer* p_peer = bta_av_co_cb.FindPeer(peer_address); Loading system/btif/include/btif_av_co.h +4 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,10 @@ A2dpCodecConfig* bta_av_get_a2dp_current_codec(void); A2dpCodecConfig* bta_av_get_a2dp_peer_current_codec( const RawAddress& peer_address); // Gets the A2DP effective frame size from the current encoder. // Returns the effective frame size if the encoder is configured, otherwise 0. int bta_av_co_get_encoder_effective_frame_size(); // Dump A2DP codec debug-related information for the A2DP module. // |fd| is the file descriptor to use for writing the ASCII formatted // information. Loading system/btif/src/btif_a2dp_source.cc +21 −0 Original line number Diff line number Diff line Loading @@ -249,6 +249,8 @@ static void btif_a2dp_source_audio_tx_flush_event(void); static void btif_a2dp_source_setup_codec(const RawAddress& peer_addr); static void btif_a2dp_source_setup_codec_delayed( const RawAddress& peer_address); static void btif_a2dp_source_cleanup_codec(); static void btif_a2dp_source_cleanup_codec_delayed(); static void btif_a2dp_source_encoder_user_config_update_event( const RawAddress& peer_address, const std::vector<btav_a2dp_codec_config_t>& codec_user_preferences, Loading Loading @@ -452,6 +454,7 @@ bool btif_a2dp_source_end_session(const RawAddress& peer_address) { btif_a2dp_source_thread.DoInThread( FROM_HERE, base::Bind(&btif_a2dp_source_end_session_delayed, peer_address)); btif_a2dp_source_cleanup_codec(); return true; } Loading Loading @@ -593,6 +596,24 @@ static void btif_a2dp_source_setup_codec_delayed( } } static void btif_a2dp_source_cleanup_codec() { LOG_INFO("%s: state=%s", __func__, btif_a2dp_source_cb.StateStr().c_str()); if (btif_a2dp_source_is_streaming()) { // Must stop media task first before cleaning up the encoder btif_a2dp_source_stop_audio_req(); } btif_a2dp_source_thread.DoInThread( FROM_HERE, base::Bind(&btif_a2dp_source_cleanup_codec_delayed)); } static void btif_a2dp_source_cleanup_codec_delayed() { LOG_INFO("%s: state=%s", __func__, btif_a2dp_source_cb.StateStr().c_str()); if (btif_a2dp_source_cb.encoder_interface != nullptr) { btif_a2dp_source_cb.encoder_interface->encoder_cleanup(); btif_a2dp_source_cb.encoder_interface = nullptr; } } void btif_a2dp_source_start_audio_req(void) { LOG_INFO("%s: state=%s", __func__, btif_a2dp_source_cb.StateStr().c_str()); Loading Loading
system/audio_hal_interface/a2dp_encoding.cc +1 −1 Original line number Diff line number Diff line Loading @@ -277,7 +277,7 @@ bool a2dp_get_selected_hal_codec_config(CodecConfiguration* codec_config) { RawAddress peer_addr = btif_av_source_active_peer(); tA2DP_ENCODER_INIT_PEER_PARAMS peer_param; bta_av_co_get_peer_params(peer_addr, &peer_param); int effectiveMtu = a2dp_config->getEffectiveMtu(); int effectiveMtu = bta_av_co_get_encoder_effective_frame_size(); if (effectiveMtu > 0 && effectiveMtu < peer_param.peer_mtu) { codec_config->peerMtu = effectiveMtu; } else { Loading
system/bta/av/bta_av_aact.cc +7 −0 Original line number Diff line number Diff line Loading @@ -3044,6 +3044,13 @@ void bta_av_vendor_offload_start(tBTA_AV_SCB* p_scb, ARRAY_TO_STREAM(p_param, offload_start->codec_info, (int8_t)sizeof(offload_start->codec_info)); p_scb->offload_started = true; LOG_INFO( "codec: %#x, sample rate: %#x, bit depth: %#x, channel: %#x, bitrate: " "%#x, ACL: %#x, L2CAP: %#x, MTU: %#x", offload_start->codec_type, offload_start->sample_rate, offload_start->bits_per_sample, offload_start->ch_mode, offload_start->encoded_audio_bitrate, offload_start->acl_hdl, offload_start->l2c_rcid, offload_start->mtu); BTM_VendorSpecificCommand(HCI_CONTROLLER_A2DP, p_param - param, param, offload_vendor_callback); } Loading
system/btif/co/bta_av_co.cc +17 −0 Original line number Diff line number Diff line Loading @@ -428,6 +428,13 @@ class BtaAvCo { */ bool SetCodecAudioConfig(const btav_a2dp_codec_config_t& codec_audio_config); /** * Get the Source encoder maximum frame size for the current codec. * * @return the effective frame size for the current codec */ int GetSourceEncoderEffectiveFrameSize(); /** * Report the source codec state for a peer * Loading Loading @@ -1642,6 +1649,12 @@ bool BtaAvCo::SetCodecAudioConfig( return true; } int BtaAvCo::GetSourceEncoderEffectiveFrameSize() { std::lock_guard<std::recursive_mutex> lock(codec_lock_); return A2DP_GetEecoderEffectiveFrameSize(codec_config_); } bool BtaAvCo::ReportSourceCodecState(BtaAvCoPeer* p_peer) { btav_a2dp_codec_config_t codec_config; std::vector<btav_a2dp_codec_config_t> codecs_local_capabilities; Loading Loading @@ -2201,6 +2214,10 @@ bool bta_av_co_set_codec_audio_config( return bta_av_co_cb.SetCodecAudioConfig(codec_audio_config); } int bta_av_co_get_encoder_effective_frame_size() { return bta_av_co_cb.GetSourceEncoderEffectiveFrameSize(); } btav_a2dp_scmst_info_t bta_av_co_get_scmst_info( const RawAddress& peer_address) { BtaAvCoPeer* p_peer = bta_av_co_cb.FindPeer(peer_address); Loading
system/btif/include/btif_av_co.h +4 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,10 @@ A2dpCodecConfig* bta_av_get_a2dp_current_codec(void); A2dpCodecConfig* bta_av_get_a2dp_peer_current_codec( const RawAddress& peer_address); // Gets the A2DP effective frame size from the current encoder. // Returns the effective frame size if the encoder is configured, otherwise 0. int bta_av_co_get_encoder_effective_frame_size(); // Dump A2DP codec debug-related information for the A2DP module. // |fd| is the file descriptor to use for writing the ASCII formatted // information. Loading
system/btif/src/btif_a2dp_source.cc +21 −0 Original line number Diff line number Diff line Loading @@ -249,6 +249,8 @@ static void btif_a2dp_source_audio_tx_flush_event(void); static void btif_a2dp_source_setup_codec(const RawAddress& peer_addr); static void btif_a2dp_source_setup_codec_delayed( const RawAddress& peer_address); static void btif_a2dp_source_cleanup_codec(); static void btif_a2dp_source_cleanup_codec_delayed(); static void btif_a2dp_source_encoder_user_config_update_event( const RawAddress& peer_address, const std::vector<btav_a2dp_codec_config_t>& codec_user_preferences, Loading Loading @@ -452,6 +454,7 @@ bool btif_a2dp_source_end_session(const RawAddress& peer_address) { btif_a2dp_source_thread.DoInThread( FROM_HERE, base::Bind(&btif_a2dp_source_end_session_delayed, peer_address)); btif_a2dp_source_cleanup_codec(); return true; } Loading Loading @@ -593,6 +596,24 @@ static void btif_a2dp_source_setup_codec_delayed( } } static void btif_a2dp_source_cleanup_codec() { LOG_INFO("%s: state=%s", __func__, btif_a2dp_source_cb.StateStr().c_str()); if (btif_a2dp_source_is_streaming()) { // Must stop media task first before cleaning up the encoder btif_a2dp_source_stop_audio_req(); } btif_a2dp_source_thread.DoInThread( FROM_HERE, base::Bind(&btif_a2dp_source_cleanup_codec_delayed)); } static void btif_a2dp_source_cleanup_codec_delayed() { LOG_INFO("%s: state=%s", __func__, btif_a2dp_source_cb.StateStr().c_str()); if (btif_a2dp_source_cb.encoder_interface != nullptr) { btif_a2dp_source_cb.encoder_interface->encoder_cleanup(); btif_a2dp_source_cb.encoder_interface = nullptr; } } void btif_a2dp_source_start_audio_req(void) { LOG_INFO("%s: state=%s", __func__, btif_a2dp_source_cb.StateStr().c_str()); Loading