Loading system/audio_hal_interface/aidl/audio_ctrl_ack.h +3 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ using ::aidl::android::hardware::bluetooth::audio::BluetoothAudioStatus; enum class BluetoothAudioCtrlAck : uint8_t { SUCCESS_FINISHED = 0, SUCCESS_RECONFIGURATION, PENDING, FAILURE_UNSUPPORTED, FAILURE_BUSY, Loading @@ -46,6 +47,8 @@ inline BluetoothAudioStatus BluetoothAudioCtrlAckToHalStatus( return BluetoothAudioStatus::FAILURE; case BluetoothAudioCtrlAck::FAILURE_DISCONNECTING: return BluetoothAudioStatus::FAILURE; case BluetoothAudioCtrlAck::SUCCESS_RECONFIGURATION: return BluetoothAudioStatus::RECONFIGURATION; default: return BluetoothAudioStatus::FAILURE; } Loading system/audio_hal_interface/le_audio_software.cc +32 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,22 @@ void LeAudioClientInterface::Sink::UpdateAudioConfigToHal( aidl::le_audio::offload_config_to_hal_audio_config(offload_config)); } void LeAudioClientInterface::Sink::SuspendedForReconfiguration() { if (HalVersionManager::GetHalTransport() == BluetoothAudioHalTransport::HIDL) { return; } if (aidl::le_audio::LeAudioSinkTransport::interface->GetTransportInstance() ->GetSessionType() != aidl::SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH) { return; } aidl::le_audio::LeAudioSinkTransport::interface->StreamSuspended( aidl::BluetoothAudioCtrlAck::SUCCESS_RECONFIGURATION); } size_t LeAudioClientInterface::Sink::Read(uint8_t* p_buf, uint32_t len) { if (HalVersionManager::GetHalTransport() == BluetoothAudioHalTransport::HIDL) { Loading Loading @@ -324,6 +340,22 @@ void LeAudioClientInterface::Source::StartSession() { } } void LeAudioClientInterface::Source::SuspendedForReconfiguration() { if (HalVersionManager::GetHalTransport() == BluetoothAudioHalTransport::HIDL) { return; } if (aidl::le_audio::LeAudioSourceTransport::interface->GetTransportInstance() ->GetSessionType() != aidl::SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH) { return; } aidl::le_audio::LeAudioSourceTransport::interface->StreamSuspended( aidl::BluetoothAudioCtrlAck::SUCCESS_RECONFIGURATION); } void LeAudioClientInterface::Source::ConfirmStreamingRequest() { LOG(INFO) << __func__; if ((hidl::le_audio::LeAudioSourceTransport::instance && Loading system/audio_hal_interface/le_audio_software.h +3 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ class LeAudioClientInterface { virtual void CancelStreamingRequest() = 0; virtual void UpdateAudioConfigToHal( const ::le_audio::offload_config& config) = 0; virtual void SuspendedForReconfiguration() = 0; }; public: Loading @@ -90,6 +91,7 @@ class LeAudioClientInterface { void CancelStreamingRequest() override; void UpdateAudioConfigToHal( const ::le_audio::offload_config& config) override; void SuspendedForReconfiguration() override; // Read the stream of bytes sinked to us by the upper layers size_t Read(uint8_t* p_buf, uint32_t len); }; Loading @@ -106,6 +108,7 @@ class LeAudioClientInterface { void CancelStreamingRequest() override; void UpdateAudioConfigToHal( const ::le_audio::offload_config& config) override; void SuspendedForReconfiguration() override; // Source the given stream of bytes to be sinked into the upper layers size_t Write(const uint8_t* p_buf, uint32_t len); }; Loading system/bta/le_audio/client.cc +31 −14 Original line number Diff line number Diff line Loading @@ -328,6 +328,15 @@ class LeAudioClientImpl : public LeAudioClient { } } void SuspendedForReconfiguration() { if (audio_sender_state_ > AudioState::IDLE) { LeAudioClientAudioSource::SuspendedForReconfiguration(); } if (audio_receiver_state_ > AudioState::IDLE) { LeAudioClientAudioSink::SuspendedForReconfiguration(); } } void CancelStreamingRequest() { if (audio_sender_state_ >= AudioState::READY_TO_START) { LeAudioClientAudioSource::CancelStreamingRequest(); Loading Loading @@ -3031,7 +3040,7 @@ class LeAudioClientImpl : public LeAudioClient { rxUnreceivedPackets, duplicatePackets); } bool RestartStreamingAfterReconfiguration(int group_id) { bool IsSuspendedForReconfiguration(int group_id) { if (group_id != active_group_id_) return false; DLOG(INFO) << __func__ << " audio_sender_state_: " << audio_sender_state_ Loading @@ -3044,19 +3053,26 @@ class LeAudioClientImpl : public LeAudioClient { DLOG(INFO) << __func__ << " stream_conf->reconfiguration_ongoing " << stream_conf->reconfiguration_ongoing; if (!stream_conf->reconfiguration_ongoing) return false; return stream_conf->reconfiguration_ongoing; } if (!groupStateMachine_->StartStream( group, static_cast<LeAudioContextType>(current_context_type_))) return false; bool RestartStreamingAfterReconfiguration(int group_id) { auto group = aseGroups_.FindById(group_id); LOG_ASSERT(group) << __func__ << " group does not exist: " << group_id; if (groupStateMachine_->StartStream( group, static_cast<LeAudioContextType>(current_context_type_))) { if (audio_sender_state_ == AudioState::RELEASING) audio_sender_state_ = AudioState::READY_TO_START; if (audio_receiver_state_ == AudioState::RELEASING) audio_receiver_state_ = AudioState::READY_TO_START; } else { audio_receiver_state_ = AudioState::IDLE; audio_sender_state_ = AudioState::IDLE; } stream_conf->reconfiguration_ongoing = false; group->stream_conf.reconfiguration_ongoing = false; return true; } Loading @@ -3081,10 +3097,12 @@ class LeAudioClientImpl : public LeAudioClient { case GroupStreamStatus::IDLE: { stream_setup_end_timestamp_ = 0; stream_setup_start_timestamp_ = 0; if (!RestartStreamingAfterReconfiguration(group_id)) if (IsSuspendedForReconfiguration(group_id)) { SuspendedForReconfiguration(); RestartStreamingAfterReconfiguration(group_id); } else { CancelStreamingRequest(); } LeAudioDeviceGroup* group = aseGroups_.FindById(active_group_id_); if (!group) { LOG(ERROR) << __func__ << ", Failed to update pending available " Loading @@ -3108,7 +3126,6 @@ class LeAudioClientImpl : public LeAudioClient { group->SetPendingUpdateAvailableContexts(std::nullopt); } break; } case GroupStreamStatus::RELEASING: Loading system/bta/le_audio/client_audio.cc +22 −0 Original line number Diff line number Diff line Loading @@ -401,6 +401,17 @@ void LeAudioClientAudioSource::ConfirmStreamingRequest() { start_audio_ticks(); } void LeAudioClientAudioSource::SuspendedForReconfiguration() { LOG(INFO) << __func__; if ((sinkClientInterface == nullptr) || (le_audio_sink_hal_state != HAL_STARTED)) { LOG(ERROR) << "LE audio device HAL was not started!"; return; } sinkClientInterface->SuspendedForReconfiguration(); } void LeAudioClientAudioSource::CancelStreamingRequest() { LOG(INFO) << __func__; if ((sinkClientInterface == nullptr) || Loading Loading @@ -628,3 +639,14 @@ void LeAudioClientAudioSink::UpdateAudioConfigToHal( sourceClientInterface->UpdateAudioConfigToHal(config); } void LeAudioClientAudioSink::SuspendedForReconfiguration() { LOG(INFO) << __func__; if ((sourceClientInterface == nullptr) || (le_audio_source_hal_state != HAL_STARTED)) { LOG(ERROR) << "LE audio device HAL was not started!"; return; } sourceClientInterface->SuspendedForReconfiguration(); } Loading
system/audio_hal_interface/aidl/audio_ctrl_ack.h +3 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ using ::aidl::android::hardware::bluetooth::audio::BluetoothAudioStatus; enum class BluetoothAudioCtrlAck : uint8_t { SUCCESS_FINISHED = 0, SUCCESS_RECONFIGURATION, PENDING, FAILURE_UNSUPPORTED, FAILURE_BUSY, Loading @@ -46,6 +47,8 @@ inline BluetoothAudioStatus BluetoothAudioCtrlAckToHalStatus( return BluetoothAudioStatus::FAILURE; case BluetoothAudioCtrlAck::FAILURE_DISCONNECTING: return BluetoothAudioStatus::FAILURE; case BluetoothAudioCtrlAck::SUCCESS_RECONFIGURATION: return BluetoothAudioStatus::RECONFIGURATION; default: return BluetoothAudioStatus::FAILURE; } Loading
system/audio_hal_interface/le_audio_software.cc +32 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,22 @@ void LeAudioClientInterface::Sink::UpdateAudioConfigToHal( aidl::le_audio::offload_config_to_hal_audio_config(offload_config)); } void LeAudioClientInterface::Sink::SuspendedForReconfiguration() { if (HalVersionManager::GetHalTransport() == BluetoothAudioHalTransport::HIDL) { return; } if (aidl::le_audio::LeAudioSinkTransport::interface->GetTransportInstance() ->GetSessionType() != aidl::SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH) { return; } aidl::le_audio::LeAudioSinkTransport::interface->StreamSuspended( aidl::BluetoothAudioCtrlAck::SUCCESS_RECONFIGURATION); } size_t LeAudioClientInterface::Sink::Read(uint8_t* p_buf, uint32_t len) { if (HalVersionManager::GetHalTransport() == BluetoothAudioHalTransport::HIDL) { Loading Loading @@ -324,6 +340,22 @@ void LeAudioClientInterface::Source::StartSession() { } } void LeAudioClientInterface::Source::SuspendedForReconfiguration() { if (HalVersionManager::GetHalTransport() == BluetoothAudioHalTransport::HIDL) { return; } if (aidl::le_audio::LeAudioSourceTransport::interface->GetTransportInstance() ->GetSessionType() != aidl::SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH) { return; } aidl::le_audio::LeAudioSourceTransport::interface->StreamSuspended( aidl::BluetoothAudioCtrlAck::SUCCESS_RECONFIGURATION); } void LeAudioClientInterface::Source::ConfirmStreamingRequest() { LOG(INFO) << __func__; if ((hidl::le_audio::LeAudioSourceTransport::instance && Loading
system/audio_hal_interface/le_audio_software.h +3 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ class LeAudioClientInterface { virtual void CancelStreamingRequest() = 0; virtual void UpdateAudioConfigToHal( const ::le_audio::offload_config& config) = 0; virtual void SuspendedForReconfiguration() = 0; }; public: Loading @@ -90,6 +91,7 @@ class LeAudioClientInterface { void CancelStreamingRequest() override; void UpdateAudioConfigToHal( const ::le_audio::offload_config& config) override; void SuspendedForReconfiguration() override; // Read the stream of bytes sinked to us by the upper layers size_t Read(uint8_t* p_buf, uint32_t len); }; Loading @@ -106,6 +108,7 @@ class LeAudioClientInterface { void CancelStreamingRequest() override; void UpdateAudioConfigToHal( const ::le_audio::offload_config& config) override; void SuspendedForReconfiguration() override; // Source the given stream of bytes to be sinked into the upper layers size_t Write(const uint8_t* p_buf, uint32_t len); }; Loading
system/bta/le_audio/client.cc +31 −14 Original line number Diff line number Diff line Loading @@ -328,6 +328,15 @@ class LeAudioClientImpl : public LeAudioClient { } } void SuspendedForReconfiguration() { if (audio_sender_state_ > AudioState::IDLE) { LeAudioClientAudioSource::SuspendedForReconfiguration(); } if (audio_receiver_state_ > AudioState::IDLE) { LeAudioClientAudioSink::SuspendedForReconfiguration(); } } void CancelStreamingRequest() { if (audio_sender_state_ >= AudioState::READY_TO_START) { LeAudioClientAudioSource::CancelStreamingRequest(); Loading Loading @@ -3031,7 +3040,7 @@ class LeAudioClientImpl : public LeAudioClient { rxUnreceivedPackets, duplicatePackets); } bool RestartStreamingAfterReconfiguration(int group_id) { bool IsSuspendedForReconfiguration(int group_id) { if (group_id != active_group_id_) return false; DLOG(INFO) << __func__ << " audio_sender_state_: " << audio_sender_state_ Loading @@ -3044,19 +3053,26 @@ class LeAudioClientImpl : public LeAudioClient { DLOG(INFO) << __func__ << " stream_conf->reconfiguration_ongoing " << stream_conf->reconfiguration_ongoing; if (!stream_conf->reconfiguration_ongoing) return false; return stream_conf->reconfiguration_ongoing; } if (!groupStateMachine_->StartStream( group, static_cast<LeAudioContextType>(current_context_type_))) return false; bool RestartStreamingAfterReconfiguration(int group_id) { auto group = aseGroups_.FindById(group_id); LOG_ASSERT(group) << __func__ << " group does not exist: " << group_id; if (groupStateMachine_->StartStream( group, static_cast<LeAudioContextType>(current_context_type_))) { if (audio_sender_state_ == AudioState::RELEASING) audio_sender_state_ = AudioState::READY_TO_START; if (audio_receiver_state_ == AudioState::RELEASING) audio_receiver_state_ = AudioState::READY_TO_START; } else { audio_receiver_state_ = AudioState::IDLE; audio_sender_state_ = AudioState::IDLE; } stream_conf->reconfiguration_ongoing = false; group->stream_conf.reconfiguration_ongoing = false; return true; } Loading @@ -3081,10 +3097,12 @@ class LeAudioClientImpl : public LeAudioClient { case GroupStreamStatus::IDLE: { stream_setup_end_timestamp_ = 0; stream_setup_start_timestamp_ = 0; if (!RestartStreamingAfterReconfiguration(group_id)) if (IsSuspendedForReconfiguration(group_id)) { SuspendedForReconfiguration(); RestartStreamingAfterReconfiguration(group_id); } else { CancelStreamingRequest(); } LeAudioDeviceGroup* group = aseGroups_.FindById(active_group_id_); if (!group) { LOG(ERROR) << __func__ << ", Failed to update pending available " Loading @@ -3108,7 +3126,6 @@ class LeAudioClientImpl : public LeAudioClient { group->SetPendingUpdateAvailableContexts(std::nullopt); } break; } case GroupStreamStatus::RELEASING: Loading
system/bta/le_audio/client_audio.cc +22 −0 Original line number Diff line number Diff line Loading @@ -401,6 +401,17 @@ void LeAudioClientAudioSource::ConfirmStreamingRequest() { start_audio_ticks(); } void LeAudioClientAudioSource::SuspendedForReconfiguration() { LOG(INFO) << __func__; if ((sinkClientInterface == nullptr) || (le_audio_sink_hal_state != HAL_STARTED)) { LOG(ERROR) << "LE audio device HAL was not started!"; return; } sinkClientInterface->SuspendedForReconfiguration(); } void LeAudioClientAudioSource::CancelStreamingRequest() { LOG(INFO) << __func__; if ((sinkClientInterface == nullptr) || Loading Loading @@ -628,3 +639,14 @@ void LeAudioClientAudioSink::UpdateAudioConfigToHal( sourceClientInterface->UpdateAudioConfigToHal(config); } void LeAudioClientAudioSink::SuspendedForReconfiguration() { LOG(INFO) << __func__; if ((sourceClientInterface == nullptr) || (le_audio_source_hal_state != HAL_STARTED)) { LOG(ERROR) << "LE audio device HAL was not started!"; return; } sourceClientInterface->SuspendedForReconfiguration(); }