diff options
author | Mikhail Naganov <mnaganov@google.com> | 2021-01-15 19:05:04 +0000 |
---|---|---|
committer | Mikhail Naganov <mnaganov@google.com> | 2021-02-03 01:28:38 +0000 |
commit | a9ac889b9626f14e1a6310f4ca04a87cedf87d18 (patch) | |
tree | 5ccbbcfd29cbf4306f394f6180eae55b3e35aa31 /audio/core/all-versions/default/StreamOut.cpp | |
parent | 39059ed17f8fef43fee286cc0eacbb910ee2b772 (diff) |
audio: Create libraries for data types in core and effect
Add 'CoreUtils' library similar to 'HidlUtils' for the types
specific to the core HAL. Add 'EffectUtils' library similar to
'HidlUtils' for the types specific to the effects HAL. Move into
them and de-duplicate code previously scattered across the
default HAL implementation and libaudiohal. Add unit tests.
Removed 'AUDIO_{INPUT|OUTPUT}_FLAG_NONE' from the list of
values in the XSD file to avoid additional complexity due to
equivalence of this value to an empty list of flags.
Bug: 142480271
Test: m android.hardware.audio@X.0-impl
Test: m android.hardware.audio.effect@X.0-impl
Test: atest android.hardware.audio@7.0-util_tests
Test: atest android.hardware.audio.common@7.0-util_tests
Test: atest android.hardware.audio.effect@7.0-util_tests
Change-Id: I71a95cbe07fcc162dc6d74ff9665747a17ce5a80
Merged-In: I71a95cbe07fcc162dc6d74ff9665747a17ce5a80
Diffstat (limited to 'audio/core/all-versions/default/StreamOut.cpp')
-rw-r--r-- | audio/core/all-versions/default/StreamOut.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/audio/core/all-versions/default/StreamOut.cpp b/audio/core/all-versions/default/StreamOut.cpp index 233575c891..a089f6baf9 100644 --- a/audio/core/all-versions/default/StreamOut.cpp +++ b/audio/core/all-versions/default/StreamOut.cpp @@ -17,7 +17,6 @@ #define LOG_TAG "StreamOutHAL" #include "core/default/StreamOut.h" -#include "core/default/Conversions.h" #include "core/default/Util.h" //#define LOG_NDEBUG 0 @@ -30,6 +29,7 @@ #include <HidlUtils.h> #include <android/log.h> #include <hardware/audio.h> +#include <util/CoreUtils.h> #include <utils/Trace.h> namespace android { @@ -589,13 +589,15 @@ Return<void> StreamOut::debug(const hidl_handle& fd, const hidl_vec<hidl_string> Result StreamOut::doUpdateSourceMetadata(const SourceMetadata& sourceMetadata) { std::vector<playback_track_metadata_t> halTracks; #if MAJOR_VERSION <= 6 - (void)sourceMetadataToHal(sourceMetadata, &halTracks); + (void)CoreUtils::sourceMetadataToHal(sourceMetadata, &halTracks); #else // Validate whether a conversion to V7 is possible. This is needed // to have a consistent behavior of the HAL regardless of the API // version of the legacy HAL (and also to be consistent with openOutputStream). std::vector<playback_track_metadata_v7> halTracksV7; - if (status_t status = sourceMetadataToHalV7(sourceMetadata, &halTracksV7); status == NO_ERROR) { + if (status_t status = CoreUtils::sourceMetadataToHalV7( + sourceMetadata, false /*ignoreNonVendorTags*/, &halTracksV7); + status == NO_ERROR) { halTracks.reserve(halTracksV7.size()); for (auto metadata_v7 : halTracksV7) { halTracks.push_back(std::move(metadata_v7.base)); @@ -615,7 +617,9 @@ Result StreamOut::doUpdateSourceMetadata(const SourceMetadata& sourceMetadata) { #if MAJOR_VERSION >= 7 Result StreamOut::doUpdateSourceMetadataV7(const SourceMetadata& sourceMetadata) { std::vector<playback_track_metadata_v7> halTracks; - if (status_t status = sourceMetadataToHalV7(sourceMetadata, &halTracks); status != NO_ERROR) { + if (status_t status = CoreUtils::sourceMetadataToHalV7( + sourceMetadata, false /*ignoreNonVendorTags*/, &halTracks); + status != NO_ERROR) { return Stream::analyzeStatus("sourceMetadataToHal", status); } const source_metadata_v7_t halMetadata = { |