Loading bluetooth/audio/2.2/IBluetoothAudioProvider.hal +10 −0 Original line number Diff line number Diff line Loading @@ -59,4 +59,14 @@ interface IBluetoothAudioProvider extends @2.1::IBluetoothAudioProvider { */ startSession_2_2(IBluetoothAudioPort hostIf, AudioConfiguration audioConfig) generates (Status status, fmq_sync<uint8_t> dataMQ); /** * Called when the audio configuration of the stream has been changed. * * @param audioConfig The audio configuration negotiated with the remote * device. The PCM parameters are set if software based encoding, * otherwise the correct codec configuration is used for hardware * encoding. */ updateAudioConfiguration(AudioConfiguration audioConfig); }; bluetooth/audio/2.2/default/BluetoothAudioProvider.cpp +23 −0 Original line number Diff line number Diff line Loading @@ -186,6 +186,29 @@ Return<void> BluetoothAudioProvider::endSession() { return Void(); } Return<void> BluetoothAudioProvider::updateAudioConfiguration( const AudioConfiguration& audioConfig) { LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_); if (stack_iface_ == nullptr) { LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_) << " has NO session"; return Void(); } if (audioConfig.getDiscriminator() != audio_config_.getDiscriminator()) { LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_) << " audio config type is not match"; return Void(); } audio_config_ = audioConfig; BluetoothAudioSessionReport_2_2::ReportAudioConfigChanged(session_type_, audio_config_); return Void(); } } // namespace implementation } // namespace V2_2 } // namespace audio Loading bluetooth/audio/2.2/default/BluetoothAudioProvider.h +2 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,8 @@ class BluetoothAudioProvider : public IBluetoothAudioProvider { Return<void> streamStarted(BluetoothAudioStatus status) override; Return<void> streamSuspended(BluetoothAudioStatus status) override; Return<void> endSession() override; Return<void> updateAudioConfiguration( const AudioConfiguration& audioConfig) override; protected: sp<BluetoothAudioDeathRecipient> death_recipient_; Loading bluetooth/audio/utils/session/BluetoothAudioSessionControl_2_2.h +21 −3 Original line number Diff line number Diff line Loading @@ -48,20 +48,38 @@ class BluetoothAudioSessionControl_2_2 { std::shared_ptr<BluetoothAudioSession_2_2> session_ptr = BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type); if (session_ptr != nullptr) { return session_ptr->GetAudioSession()->RegisterStatusCback(cbacks); PortStatusCallbacks_2_2 cb = { .control_result_cb_ = cbacks.control_result_cb_, .session_changed_cb_ = cbacks.session_changed_cb_, .audio_configuration_changed_cb_ = nullptr}; return session_ptr->RegisterStatusCback(cb); } return kObserversCookieUndefined; } // The control API helps the bluetooth_audio module to register // PortStatusCallbacks_2_2 // @return: cookie - the assigned number to this bluetooth_audio output static uint16_t RegisterControlResultCback( const SessionType_2_1& session_type, const PortStatusCallbacks_2_2& cbacks) { std::shared_ptr<BluetoothAudioSession_2_2> session_ptr = BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type); if (session_ptr != nullptr) { return session_ptr->RegisterStatusCback(cbacks); } return kObserversCookieUndefined; } // The control API helps the bluetooth_audio module to unregister // PortStatusCallbacks // PortStatusCallbacks and PortStatusCallbacks_2_2 // @param: cookie - indicates which bluetooth_audio output is static void UnregisterControlResultCback(const SessionType_2_1& session_type, uint16_t cookie) { std::shared_ptr<BluetoothAudioSession_2_2> session_ptr = BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type); if (session_ptr != nullptr) { session_ptr->GetAudioSession()->UnregisterStatusCback(cookie); session_ptr->UnregisterStatusCback(cookie); } } Loading bluetooth/audio/utils/session/BluetoothAudioSessionReport_2_2.h +14 −1 Original line number Diff line number Diff line Loading @@ -60,7 +60,20 @@ class BluetoothAudioSessionReport_2_2 { std::shared_ptr<BluetoothAudioSession_2_2> session_ptr = BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type); if (session_ptr != nullptr) { session_ptr->GetAudioSession()->ReportControlStatus(start_resp, status); session_ptr->ReportControlStatus(start_resp, status); } } // The API reports the Bluetooth stack has replied the changed of the audio // configuration, and will inform registered bluetooth_audio outputs static void ReportAudioConfigChanged( const ::android::hardware::bluetooth::audio::V2_1::SessionType& session_type, const ::android::hardware::bluetooth::audio::V2_2::AudioConfiguration& audio_config) { std::shared_ptr<BluetoothAudioSession_2_2> session_ptr = BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type); if (session_ptr != nullptr) { session_ptr->ReportAudioConfigChanged(audio_config); } } }; Loading Loading
bluetooth/audio/2.2/IBluetoothAudioProvider.hal +10 −0 Original line number Diff line number Diff line Loading @@ -59,4 +59,14 @@ interface IBluetoothAudioProvider extends @2.1::IBluetoothAudioProvider { */ startSession_2_2(IBluetoothAudioPort hostIf, AudioConfiguration audioConfig) generates (Status status, fmq_sync<uint8_t> dataMQ); /** * Called when the audio configuration of the stream has been changed. * * @param audioConfig The audio configuration negotiated with the remote * device. The PCM parameters are set if software based encoding, * otherwise the correct codec configuration is used for hardware * encoding. */ updateAudioConfiguration(AudioConfiguration audioConfig); };
bluetooth/audio/2.2/default/BluetoothAudioProvider.cpp +23 −0 Original line number Diff line number Diff line Loading @@ -186,6 +186,29 @@ Return<void> BluetoothAudioProvider::endSession() { return Void(); } Return<void> BluetoothAudioProvider::updateAudioConfiguration( const AudioConfiguration& audioConfig) { LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_); if (stack_iface_ == nullptr) { LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_) << " has NO session"; return Void(); } if (audioConfig.getDiscriminator() != audio_config_.getDiscriminator()) { LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_) << " audio config type is not match"; return Void(); } audio_config_ = audioConfig; BluetoothAudioSessionReport_2_2::ReportAudioConfigChanged(session_type_, audio_config_); return Void(); } } // namespace implementation } // namespace V2_2 } // namespace audio Loading
bluetooth/audio/2.2/default/BluetoothAudioProvider.h +2 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,8 @@ class BluetoothAudioProvider : public IBluetoothAudioProvider { Return<void> streamStarted(BluetoothAudioStatus status) override; Return<void> streamSuspended(BluetoothAudioStatus status) override; Return<void> endSession() override; Return<void> updateAudioConfiguration( const AudioConfiguration& audioConfig) override; protected: sp<BluetoothAudioDeathRecipient> death_recipient_; Loading
bluetooth/audio/utils/session/BluetoothAudioSessionControl_2_2.h +21 −3 Original line number Diff line number Diff line Loading @@ -48,20 +48,38 @@ class BluetoothAudioSessionControl_2_2 { std::shared_ptr<BluetoothAudioSession_2_2> session_ptr = BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type); if (session_ptr != nullptr) { return session_ptr->GetAudioSession()->RegisterStatusCback(cbacks); PortStatusCallbacks_2_2 cb = { .control_result_cb_ = cbacks.control_result_cb_, .session_changed_cb_ = cbacks.session_changed_cb_, .audio_configuration_changed_cb_ = nullptr}; return session_ptr->RegisterStatusCback(cb); } return kObserversCookieUndefined; } // The control API helps the bluetooth_audio module to register // PortStatusCallbacks_2_2 // @return: cookie - the assigned number to this bluetooth_audio output static uint16_t RegisterControlResultCback( const SessionType_2_1& session_type, const PortStatusCallbacks_2_2& cbacks) { std::shared_ptr<BluetoothAudioSession_2_2> session_ptr = BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type); if (session_ptr != nullptr) { return session_ptr->RegisterStatusCback(cbacks); } return kObserversCookieUndefined; } // The control API helps the bluetooth_audio module to unregister // PortStatusCallbacks // PortStatusCallbacks and PortStatusCallbacks_2_2 // @param: cookie - indicates which bluetooth_audio output is static void UnregisterControlResultCback(const SessionType_2_1& session_type, uint16_t cookie) { std::shared_ptr<BluetoothAudioSession_2_2> session_ptr = BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type); if (session_ptr != nullptr) { session_ptr->GetAudioSession()->UnregisterStatusCback(cookie); session_ptr->UnregisterStatusCback(cookie); } } Loading
bluetooth/audio/utils/session/BluetoothAudioSessionReport_2_2.h +14 −1 Original line number Diff line number Diff line Loading @@ -60,7 +60,20 @@ class BluetoothAudioSessionReport_2_2 { std::shared_ptr<BluetoothAudioSession_2_2> session_ptr = BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type); if (session_ptr != nullptr) { session_ptr->GetAudioSession()->ReportControlStatus(start_resp, status); session_ptr->ReportControlStatus(start_resp, status); } } // The API reports the Bluetooth stack has replied the changed of the audio // configuration, and will inform registered bluetooth_audio outputs static void ReportAudioConfigChanged( const ::android::hardware::bluetooth::audio::V2_1::SessionType& session_type, const ::android::hardware::bluetooth::audio::V2_2::AudioConfiguration& audio_config) { std::shared_ptr<BluetoothAudioSession_2_2> session_ptr = BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type); if (session_ptr != nullptr) { session_ptr->ReportAudioConfigChanged(audio_config); } } }; Loading