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
This commit is contained in:
Shunkai Yao 2024-02-15 17:41:42 +00:00
parent e61433d1e0
commit 1332677998

View file

@ -19,20 +19,22 @@
#include <vector>
#include <aidl/android/hardware/audio/effect/BnEffect.h>
#include <system/audio_effects/effect_visualizer.h>
#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);
}