Loading media/audioaidlconversion/AidlConversionNdk.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ namespace android { using hardware::audio::common::PlaybackTrackMetadata; using hardware::audio::common::RecordTrackMetadata; using hardware::audio::common::SourceMetadata; using ::android::BAD_VALUE; using ::android::OK; Loading Loading @@ -194,5 +195,16 @@ legacy2aidl_record_track_metadata_v7_RecordTrackMetadata(const record_track_meta return aidl; } // static ConversionResult<SourceMetadata> legacy2aidl_SourceMetadata(const std::vector<playback_track_metadata_v7_t>& legacy) { SourceMetadata aidl; aidl.tracks = VALUE_OR_RETURN( convertContainer<std::vector<PlaybackTrackMetadata>>( legacy, legacy2aidl_playback_track_metadata_v7_PlaybackTrackMetadata)); return aidl; } } // namespace android } // aidl media/audioaidlconversion/include/media/AidlConversionNdk.h +4 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #include <aidl/android/hardware/audio/common/PlaybackTrackMetadata.h> #include <aidl/android/hardware/audio/common/RecordTrackMetadata.h> #include <aidl/android/hardware/audio/common/SourceMetadata.h> #include <aidl/android/media/audio/common/AudioConfig.h> #include <media/AidlConversionUtil.h> Loading Loading @@ -56,5 +57,8 @@ aidl2legacy_RecordTrackMetadata_record_track_metadata_v7( ConversionResult<hardware::audio::common::RecordTrackMetadata> legacy2aidl_record_track_metadata_v7_RecordTrackMetadata(const record_track_metadata_v7& legacy); ConversionResult<hardware::audio::common::SourceMetadata> legacy2aidl_SourceMetadata(const std::vector<playback_track_metadata_v7_t>& legacy); } // namespace android } // namespace aidl media/libaudiohal/impl/DeviceHalAidl.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <aidl/android/hardware/audio/core/StreamDescriptor.h> #include <error/expected_utils.h> #include <media/AidlConversionCppNdk.h> #include <media/AidlConversionNdk.h> #include <media/AidlConversionNdkCpp.h> #include <media/AidlConversionUtil.h> #include <mediautils/TimeCheck.h> Loading Loading @@ -60,6 +61,8 @@ using aidl::android::hardware::audio::common::getFrameSizeInBytes; using aidl::android::hardware::audio::common::isBitPositionFlagSet; using aidl::android::hardware::audio::common::kDumpFromAudioServerArgument; using aidl::android::hardware::audio::common::RecordTrackMetadata; using aidl::android::hardware::audio::common::PlaybackTrackMetadata; using aidl::android::hardware::audio::common::SourceMetadata; using aidl::android::hardware::audio::core::sounddose::ISoundDose; using aidl::android::hardware::audio::core::AudioPatch; using aidl::android::hardware::audio::core::AudioRoute; Loading Loading @@ -427,7 +430,8 @@ status_t DeviceHalAidl::openOutputStream( audio_io_handle_t handle, audio_devices_t devices, audio_output_flags_t flags, struct audio_config* config, const char* address, sp<StreamOutHalInterface>* outStream) { sp<StreamOutHalInterface>* outStream, const std::vector<playback_track_metadata_v7_t>& sourceMetadata) { ALOGD("%p %s::%s", this, getClassName().c_str(), __func__); TIME_CHECK(); if (mModule == nullptr) return NO_INIT; Loading @@ -443,9 +447,12 @@ status_t DeviceHalAidl::openOutputStream( ::aidl::android::legacy2aidl_audio_device_AudioDevice(devices, address)); int32_t aidlOutputFlags = VALUE_OR_RETURN_STATUS( ::aidl::android::legacy2aidl_audio_output_flags_t_int32_t_mask(flags)); SourceMetadata aidlMetadata = VALUE_OR_RETURN_STATUS( ::aidl::android::legacy2aidl_SourceMetadata(sourceMetadata)); AudioIoFlags aidlFlags = AudioIoFlags::make<AudioIoFlags::Tag::output>(aidlOutputFlags); AudioPortConfig mixPortConfig; AudioPatch aidlPatch; Hal2AidlMapper::Cleanups cleanups(mMapperAccessor); { std::lock_guard l(mLock); Loading Loading @@ -475,6 +482,7 @@ status_t DeviceHalAidl::openOutputStream( } args.bufferSizeFrames = aidlConfig.frameCount; args.eventCallback = eventCb; args.sourceMetadata = aidlMetadata; ::aidl::android::hardware::audio::core::IModule::OpenOutputStreamReturn ret; RETURN_STATUS_IF_ERROR(statusTFromBinderStatus(mModule->openOutputStream(args, &ret))); StreamContextAidl context(ret.desc, isOffload); Loading media/libaudiohal/impl/DeviceHalAidl.h +3 −1 Original line number Diff line number Diff line Loading @@ -119,7 +119,9 @@ class DeviceHalAidl : public DeviceHalInterface, public ConversionHelperAidl, // by releasing all references to the returned object. status_t openOutputStream(audio_io_handle_t handle, audio_devices_t devices, audio_output_flags_t flags, struct audio_config* config, const char* address, sp<StreamOutHalInterface>* outStream) override; const char* address, sp<StreamOutHalInterface>* outStream, const std::vector<playback_track_metadata_v7_t>& sourceMetadata = {}) override; // Creates and opens the audio hardware input stream. The stream is closed // by releasing all references to the returned object. Loading media/libaudiohal/impl/DeviceHalHidl.cpp +15 −2 Original line number Diff line number Diff line Loading @@ -259,7 +259,8 @@ status_t DeviceHalHidl::openOutputStream( audio_output_flags_t flags, struct audio_config *config, const char *address, sp<StreamOutHalInterface> *outStream) { sp<StreamOutHalInterface> *outStream, const std::vector<playback_track_metadata_v7_t>& sourceMetadata) { TIME_CHECK(); if (mDevice == 0) return NO_INIT; DeviceAddress hidlDevice; Loading @@ -273,6 +274,18 @@ status_t DeviceHalHidl::openOutputStream( return status; } #if MAJOR_VERSION == 4 ::android::hardware::audio::CORE_TYPES_CPP_VERSION::SourceMetadata hidlMetadata; #else ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::SourceMetadata hidlMetadata; #endif if (status_t status = CoreUtils::sourceMetadataFromHalV7( sourceMetadata, true /*ignoreNonVendorTags*/, &hidlMetadata); status != OK) { return status; } #if !(MAJOR_VERSION == 7 && MINOR_VERSION == 1) //TODO: b/193496180 use spatializer flag at audio HAL when available if ((flags & AUDIO_OUTPUT_FLAG_SPATIALIZER) != 0) { Loading @@ -294,7 +307,7 @@ status_t DeviceHalHidl::openOutputStream( #endif handle, hidlDevice, hidlConfig, hidlFlags, #if MAJOR_VERSION >= 4 {} /* metadata */, hidlMetadata /* metadata */, #endif [&](Result r, const sp<::android::hardware::audio::CPP_VERSION::IStreamOut>& result, const AudioConfig& suggestedConfig) { Loading Loading
media/audioaidlconversion/AidlConversionNdk.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ namespace android { using hardware::audio::common::PlaybackTrackMetadata; using hardware::audio::common::RecordTrackMetadata; using hardware::audio::common::SourceMetadata; using ::android::BAD_VALUE; using ::android::OK; Loading Loading @@ -194,5 +195,16 @@ legacy2aidl_record_track_metadata_v7_RecordTrackMetadata(const record_track_meta return aidl; } // static ConversionResult<SourceMetadata> legacy2aidl_SourceMetadata(const std::vector<playback_track_metadata_v7_t>& legacy) { SourceMetadata aidl; aidl.tracks = VALUE_OR_RETURN( convertContainer<std::vector<PlaybackTrackMetadata>>( legacy, legacy2aidl_playback_track_metadata_v7_PlaybackTrackMetadata)); return aidl; } } // namespace android } // aidl
media/audioaidlconversion/include/media/AidlConversionNdk.h +4 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #include <aidl/android/hardware/audio/common/PlaybackTrackMetadata.h> #include <aidl/android/hardware/audio/common/RecordTrackMetadata.h> #include <aidl/android/hardware/audio/common/SourceMetadata.h> #include <aidl/android/media/audio/common/AudioConfig.h> #include <media/AidlConversionUtil.h> Loading Loading @@ -56,5 +57,8 @@ aidl2legacy_RecordTrackMetadata_record_track_metadata_v7( ConversionResult<hardware::audio::common::RecordTrackMetadata> legacy2aidl_record_track_metadata_v7_RecordTrackMetadata(const record_track_metadata_v7& legacy); ConversionResult<hardware::audio::common::SourceMetadata> legacy2aidl_SourceMetadata(const std::vector<playback_track_metadata_v7_t>& legacy); } // namespace android } // namespace aidl
media/libaudiohal/impl/DeviceHalAidl.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <aidl/android/hardware/audio/core/StreamDescriptor.h> #include <error/expected_utils.h> #include <media/AidlConversionCppNdk.h> #include <media/AidlConversionNdk.h> #include <media/AidlConversionNdkCpp.h> #include <media/AidlConversionUtil.h> #include <mediautils/TimeCheck.h> Loading Loading @@ -60,6 +61,8 @@ using aidl::android::hardware::audio::common::getFrameSizeInBytes; using aidl::android::hardware::audio::common::isBitPositionFlagSet; using aidl::android::hardware::audio::common::kDumpFromAudioServerArgument; using aidl::android::hardware::audio::common::RecordTrackMetadata; using aidl::android::hardware::audio::common::PlaybackTrackMetadata; using aidl::android::hardware::audio::common::SourceMetadata; using aidl::android::hardware::audio::core::sounddose::ISoundDose; using aidl::android::hardware::audio::core::AudioPatch; using aidl::android::hardware::audio::core::AudioRoute; Loading Loading @@ -427,7 +430,8 @@ status_t DeviceHalAidl::openOutputStream( audio_io_handle_t handle, audio_devices_t devices, audio_output_flags_t flags, struct audio_config* config, const char* address, sp<StreamOutHalInterface>* outStream) { sp<StreamOutHalInterface>* outStream, const std::vector<playback_track_metadata_v7_t>& sourceMetadata) { ALOGD("%p %s::%s", this, getClassName().c_str(), __func__); TIME_CHECK(); if (mModule == nullptr) return NO_INIT; Loading @@ -443,9 +447,12 @@ status_t DeviceHalAidl::openOutputStream( ::aidl::android::legacy2aidl_audio_device_AudioDevice(devices, address)); int32_t aidlOutputFlags = VALUE_OR_RETURN_STATUS( ::aidl::android::legacy2aidl_audio_output_flags_t_int32_t_mask(flags)); SourceMetadata aidlMetadata = VALUE_OR_RETURN_STATUS( ::aidl::android::legacy2aidl_SourceMetadata(sourceMetadata)); AudioIoFlags aidlFlags = AudioIoFlags::make<AudioIoFlags::Tag::output>(aidlOutputFlags); AudioPortConfig mixPortConfig; AudioPatch aidlPatch; Hal2AidlMapper::Cleanups cleanups(mMapperAccessor); { std::lock_guard l(mLock); Loading Loading @@ -475,6 +482,7 @@ status_t DeviceHalAidl::openOutputStream( } args.bufferSizeFrames = aidlConfig.frameCount; args.eventCallback = eventCb; args.sourceMetadata = aidlMetadata; ::aidl::android::hardware::audio::core::IModule::OpenOutputStreamReturn ret; RETURN_STATUS_IF_ERROR(statusTFromBinderStatus(mModule->openOutputStream(args, &ret))); StreamContextAidl context(ret.desc, isOffload); Loading
media/libaudiohal/impl/DeviceHalAidl.h +3 −1 Original line number Diff line number Diff line Loading @@ -119,7 +119,9 @@ class DeviceHalAidl : public DeviceHalInterface, public ConversionHelperAidl, // by releasing all references to the returned object. status_t openOutputStream(audio_io_handle_t handle, audio_devices_t devices, audio_output_flags_t flags, struct audio_config* config, const char* address, sp<StreamOutHalInterface>* outStream) override; const char* address, sp<StreamOutHalInterface>* outStream, const std::vector<playback_track_metadata_v7_t>& sourceMetadata = {}) override; // Creates and opens the audio hardware input stream. The stream is closed // by releasing all references to the returned object. Loading
media/libaudiohal/impl/DeviceHalHidl.cpp +15 −2 Original line number Diff line number Diff line Loading @@ -259,7 +259,8 @@ status_t DeviceHalHidl::openOutputStream( audio_output_flags_t flags, struct audio_config *config, const char *address, sp<StreamOutHalInterface> *outStream) { sp<StreamOutHalInterface> *outStream, const std::vector<playback_track_metadata_v7_t>& sourceMetadata) { TIME_CHECK(); if (mDevice == 0) return NO_INIT; DeviceAddress hidlDevice; Loading @@ -273,6 +274,18 @@ status_t DeviceHalHidl::openOutputStream( return status; } #if MAJOR_VERSION == 4 ::android::hardware::audio::CORE_TYPES_CPP_VERSION::SourceMetadata hidlMetadata; #else ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::SourceMetadata hidlMetadata; #endif if (status_t status = CoreUtils::sourceMetadataFromHalV7( sourceMetadata, true /*ignoreNonVendorTags*/, &hidlMetadata); status != OK) { return status; } #if !(MAJOR_VERSION == 7 && MINOR_VERSION == 1) //TODO: b/193496180 use spatializer flag at audio HAL when available if ((flags & AUDIO_OUTPUT_FLAG_SPATIALIZER) != 0) { Loading @@ -294,7 +307,7 @@ status_t DeviceHalHidl::openOutputStream( #endif handle, hidlDevice, hidlConfig, hidlFlags, #if MAJOR_VERSION >= 4 {} /* metadata */, hidlMetadata /* metadata */, #endif [&](Result r, const sp<::android::hardware::audio::CPP_VERSION::IStreamOut>& result, const AudioConfig& suggestedConfig) { Loading