From 1332677998c3816b906747429c94236720f89020 Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Thu, 15 Feb 2024 17:41:42 +0000 Subject: [PATCH] Visualizer: make the range align with VISUALIZER_CAPTURE_SIZE_* Bug: 317742497 Test: atest android.media.audio.cts.VisualizerTest Test: atest VtsHalAudioEffectTargetTest Change-Id: I5b89c9cead9906966b00fcb2fdb16905ed97b263 Merged-In: I5b89c9cead9906966b00fcb2fdb16905ed97b263 --- audio/aidl/default/visualizer/VisualizerSw.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/audio/aidl/default/visualizer/VisualizerSw.h b/audio/aidl/default/visualizer/VisualizerSw.h index 4b87b04298..819351a848 100644 --- a/audio/aidl/default/visualizer/VisualizerSw.h +++ b/audio/aidl/default/visualizer/VisualizerSw.h @@ -19,20 +19,22 @@ #include #include +#include #include "effect-impl/EffectImpl.h" namespace aidl::android::hardware::audio::effect { class VisualizerSwContext final : public EffectContext { public: - static const int kMinCaptureSize = 0x80; - static const int kMaxCaptureSize = 0x400; - static const int kMaxLatencyMs = 3000; - static const int kMaxCaptureBufSize = 0xffff; + // need align the min/max capture size to VISUALIZER_CAPTURE_SIZE_MIN and + // VISUALIZER_CAPTURE_SIZE_MAX because of limitation in audio_utils fixedfft. + static constexpr int32_t kMinCaptureSize = VISUALIZER_CAPTURE_SIZE_MIN; + static constexpr int32_t kMaxCaptureSize = VISUALIZER_CAPTURE_SIZE_MAX; + static constexpr int32_t kMaxLatencyMs = 3000; VisualizerSwContext(int statusDepth, const Parameter::Common& common) : EffectContext(statusDepth, common) { LOG(DEBUG) << __func__; - mCaptureSampleBuffer.resize(kMaxCaptureBufSize); + mCaptureSampleBuffer.resize(kMaxCaptureSize); fill(mCaptureSampleBuffer.begin(), mCaptureSampleBuffer.end(), 0x80); }