Loading system/bta/av/bta_av_aact.cc +11 −6 Original line number Diff line number Diff line Loading @@ -873,7 +873,7 @@ void bta_av_cleanup(tBTA_AV_SCB* p_scb, UNUSED_ATTR tBTA_AV_DATA* p_data) { /* if de-registering shut everything down */ msg.hdr.layer_specific = p_scb->hndl; p_scb->started = false; p_scb->current_codec = nullptr; p_scb->use_rtp_header_marker_bit = false; p_scb->cong = false; p_scb->role = role; p_scb->cur_psc_mask = 0; Loading Loading @@ -1326,7 +1326,7 @@ void bta_av_do_close(tBTA_AV_SCB* p_scb, UNUSED_ATTR tBTA_AV_DATA* p_data) { /* close stream */ p_scb->started = false; p_scb->current_codec = nullptr; p_scb->use_rtp_header_marker_bit = false; /* drop the buffers queued in L2CAP */ L2CA_FlushChannel(p_scb->l2c_cid, L2CAP_FLUSH_CHANS_ALL); Loading Loading @@ -2028,7 +2028,7 @@ void bta_av_data_path(tBTA_AV_SCB* p_scb, UNUSED_ATTR tBTA_AV_DATA* p_data) { if (p_scb->cong) return; if (p_scb->current_codec->useRtpHeaderMarkerBit()) { if (p_scb->use_rtp_header_marker_bit) { m_pt |= AVDT_MARKER_SET; } Loading Loading @@ -2157,7 +2157,11 @@ void bta_av_start_ok(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { p_scb->wait, p_scb->role); p_scb->started = true; p_scb->current_codec = bta_av_get_a2dp_current_codec(); // The RTP Header marker bit A2dpCodecConfig* codec_config = bta_av_get_a2dp_peer_current_codec(p_scb->peer_addr); CHECK(codec_config != nullptr); p_scb->use_rtp_header_marker_bit = codec_config->useRtpHeaderMarkerBit(); if (p_scb->sco_suspend) { p_scb->sco_suspend = false; Loading @@ -2182,8 +2186,9 @@ void bta_av_start_ok(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { p_data = (tBTA_AV_DATA*)&hdr; hdr.offset = BTA_AV_RS_FAIL; } APPL_TRACE_DEBUG("%s: peer %s wait:0x%x", __func__, p_scb->peer_addr.ToString().c_str(), p_scb->wait); APPL_TRACE_DEBUG("%s: peer %s wait:0x%x use_rtp_header_marker_bit:%s", __func__, p_scb->peer_addr.ToString().c_str(), p_scb->wait, (p_scb->use_rtp_header_marker_bit) ? "true" : "false"); if (p_data && (p_data->hdr.offset != BTA_AV_RS_NONE)) { p_scb->wait &= ~BTA_AV_WAIT_ROLE_SW_BITS; Loading system/bta/av/bta_av_int.h +3 −1 Original line number Diff line number Diff line Loading @@ -492,7 +492,9 @@ struct tBTA_AV_SCB { uint8_t rc_handle; /* connected AVRCP handle */ bool use_rc; /* true if AVRCP is allowed */ bool started; /* true if stream started */ A2dpCodecConfig* current_codec; /* The current A2DP codec */ bool use_rtp_header_marker_bit; /* true if the encoded data packets have RTP * headers, and the Marker bit in the header * is set according to RFC 6416 */ uint8_t co_started; /* non-zero, if stream started from call-out perspective */ bool recfg_sup; /* true if the first attempt to reconfigure the stream was Loading system/btif/co/bta_av_co.cc +23 −0 Original line number Diff line number Diff line Loading @@ -184,6 +184,14 @@ class BtaAvCo { */ A2dpCodecConfig* GetActivePeerCurrentCodec(); /** * Get the current codec configuration for a peer. * * @param peer_address the peer address * @return the current codec configuration if found, otherwise nullptr */ A2dpCodecConfig* GetPeerCurrentCodec(const RawAddress& peer_address); /** * Find the peer UUID for a given BTA AV handle. * Loading Loading @@ -699,6 +707,16 @@ A2dpCodecConfig* BtaAvCo::GetActivePeerCurrentCodec() { return active_peer_->GetCodecs()->getCurrentCodecConfig(); } A2dpCodecConfig* BtaAvCo::GetPeerCurrentCodec(const RawAddress& peer_address) { std::lock_guard<std::recursive_mutex> lock(codec_lock_); BtaAvCoPeer* peer = FindPeer(peer_address); if (peer == nullptr || peer->GetCodecs() == nullptr) { return nullptr; } return peer->GetCodecs()->getCurrentCodecConfig(); } BtaAvCoPeer* BtaAvCo::FindPeer(const RawAddress& peer_address) { for (size_t i = 0; i < BTA_AV_CO_NUM_ELEMENTS(peers_); i++) { BtaAvCoPeer* p_peer = &peers_[i]; Loading Loading @@ -1785,6 +1803,11 @@ A2dpCodecConfig* bta_av_get_a2dp_current_codec(void) { return bta_av_co_cb.GetActivePeerCurrentCodec(); } A2dpCodecConfig* bta_av_get_a2dp_peer_current_codec( const RawAddress& peer_address) { return bta_av_co_cb.GetPeerCurrentCodec(peer_address); } bool bta_av_co_audio_init(btav_a2dp_codec_index_t codec_index, AvdtpSepConfig* p_cfg) { return A2DP_InitCodecConfig(codec_index, p_cfg); Loading system/btif/include/btif_av_co.h +8 −1 Original line number Diff line number Diff line Loading @@ -66,9 +66,16 @@ void bta_av_co_init( const std::vector<btav_a2dp_codec_config_t>& codec_priorities); // Gets the current A2DP codec for the active peer. // Returns a pointer to the current |A2dpCodec| if valid, otherwise nullptr. // Returns a pointer to the current |A2dpCodecConfig| if valid, otherwise // nullptr. A2dpCodecConfig* bta_av_get_a2dp_current_codec(void); // Gets the current A2DP codec for a peer identified by |peer_address|. // Returns a pointer to the current |A2dpCodecConfig| if valid, otherwise // nullptr. A2dpCodecConfig* bta_av_get_a2dp_peer_current_codec( const RawAddress& peer_address); // Dump A2DP codec debug-related information for the A2DP module. // |fd| is the file descriptor to use for writing the ASCII formatted // information. Loading Loading
system/bta/av/bta_av_aact.cc +11 −6 Original line number Diff line number Diff line Loading @@ -873,7 +873,7 @@ void bta_av_cleanup(tBTA_AV_SCB* p_scb, UNUSED_ATTR tBTA_AV_DATA* p_data) { /* if de-registering shut everything down */ msg.hdr.layer_specific = p_scb->hndl; p_scb->started = false; p_scb->current_codec = nullptr; p_scb->use_rtp_header_marker_bit = false; p_scb->cong = false; p_scb->role = role; p_scb->cur_psc_mask = 0; Loading Loading @@ -1326,7 +1326,7 @@ void bta_av_do_close(tBTA_AV_SCB* p_scb, UNUSED_ATTR tBTA_AV_DATA* p_data) { /* close stream */ p_scb->started = false; p_scb->current_codec = nullptr; p_scb->use_rtp_header_marker_bit = false; /* drop the buffers queued in L2CAP */ L2CA_FlushChannel(p_scb->l2c_cid, L2CAP_FLUSH_CHANS_ALL); Loading Loading @@ -2028,7 +2028,7 @@ void bta_av_data_path(tBTA_AV_SCB* p_scb, UNUSED_ATTR tBTA_AV_DATA* p_data) { if (p_scb->cong) return; if (p_scb->current_codec->useRtpHeaderMarkerBit()) { if (p_scb->use_rtp_header_marker_bit) { m_pt |= AVDT_MARKER_SET; } Loading Loading @@ -2157,7 +2157,11 @@ void bta_av_start_ok(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { p_scb->wait, p_scb->role); p_scb->started = true; p_scb->current_codec = bta_av_get_a2dp_current_codec(); // The RTP Header marker bit A2dpCodecConfig* codec_config = bta_av_get_a2dp_peer_current_codec(p_scb->peer_addr); CHECK(codec_config != nullptr); p_scb->use_rtp_header_marker_bit = codec_config->useRtpHeaderMarkerBit(); if (p_scb->sco_suspend) { p_scb->sco_suspend = false; Loading @@ -2182,8 +2186,9 @@ void bta_av_start_ok(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { p_data = (tBTA_AV_DATA*)&hdr; hdr.offset = BTA_AV_RS_FAIL; } APPL_TRACE_DEBUG("%s: peer %s wait:0x%x", __func__, p_scb->peer_addr.ToString().c_str(), p_scb->wait); APPL_TRACE_DEBUG("%s: peer %s wait:0x%x use_rtp_header_marker_bit:%s", __func__, p_scb->peer_addr.ToString().c_str(), p_scb->wait, (p_scb->use_rtp_header_marker_bit) ? "true" : "false"); if (p_data && (p_data->hdr.offset != BTA_AV_RS_NONE)) { p_scb->wait &= ~BTA_AV_WAIT_ROLE_SW_BITS; Loading
system/bta/av/bta_av_int.h +3 −1 Original line number Diff line number Diff line Loading @@ -492,7 +492,9 @@ struct tBTA_AV_SCB { uint8_t rc_handle; /* connected AVRCP handle */ bool use_rc; /* true if AVRCP is allowed */ bool started; /* true if stream started */ A2dpCodecConfig* current_codec; /* The current A2DP codec */ bool use_rtp_header_marker_bit; /* true if the encoded data packets have RTP * headers, and the Marker bit in the header * is set according to RFC 6416 */ uint8_t co_started; /* non-zero, if stream started from call-out perspective */ bool recfg_sup; /* true if the first attempt to reconfigure the stream was Loading
system/btif/co/bta_av_co.cc +23 −0 Original line number Diff line number Diff line Loading @@ -184,6 +184,14 @@ class BtaAvCo { */ A2dpCodecConfig* GetActivePeerCurrentCodec(); /** * Get the current codec configuration for a peer. * * @param peer_address the peer address * @return the current codec configuration if found, otherwise nullptr */ A2dpCodecConfig* GetPeerCurrentCodec(const RawAddress& peer_address); /** * Find the peer UUID for a given BTA AV handle. * Loading Loading @@ -699,6 +707,16 @@ A2dpCodecConfig* BtaAvCo::GetActivePeerCurrentCodec() { return active_peer_->GetCodecs()->getCurrentCodecConfig(); } A2dpCodecConfig* BtaAvCo::GetPeerCurrentCodec(const RawAddress& peer_address) { std::lock_guard<std::recursive_mutex> lock(codec_lock_); BtaAvCoPeer* peer = FindPeer(peer_address); if (peer == nullptr || peer->GetCodecs() == nullptr) { return nullptr; } return peer->GetCodecs()->getCurrentCodecConfig(); } BtaAvCoPeer* BtaAvCo::FindPeer(const RawAddress& peer_address) { for (size_t i = 0; i < BTA_AV_CO_NUM_ELEMENTS(peers_); i++) { BtaAvCoPeer* p_peer = &peers_[i]; Loading Loading @@ -1785,6 +1803,11 @@ A2dpCodecConfig* bta_av_get_a2dp_current_codec(void) { return bta_av_co_cb.GetActivePeerCurrentCodec(); } A2dpCodecConfig* bta_av_get_a2dp_peer_current_codec( const RawAddress& peer_address) { return bta_av_co_cb.GetPeerCurrentCodec(peer_address); } bool bta_av_co_audio_init(btav_a2dp_codec_index_t codec_index, AvdtpSepConfig* p_cfg) { return A2DP_InitCodecConfig(codec_index, p_cfg); Loading
system/btif/include/btif_av_co.h +8 −1 Original line number Diff line number Diff line Loading @@ -66,9 +66,16 @@ void bta_av_co_init( const std::vector<btav_a2dp_codec_config_t>& codec_priorities); // Gets the current A2DP codec for the active peer. // Returns a pointer to the current |A2dpCodec| if valid, otherwise nullptr. // Returns a pointer to the current |A2dpCodecConfig| if valid, otherwise // nullptr. A2dpCodecConfig* bta_av_get_a2dp_current_codec(void); // Gets the current A2DP codec for a peer identified by |peer_address|. // Returns a pointer to the current |A2dpCodecConfig| if valid, otherwise // nullptr. A2dpCodecConfig* bta_av_get_a2dp_peer_current_codec( const RawAddress& peer_address); // Dump A2DP codec debug-related information for the A2DP module. // |fd| is the file descriptor to use for writing the ASCII formatted // information. Loading