Loading system/btif/co/bta_av_co.cc +1 −1 Original line number Diff line number Diff line Loading @@ -1378,7 +1378,7 @@ void BtaAvCo::ProcessAudioDelay(tBTA_AV_HNDL bta_av_handle, APPL_TRACE_DEBUG("%s: peer %s bta_av_handle: 0x%x delay:0x%x", __func__, peer_address.ToString().c_str(), bta_av_handle, delay); btif_av_set_audio_delay(delay); btif_av_set_audio_delay(peer_address, delay); } void BtaAvCo::UpdateMtu(tBTA_AV_HNDL bta_av_handle, Loading system/btif/include/btif_av.h +8 −1 Original line number Diff line number Diff line Loading @@ -163,9 +163,16 @@ void btif_debug_av_dump(int fd); /** * Set the audio delay for the stream. * * @param peer_address the address of the peer to report * @param delay the delay to set in units of 1/10ms */ void btif_av_set_audio_delay(uint16_t delay); void btif_av_set_audio_delay(const RawAddress& peer_address, uint16_t delay); /** * Get the audio delay for the stream. * @param none */ uint16_t btif_av_get_audio_delay(void); /** * Reset the audio delay and count of audio bytes sent to zero. Loading system/btif/src/btif_a2dp_source.cc +1 −0 Original line number Diff line number Diff line Loading @@ -397,6 +397,7 @@ static void btif_a2dp_source_start_session_delayed( } if (bluetooth::audio::a2dp::is_hal_2_0_enabled()) { bluetooth::audio::a2dp::start_session(); bluetooth::audio::a2dp::set_remote_delay(btif_av_get_audio_delay()); BluetoothMetricsLogger::GetInstance()->LogBluetoothSessionStart( bluetooth::common::CONNECTION_TECHNOLOGY_TYPE_BREDR, 0); } else if (btif_av_is_a2dp_offload_enabled()) { Loading system/btif/src/btif_av.cc +24 −3 Original line number Diff line number Diff line Loading @@ -282,6 +282,10 @@ class BtifAvPeer { void SetSilence(bool silence) { is_silenced_ = silence; }; // AVDTP delay reporting in 1/10 milliseconds void SetDelayReport(uint16_t delay) { delay_report_ = delay; }; uint16_t GetDelayReport() const { return delay_report_; }; /** * Check whether any of the flags specified by the bitlags mask is set. * Loading Loading @@ -330,6 +334,7 @@ class BtifAvPeer { uint8_t flags_; bool self_initiated_connection_; bool is_silenced_; uint16_t delay_report_; }; class BtifAvSource { Loading Loading @@ -864,7 +869,8 @@ BtifAvPeer::BtifAvPeer(const RawAddress& peer_address, uint8_t peer_sep, av_open_on_rc_timer_(nullptr), edr_(0), flags_(0), self_initiated_connection_(false) {} self_initiated_connection_(false), delay_report_(0) {} BtifAvPeer::~BtifAvPeer() { alarm_free(av_open_on_rc_timer_); } Loading Loading @@ -3260,6 +3266,7 @@ static void btif_debug_av_peer_dump(int fd, const BtifAvPeer& peer) { dprintf(fd, " Support 3Mbps: %s\n", peer.Is3Mbps() ? "true" : "false"); dprintf(fd, " Self Initiated Connection: %s\n", peer.SelfInitiatedConnection() ? "true" : "false"); dprintf(fd, " Delay Reporting: %u\n", peer.GetDelayReport()); } static void btif_debug_av_source_dump(int fd) { Loading Loading @@ -3294,9 +3301,23 @@ void btif_debug_av_dump(int fd) { btif_debug_av_sink_dump(fd); } void btif_av_set_audio_delay(uint16_t delay) { void btif_av_set_audio_delay(const RawAddress& peer_address, uint16_t delay) { btif_a2dp_control_set_audio_delay(delay); bluetooth::audio::a2dp::set_remote_delay(delay); BtifAvPeer* peer = btif_av_find_peer(peer_address); if (peer != nullptr && peer->IsSink()) { peer->SetDelayReport(delay); if (peer->IsActivePeer()) { bluetooth::audio::a2dp::set_remote_delay(peer->GetDelayReport()); } } } uint16_t btif_av_get_audio_delay() { BtifAvPeer* peer = btif_av_find_active_peer(); if (peer != nullptr && peer->IsSink()) { return peer->GetDelayReport(); } return 0; } void btif_av_reset_audio_delay(void) { btif_a2dp_control_reset_audio_delay(); } Loading Loading
system/btif/co/bta_av_co.cc +1 −1 Original line number Diff line number Diff line Loading @@ -1378,7 +1378,7 @@ void BtaAvCo::ProcessAudioDelay(tBTA_AV_HNDL bta_av_handle, APPL_TRACE_DEBUG("%s: peer %s bta_av_handle: 0x%x delay:0x%x", __func__, peer_address.ToString().c_str(), bta_av_handle, delay); btif_av_set_audio_delay(delay); btif_av_set_audio_delay(peer_address, delay); } void BtaAvCo::UpdateMtu(tBTA_AV_HNDL bta_av_handle, Loading
system/btif/include/btif_av.h +8 −1 Original line number Diff line number Diff line Loading @@ -163,9 +163,16 @@ void btif_debug_av_dump(int fd); /** * Set the audio delay for the stream. * * @param peer_address the address of the peer to report * @param delay the delay to set in units of 1/10ms */ void btif_av_set_audio_delay(uint16_t delay); void btif_av_set_audio_delay(const RawAddress& peer_address, uint16_t delay); /** * Get the audio delay for the stream. * @param none */ uint16_t btif_av_get_audio_delay(void); /** * Reset the audio delay and count of audio bytes sent to zero. Loading
system/btif/src/btif_a2dp_source.cc +1 −0 Original line number Diff line number Diff line Loading @@ -397,6 +397,7 @@ static void btif_a2dp_source_start_session_delayed( } if (bluetooth::audio::a2dp::is_hal_2_0_enabled()) { bluetooth::audio::a2dp::start_session(); bluetooth::audio::a2dp::set_remote_delay(btif_av_get_audio_delay()); BluetoothMetricsLogger::GetInstance()->LogBluetoothSessionStart( bluetooth::common::CONNECTION_TECHNOLOGY_TYPE_BREDR, 0); } else if (btif_av_is_a2dp_offload_enabled()) { Loading
system/btif/src/btif_av.cc +24 −3 Original line number Diff line number Diff line Loading @@ -282,6 +282,10 @@ class BtifAvPeer { void SetSilence(bool silence) { is_silenced_ = silence; }; // AVDTP delay reporting in 1/10 milliseconds void SetDelayReport(uint16_t delay) { delay_report_ = delay; }; uint16_t GetDelayReport() const { return delay_report_; }; /** * Check whether any of the flags specified by the bitlags mask is set. * Loading Loading @@ -330,6 +334,7 @@ class BtifAvPeer { uint8_t flags_; bool self_initiated_connection_; bool is_silenced_; uint16_t delay_report_; }; class BtifAvSource { Loading Loading @@ -864,7 +869,8 @@ BtifAvPeer::BtifAvPeer(const RawAddress& peer_address, uint8_t peer_sep, av_open_on_rc_timer_(nullptr), edr_(0), flags_(0), self_initiated_connection_(false) {} self_initiated_connection_(false), delay_report_(0) {} BtifAvPeer::~BtifAvPeer() { alarm_free(av_open_on_rc_timer_); } Loading Loading @@ -3260,6 +3266,7 @@ static void btif_debug_av_peer_dump(int fd, const BtifAvPeer& peer) { dprintf(fd, " Support 3Mbps: %s\n", peer.Is3Mbps() ? "true" : "false"); dprintf(fd, " Self Initiated Connection: %s\n", peer.SelfInitiatedConnection() ? "true" : "false"); dprintf(fd, " Delay Reporting: %u\n", peer.GetDelayReport()); } static void btif_debug_av_source_dump(int fd) { Loading Loading @@ -3294,9 +3301,23 @@ void btif_debug_av_dump(int fd) { btif_debug_av_sink_dump(fd); } void btif_av_set_audio_delay(uint16_t delay) { void btif_av_set_audio_delay(const RawAddress& peer_address, uint16_t delay) { btif_a2dp_control_set_audio_delay(delay); bluetooth::audio::a2dp::set_remote_delay(delay); BtifAvPeer* peer = btif_av_find_peer(peer_address); if (peer != nullptr && peer->IsSink()) { peer->SetDelayReport(delay); if (peer->IsActivePeer()) { bluetooth::audio::a2dp::set_remote_delay(peer->GetDelayReport()); } } } uint16_t btif_av_get_audio_delay() { BtifAvPeer* peer = btif_av_find_active_peer(); if (peer != nullptr && peer->IsSink()) { return peer->GetDelayReport(); } return 0; } void btif_av_reset_audio_delay(void) { btif_a2dp_control_reset_audio_delay(); } Loading