Loading system/audio_bluetooth_hw/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ cc_library_shared { ], header_libs: ["libhardware_headers"], shared_libs: [ "android.hardware.audio.common-V2-ndk", "android.hardware.bluetooth.audio-V3-ndk", "libaudioutils", "libbase", Loading system/audio_bluetooth_hw/audio_bluetooth_hw.cc +4 −4 Original line number Diff line number Diff line Loading @@ -145,8 +145,8 @@ static int adev_release_audio_patch(struct audio_hw_device* device, return 0; } static int adev_get_audio_port(struct audio_hw_device* device, struct audio_port* port) { static int adev_get_audio_port_v7(struct audio_hw_device* device, struct audio_port_v7* port) { if (device == nullptr || port == nullptr) { return -EINVAL; } Loading @@ -171,7 +171,7 @@ static int adev_open(const hw_module_t* module, const char* name, if (!adev) return -ENOMEM; adev->common.tag = HARDWARE_DEVICE_TAG; adev->common.version = AUDIO_DEVICE_API_VERSION_3_0; adev->common.version = AUDIO_DEVICE_API_VERSION_3_2; adev->common.module = (struct hw_module_t*)module; adev->common.close = adev_close; Loading @@ -194,7 +194,7 @@ static int adev_open(const hw_module_t* module, const char* name, adev->get_master_mute = adev_get_master_mute; adev->create_audio_patch = adev_create_audio_patch; adev->release_audio_patch = adev_release_audio_patch; adev->get_audio_port = adev_get_audio_port; adev->get_audio_port_v7 = adev_get_audio_port_v7; *device = &adev->common; return 0; Loading system/audio_bluetooth_hw/device_port_proxy.cc +34 −6 Original line number Diff line number Diff line Loading @@ -34,12 +34,17 @@ namespace bluetooth { namespace audio { namespace aidl { using ::aidl::android::hardware::audio::common::SinkMetadata; using ::aidl::android::hardware::audio::common::SourceMetadata; using ::aidl::android::hardware::bluetooth::audio::AudioConfiguration; using ::aidl::android::hardware::bluetooth::audio::BluetoothAudioSessionControl; using ::aidl::android::hardware::bluetooth::audio::ChannelMode; using ::aidl::android::hardware::bluetooth::audio::PcmConfiguration; using ::aidl::android::hardware::bluetooth::audio::PortStatusCallbacks; using ::aidl::android::hardware::bluetooth::audio::PresentationPosition; using ::aidl::android::media::audio::common::AudioContentType; using ::aidl::android::media::audio::common::AudioSource; using ::aidl::android::media::audio::common::AudioUsage; using ::android::base::StringPrintf; using ControlResultCallback = std::function<void( Loading Loading @@ -577,7 +582,7 @@ bool BluetoothAudioPortAidl::GetPresentationPosition( } void BluetoothAudioPortAidl::UpdateSourceMetadata( const source_metadata* source_metadata) const { const source_metadata_v7* source_metadata) const { if (!in_use()) { LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use"; return; Loading @@ -586,13 +591,25 @@ void BluetoothAudioPortAidl::UpdateSourceMetadata( << ", cookie=" << StringPrintf("%#hx", cookie_) << ", state=" << state_ << ", " << source_metadata->track_count << " track(s)"; if (source_metadata->track_count == 0) return; ssize_t track_count = source_metadata->track_count; if (track_count == 0) return; SourceMetadata hal_source_metadata; hal_source_metadata.tracks.resize(track_count); for (int i = 0; i < track_count; i++) { hal_source_metadata.tracks[i].usage = static_cast<AudioUsage>(source_metadata->tracks[i].base.usage); hal_source_metadata.tracks[i].contentType = static_cast<AudioContentType>( source_metadata->tracks[i].base.content_type); hal_source_metadata.tracks[i].tags.push_back( std::string(source_metadata->tracks[i].tags)); } BluetoothAudioSessionControl::UpdateSourceMetadata(session_type_, *source_metadata); hal_source_metadata); } void BluetoothAudioPortAidl::UpdateSinkMetadata( const sink_metadata* sink_metadata) const { const sink_metadata_v7* sink_metadata) const { if (!in_use()) { LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use"; return; Loading @@ -601,9 +618,20 @@ void BluetoothAudioPortAidl::UpdateSinkMetadata( << ", cookie=" << StringPrintf("%#hx", cookie_) << ", state=" << state_ << ", " << sink_metadata->track_count << " track(s)"; if (sink_metadata->track_count == 0) return; ssize_t track_count = sink_metadata->track_count; if (track_count == 0) return; SinkMetadata hal_sink_metadata; hal_sink_metadata.tracks.resize(track_count); for (int i = 0; i < track_count; i++) { hal_sink_metadata.tracks[i].source = static_cast<AudioSource>(sink_metadata->tracks[i].base.source); hal_sink_metadata.tracks[i].gain = sink_metadata->tracks[i].base.gain; hal_sink_metadata.tracks[i].tags.push_back( std::string(sink_metadata->tracks[i].tags)); } BluetoothAudioSessionControl::UpdateSinkMetadata(session_type_, *sink_metadata); hal_sink_metadata); } BluetoothStreamState BluetoothAudioPortAidl::GetState() const { return state_; } Loading system/audio_bluetooth_hw/device_port_proxy.h +4 −9 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ #pragma once #include <aidl/android/hardware/audio/common/SinkMetadata.h> #include <aidl/android/hardware/audio/common/SourceMetadata.h> #include <aidl/android/hardware/bluetooth/audio/BluetoothAudioStatus.h> #include <aidl/android/hardware/bluetooth/audio/SessionType.h> #include <hardware/audio.h> Loading Loading @@ -93,12 +95,6 @@ class BluetoothAudioPort { return false; } /*** * Called by the Audio framework / HAL when the metadata of the stream's * source has been changed. ***/ virtual void UpdateSourceMetadata(const source_metadata*) const {}; /*** * Return the current BluetoothStreamState ***/ Loading Loading @@ -148,14 +144,13 @@ class BluetoothAudioPortAidl : public BluetoothAudioPort { bool GetPresentationPosition(uint64_t* delay_ns, uint64_t* byte, timespec* timestamp) const override; void UpdateSourceMetadata( const source_metadata* source_metadata) const override; void UpdateSourceMetadata(const source_metadata_v7* source_metadata) const; /*** * Called by the Audio framework / HAL when the metadata of the stream's * sink has been changed. ***/ virtual void UpdateSinkMetadata(const sink_metadata* sink_metadata) const; virtual void UpdateSinkMetadata(const sink_metadata_v7* sink_metadata) const; BluetoothStreamState GetState() const override; Loading system/audio_bluetooth_hw/device_port_proxy_hidl.cc +1 −1 Original line number Diff line number Diff line Loading @@ -486,7 +486,7 @@ bool BluetoothAudioPortHidl::GetPresentationPosition( return retval; } void BluetoothAudioPortHidl::UpdateSourceMetadata( void BluetoothAudioPortHidl::UpdateTracksMetadata( const source_metadata* source_metadata) const { if (!in_use()) { LOG(ERROR) << __func__ << ": BluetoothAudioPort is not in use"; Loading Loading
system/audio_bluetooth_hw/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ cc_library_shared { ], header_libs: ["libhardware_headers"], shared_libs: [ "android.hardware.audio.common-V2-ndk", "android.hardware.bluetooth.audio-V3-ndk", "libaudioutils", "libbase", Loading
system/audio_bluetooth_hw/audio_bluetooth_hw.cc +4 −4 Original line number Diff line number Diff line Loading @@ -145,8 +145,8 @@ static int adev_release_audio_patch(struct audio_hw_device* device, return 0; } static int adev_get_audio_port(struct audio_hw_device* device, struct audio_port* port) { static int adev_get_audio_port_v7(struct audio_hw_device* device, struct audio_port_v7* port) { if (device == nullptr || port == nullptr) { return -EINVAL; } Loading @@ -171,7 +171,7 @@ static int adev_open(const hw_module_t* module, const char* name, if (!adev) return -ENOMEM; adev->common.tag = HARDWARE_DEVICE_TAG; adev->common.version = AUDIO_DEVICE_API_VERSION_3_0; adev->common.version = AUDIO_DEVICE_API_VERSION_3_2; adev->common.module = (struct hw_module_t*)module; adev->common.close = adev_close; Loading @@ -194,7 +194,7 @@ static int adev_open(const hw_module_t* module, const char* name, adev->get_master_mute = adev_get_master_mute; adev->create_audio_patch = adev_create_audio_patch; adev->release_audio_patch = adev_release_audio_patch; adev->get_audio_port = adev_get_audio_port; adev->get_audio_port_v7 = adev_get_audio_port_v7; *device = &adev->common; return 0; Loading
system/audio_bluetooth_hw/device_port_proxy.cc +34 −6 Original line number Diff line number Diff line Loading @@ -34,12 +34,17 @@ namespace bluetooth { namespace audio { namespace aidl { using ::aidl::android::hardware::audio::common::SinkMetadata; using ::aidl::android::hardware::audio::common::SourceMetadata; using ::aidl::android::hardware::bluetooth::audio::AudioConfiguration; using ::aidl::android::hardware::bluetooth::audio::BluetoothAudioSessionControl; using ::aidl::android::hardware::bluetooth::audio::ChannelMode; using ::aidl::android::hardware::bluetooth::audio::PcmConfiguration; using ::aidl::android::hardware::bluetooth::audio::PortStatusCallbacks; using ::aidl::android::hardware::bluetooth::audio::PresentationPosition; using ::aidl::android::media::audio::common::AudioContentType; using ::aidl::android::media::audio::common::AudioSource; using ::aidl::android::media::audio::common::AudioUsage; using ::android::base::StringPrintf; using ControlResultCallback = std::function<void( Loading Loading @@ -577,7 +582,7 @@ bool BluetoothAudioPortAidl::GetPresentationPosition( } void BluetoothAudioPortAidl::UpdateSourceMetadata( const source_metadata* source_metadata) const { const source_metadata_v7* source_metadata) const { if (!in_use()) { LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use"; return; Loading @@ -586,13 +591,25 @@ void BluetoothAudioPortAidl::UpdateSourceMetadata( << ", cookie=" << StringPrintf("%#hx", cookie_) << ", state=" << state_ << ", " << source_metadata->track_count << " track(s)"; if (source_metadata->track_count == 0) return; ssize_t track_count = source_metadata->track_count; if (track_count == 0) return; SourceMetadata hal_source_metadata; hal_source_metadata.tracks.resize(track_count); for (int i = 0; i < track_count; i++) { hal_source_metadata.tracks[i].usage = static_cast<AudioUsage>(source_metadata->tracks[i].base.usage); hal_source_metadata.tracks[i].contentType = static_cast<AudioContentType>( source_metadata->tracks[i].base.content_type); hal_source_metadata.tracks[i].tags.push_back( std::string(source_metadata->tracks[i].tags)); } BluetoothAudioSessionControl::UpdateSourceMetadata(session_type_, *source_metadata); hal_source_metadata); } void BluetoothAudioPortAidl::UpdateSinkMetadata( const sink_metadata* sink_metadata) const { const sink_metadata_v7* sink_metadata) const { if (!in_use()) { LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use"; return; Loading @@ -601,9 +618,20 @@ void BluetoothAudioPortAidl::UpdateSinkMetadata( << ", cookie=" << StringPrintf("%#hx", cookie_) << ", state=" << state_ << ", " << sink_metadata->track_count << " track(s)"; if (sink_metadata->track_count == 0) return; ssize_t track_count = sink_metadata->track_count; if (track_count == 0) return; SinkMetadata hal_sink_metadata; hal_sink_metadata.tracks.resize(track_count); for (int i = 0; i < track_count; i++) { hal_sink_metadata.tracks[i].source = static_cast<AudioSource>(sink_metadata->tracks[i].base.source); hal_sink_metadata.tracks[i].gain = sink_metadata->tracks[i].base.gain; hal_sink_metadata.tracks[i].tags.push_back( std::string(sink_metadata->tracks[i].tags)); } BluetoothAudioSessionControl::UpdateSinkMetadata(session_type_, *sink_metadata); hal_sink_metadata); } BluetoothStreamState BluetoothAudioPortAidl::GetState() const { return state_; } Loading
system/audio_bluetooth_hw/device_port_proxy.h +4 −9 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ #pragma once #include <aidl/android/hardware/audio/common/SinkMetadata.h> #include <aidl/android/hardware/audio/common/SourceMetadata.h> #include <aidl/android/hardware/bluetooth/audio/BluetoothAudioStatus.h> #include <aidl/android/hardware/bluetooth/audio/SessionType.h> #include <hardware/audio.h> Loading Loading @@ -93,12 +95,6 @@ class BluetoothAudioPort { return false; } /*** * Called by the Audio framework / HAL when the metadata of the stream's * source has been changed. ***/ virtual void UpdateSourceMetadata(const source_metadata*) const {}; /*** * Return the current BluetoothStreamState ***/ Loading Loading @@ -148,14 +144,13 @@ class BluetoothAudioPortAidl : public BluetoothAudioPort { bool GetPresentationPosition(uint64_t* delay_ns, uint64_t* byte, timespec* timestamp) const override; void UpdateSourceMetadata( const source_metadata* source_metadata) const override; void UpdateSourceMetadata(const source_metadata_v7* source_metadata) const; /*** * Called by the Audio framework / HAL when the metadata of the stream's * sink has been changed. ***/ virtual void UpdateSinkMetadata(const sink_metadata* sink_metadata) const; virtual void UpdateSinkMetadata(const sink_metadata_v7* sink_metadata) const; BluetoothStreamState GetState() const override; Loading
system/audio_bluetooth_hw/device_port_proxy_hidl.cc +1 −1 Original line number Diff line number Diff line Loading @@ -486,7 +486,7 @@ bool BluetoothAudioPortHidl::GetPresentationPosition( return retval; } void BluetoothAudioPortHidl::UpdateSourceMetadata( void BluetoothAudioPortHidl::UpdateTracksMetadata( const source_metadata* source_metadata) const { if (!in_use()) { LOG(ERROR) << __func__ << ": BluetoothAudioPort is not in use"; Loading