Loading audio/core/all-versions/default/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ cc_defaults { export_include_dirs: ["include"], shared_libs: [ "libaudiofoundation", "libbase", "libcutils", "libfmq", Loading audio/core/all-versions/default/Stream.cpp +8 −8 Original line number Diff line number Diff line Loading @@ -26,9 +26,8 @@ #include <android/log.h> #include <hardware/audio.h> #include <hardware/audio_effect.h> #include <media/AudioContainers.h> #include <media/TypeConverter.h> #include <utils/SortedVector.h> #include <utils/Vector.h> namespace android { namespace hardware { Loading Loading @@ -100,11 +99,11 @@ Return<void> Stream::getSupportedSampleRates(AudioFormat format, Result result = getParam(AudioParameter::keyStreamSupportedSamplingRates, &halListValue, context); hidl_vec<uint32_t> sampleRates; SortedVector<uint32_t> halSampleRates; SampleRateSet halSampleRates; if (result == Result::OK) { halSampleRates = samplingRatesFromString(halListValue.string(), AudioParameter::valueListSeparator); sampleRates.setToExternal(halSampleRates.editArray(), halSampleRates.size()); sampleRates = hidl_vec<uint32_t>(halSampleRates.begin(), halSampleRates.end()); // Legacy get_parameter does not return a status_t, thus can not advertise of failure. // Note that this method must succeed (non empty list) if the format is supported. if (sampleRates.size() == 0) { Loading @@ -126,13 +125,14 @@ Return<void> Stream::getSupportedChannelMasks(AudioFormat format, String8 halListValue; Result result = getParam(AudioParameter::keyStreamSupportedChannels, &halListValue, context); hidl_vec<AudioChannelBitfield> channelMasks; SortedVector<audio_channel_mask_t> halChannelMasks; ChannelMaskSet halChannelMasks; if (result == Result::OK) { halChannelMasks = channelMasksFromString(halListValue.string(), AudioParameter::valueListSeparator); channelMasks.resize(halChannelMasks.size()); for (size_t i = 0; i < halChannelMasks.size(); ++i) { channelMasks[i] = AudioChannelBitfield(halChannelMasks[i]); size_t i = 0; for (auto channelMask : halChannelMasks) { channelMasks[i++] = AudioChannelBitfield(channelMask); } // Legacy get_parameter does not return a status_t, thus can not advertise of failure. // Note that this method must succeed (non empty list) if the format is supported. Loading Loading @@ -168,7 +168,7 @@ Return<void> Stream::getSupportedFormats(getSupportedFormats_cb _hidl_cb) { String8 halListValue; Result result = getParam(AudioParameter::keyStreamSupportedFormats, &halListValue); hidl_vec<AudioFormat> formats; Vector<audio_format_t> halFormats; FormatVector halFormats; if (result == Result::OK) { halFormats = formatsFromString(halListValue.string(), AudioParameter::valueListSeparator); formats.resize(halFormats.size()); Loading Loading
audio/core/all-versions/default/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ cc_defaults { export_include_dirs: ["include"], shared_libs: [ "libaudiofoundation", "libbase", "libcutils", "libfmq", Loading
audio/core/all-versions/default/Stream.cpp +8 −8 Original line number Diff line number Diff line Loading @@ -26,9 +26,8 @@ #include <android/log.h> #include <hardware/audio.h> #include <hardware/audio_effect.h> #include <media/AudioContainers.h> #include <media/TypeConverter.h> #include <utils/SortedVector.h> #include <utils/Vector.h> namespace android { namespace hardware { Loading Loading @@ -100,11 +99,11 @@ Return<void> Stream::getSupportedSampleRates(AudioFormat format, Result result = getParam(AudioParameter::keyStreamSupportedSamplingRates, &halListValue, context); hidl_vec<uint32_t> sampleRates; SortedVector<uint32_t> halSampleRates; SampleRateSet halSampleRates; if (result == Result::OK) { halSampleRates = samplingRatesFromString(halListValue.string(), AudioParameter::valueListSeparator); sampleRates.setToExternal(halSampleRates.editArray(), halSampleRates.size()); sampleRates = hidl_vec<uint32_t>(halSampleRates.begin(), halSampleRates.end()); // Legacy get_parameter does not return a status_t, thus can not advertise of failure. // Note that this method must succeed (non empty list) if the format is supported. if (sampleRates.size() == 0) { Loading @@ -126,13 +125,14 @@ Return<void> Stream::getSupportedChannelMasks(AudioFormat format, String8 halListValue; Result result = getParam(AudioParameter::keyStreamSupportedChannels, &halListValue, context); hidl_vec<AudioChannelBitfield> channelMasks; SortedVector<audio_channel_mask_t> halChannelMasks; ChannelMaskSet halChannelMasks; if (result == Result::OK) { halChannelMasks = channelMasksFromString(halListValue.string(), AudioParameter::valueListSeparator); channelMasks.resize(halChannelMasks.size()); for (size_t i = 0; i < halChannelMasks.size(); ++i) { channelMasks[i] = AudioChannelBitfield(halChannelMasks[i]); size_t i = 0; for (auto channelMask : halChannelMasks) { channelMasks[i++] = AudioChannelBitfield(channelMask); } // Legacy get_parameter does not return a status_t, thus can not advertise of failure. // Note that this method must succeed (non empty list) if the format is supported. Loading Loading @@ -168,7 +168,7 @@ Return<void> Stream::getSupportedFormats(getSupportedFormats_cb _hidl_cb) { String8 halListValue; Result result = getParam(AudioParameter::keyStreamSupportedFormats, &halListValue); hidl_vec<AudioFormat> formats; Vector<audio_format_t> halFormats; FormatVector halFormats; if (result == Result::OK) { halFormats = formatsFromString(halListValue.string(), AudioParameter::valueListSeparator); formats.resize(halFormats.size()); Loading