Loading media/libaaudio/fuzzer/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ cc_fuzz { "libaaudio", "libaaudio_internal", "libaudioclient", "libaudiofoundation", "libaudioutils", "libbase_ndk", "libcutils", Loading media/libaaudio/include/aaudio/AAudio.h +23 −1 Original line number Diff line number Diff line Loading @@ -1909,10 +1909,32 @@ AAUDIO_API int32_t AAudioStream_getSamplesPerFrame(AAudioStream* _Nonnull stream * Available since API level 26. * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return actual device ID * @return actual device id. If there are multiple device ids used, the first device picked by * the audio policy engine will be returned. */ AAUDIO_API int32_t AAudioStream_getDeviceId(AAudioStream* _Nonnull stream) __INTRODUCED_IN(26); /** * Available since API level 36. * * Call this function after AAudioStreamBuilder_openStream(). * This function will crash if stream is null. * An array of size 16 should generally be large enough to fit all device identifiers. * * @param stream reference provided by AAudioStreamBuilder_openStream(). * @param ids reference to an array of ids. * @params numIds size allocated to the array of ids. * The input should be the size of the ids array. * The output will be the actual number of device ids. * @return {@link #AAUDIO_OK} or an error code. * If numIds is null, return {@link #AAUDIO_ERROR_ILLEGAL_ARGUMENT}. * If numIds is smaller than the number of device ids, return * {@link #AAUDIO_ERROR_OUT_OF_RANGE}. The value of numIds will still be updated. * Otherwise, if ids is null, return {@link #AAUDIO_ERROR_ILLEGAL_ARGUMENT}. */ AAUDIO_API aaudio_result_t AAudioStream_getDeviceIds(AAudioStream* _Nonnull stream, int32_t* _Nonnull ids, int32_t* _Nonnull numIds) __INTRODUCED_IN(36); /** * Available since API level 26. * Loading media/libaaudio/src/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -103,6 +103,7 @@ cc_library { "framework-permission-aidl-cpp", "libaaudio_internal", "libaudioclient", "libaudiofoundation", "libaudioutils", "libbinder", "libcutils", Loading Loading @@ -166,6 +167,7 @@ cc_library { "framework-permission-aidl-cpp", "libaudioclient", "libaudioclient_aidl_conversion", "libaudiofoundation", "libaudioutils", "libbinder", "libcutils", Loading media/libaaudio/src/binding/AAudioStreamConfiguration.cpp +19 −2 Original line number Diff line number Diff line Loading @@ -34,7 +34,16 @@ using android::media::audio::common::AudioFormatDescription; AAudioStreamConfiguration::AAudioStreamConfiguration(const StreamParameters& parcelable) { setChannelMask(parcelable.channelMask); setSampleRate(parcelable.sampleRate); setDeviceId(parcelable.deviceId); auto deviceIds = android::convertContainer<android::DeviceIdVector>( parcelable.deviceIds, android::aidl2legacy_int32_t_audio_port_handle_t); if (deviceIds.ok()) { setDeviceIds(deviceIds.value()); } else { ALOGE("deviceIds (%s) aidl2legacy conversion failed", android::toString(parcelable.deviceIds).c_str()); android::DeviceIdVector emptyDeviceIds; setDeviceIds(emptyDeviceIds); } static_assert(sizeof(aaudio_sharing_mode_t) == sizeof(parcelable.sharingMode)); setSharingMode(parcelable.sharingMode); auto convFormat = android::aidl2legacy_AudioFormatDescription_audio_format_t( Loading Loading @@ -87,7 +96,15 @@ StreamParameters AAudioStreamConfiguration::parcelable() const { StreamParameters result; result.channelMask = getChannelMask(); result.sampleRate = getSampleRate(); result.deviceId = getDeviceId(); auto deviceIds = android::convertContainer<std::vector<int32_t>>( getDeviceIds(), android::legacy2aidl_audio_port_handle_t_int32_t); if (deviceIds.ok()) { result.deviceIds = deviceIds.value(); } else { ALOGE("deviceIds (%s) legacy2aidl conversion failed", android::toString(getDeviceIds()).c_str()); result.deviceIds = {}; } static_assert(sizeof(aaudio_sharing_mode_t) == sizeof(result.sharingMode)); result.sharingMode = getSharingMode(); auto convAudioFormat = android::legacy2aidl_audio_format_t_AudioFormatDescription(getFormat()); Loading media/libaaudio/src/binding/aidl/aaudio/StreamParameters.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ import android.media.audio.common.AudioFormatDescription; parcelable StreamParameters { int channelMask; // = AAUDIO_UNSPECIFIED; int sampleRate; // = AAUDIO_UNSPECIFIED; int deviceId; // = AAUDIO_UNSPECIFIED; int[] deviceIds; // = null; int /* aaudio_sharing_mode_t */ sharingMode; // = AAUDIO_SHARING_MODE_SHARED; AudioFormatDescription audioFormat; // = AUDIO_FORMAT_DEFAULT; int /* aaudio_direction_t */ direction; // = AAUDIO_DIRECTION_OUTPUT; Loading Loading
media/libaaudio/fuzzer/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ cc_fuzz { "libaaudio", "libaaudio_internal", "libaudioclient", "libaudiofoundation", "libaudioutils", "libbase_ndk", "libcutils", Loading
media/libaaudio/include/aaudio/AAudio.h +23 −1 Original line number Diff line number Diff line Loading @@ -1909,10 +1909,32 @@ AAUDIO_API int32_t AAudioStream_getSamplesPerFrame(AAudioStream* _Nonnull stream * Available since API level 26. * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return actual device ID * @return actual device id. If there are multiple device ids used, the first device picked by * the audio policy engine will be returned. */ AAUDIO_API int32_t AAudioStream_getDeviceId(AAudioStream* _Nonnull stream) __INTRODUCED_IN(26); /** * Available since API level 36. * * Call this function after AAudioStreamBuilder_openStream(). * This function will crash if stream is null. * An array of size 16 should generally be large enough to fit all device identifiers. * * @param stream reference provided by AAudioStreamBuilder_openStream(). * @param ids reference to an array of ids. * @params numIds size allocated to the array of ids. * The input should be the size of the ids array. * The output will be the actual number of device ids. * @return {@link #AAUDIO_OK} or an error code. * If numIds is null, return {@link #AAUDIO_ERROR_ILLEGAL_ARGUMENT}. * If numIds is smaller than the number of device ids, return * {@link #AAUDIO_ERROR_OUT_OF_RANGE}. The value of numIds will still be updated. * Otherwise, if ids is null, return {@link #AAUDIO_ERROR_ILLEGAL_ARGUMENT}. */ AAUDIO_API aaudio_result_t AAudioStream_getDeviceIds(AAudioStream* _Nonnull stream, int32_t* _Nonnull ids, int32_t* _Nonnull numIds) __INTRODUCED_IN(36); /** * Available since API level 26. * Loading
media/libaaudio/src/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -103,6 +103,7 @@ cc_library { "framework-permission-aidl-cpp", "libaaudio_internal", "libaudioclient", "libaudiofoundation", "libaudioutils", "libbinder", "libcutils", Loading Loading @@ -166,6 +167,7 @@ cc_library { "framework-permission-aidl-cpp", "libaudioclient", "libaudioclient_aidl_conversion", "libaudiofoundation", "libaudioutils", "libbinder", "libcutils", Loading
media/libaaudio/src/binding/AAudioStreamConfiguration.cpp +19 −2 Original line number Diff line number Diff line Loading @@ -34,7 +34,16 @@ using android::media::audio::common::AudioFormatDescription; AAudioStreamConfiguration::AAudioStreamConfiguration(const StreamParameters& parcelable) { setChannelMask(parcelable.channelMask); setSampleRate(parcelable.sampleRate); setDeviceId(parcelable.deviceId); auto deviceIds = android::convertContainer<android::DeviceIdVector>( parcelable.deviceIds, android::aidl2legacy_int32_t_audio_port_handle_t); if (deviceIds.ok()) { setDeviceIds(deviceIds.value()); } else { ALOGE("deviceIds (%s) aidl2legacy conversion failed", android::toString(parcelable.deviceIds).c_str()); android::DeviceIdVector emptyDeviceIds; setDeviceIds(emptyDeviceIds); } static_assert(sizeof(aaudio_sharing_mode_t) == sizeof(parcelable.sharingMode)); setSharingMode(parcelable.sharingMode); auto convFormat = android::aidl2legacy_AudioFormatDescription_audio_format_t( Loading Loading @@ -87,7 +96,15 @@ StreamParameters AAudioStreamConfiguration::parcelable() const { StreamParameters result; result.channelMask = getChannelMask(); result.sampleRate = getSampleRate(); result.deviceId = getDeviceId(); auto deviceIds = android::convertContainer<std::vector<int32_t>>( getDeviceIds(), android::legacy2aidl_audio_port_handle_t_int32_t); if (deviceIds.ok()) { result.deviceIds = deviceIds.value(); } else { ALOGE("deviceIds (%s) legacy2aidl conversion failed", android::toString(getDeviceIds()).c_str()); result.deviceIds = {}; } static_assert(sizeof(aaudio_sharing_mode_t) == sizeof(result.sharingMode)); result.sharingMode = getSharingMode(); auto convAudioFormat = android::legacy2aidl_audio_format_t_AudioFormatDescription(getFormat()); Loading
media/libaaudio/src/binding/aidl/aaudio/StreamParameters.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ import android.media.audio.common.AudioFormatDescription; parcelable StreamParameters { int channelMask; // = AAUDIO_UNSPECIFIED; int sampleRate; // = AAUDIO_UNSPECIFIED; int deviceId; // = AAUDIO_UNSPECIFIED; int[] deviceIds; // = null; int /* aaudio_sharing_mode_t */ sharingMode; // = AAUDIO_SHARING_MODE_SHARED; AudioFormatDescription audioFormat; // = AUDIO_FORMAT_DEFAULT; int /* aaudio_direction_t */ direction; // = AAUDIO_DIRECTION_OUTPUT; Loading