Add backward compatibility in effect hal default implementation
Skipping the reopen sequence for unsupported version
Add member initialize for EffectContext
Bug: 322780092
Test: latest libAudioHal with V1 effect HAL
Test: atest VtsHalAudioEffectTargetTest
Change-Id: I597194e5ebf25566d5adda533e151da2e99781f4
diff --git a/audio/aidl/default/include/effect-impl/EffectContext.h b/audio/aidl/default/include/effect-impl/EffectContext.h
index b3d730d..275378e 100644
--- a/audio/aidl/default/include/effect-impl/EffectContext.h
+++ b/audio/aidl/default/include/effect-impl/EffectContext.h
@@ -44,6 +44,7 @@
}
}
+ void setVersion(int version) { mVersion = version; }
std::shared_ptr<StatusMQ> getStatusFmq() const;
std::shared_ptr<DataMQ> getInputDataFmq() const;
std::shared_ptr<DataMQ> getOutputDataFmq() const;
@@ -82,10 +83,11 @@
virtual ::android::hardware::EventFlag* getStatusEventFlag();
protected:
- size_t mInputFrameSize;
- size_t mOutputFrameSize;
- size_t mInputChannelCount;
- size_t mOutputChannelCount;
+ int mVersion = 0;
+ size_t mInputFrameSize = 0;
+ size_t mOutputFrameSize = 0;
+ size_t mInputChannelCount = 0;
+ size_t mOutputChannelCount = 0;
Parameter::Common mCommon = {};
std::vector<aidl::android::media::audio::common::AudioDeviceDescription> mOutputDevice = {};
aidl::android::media::audio::common::AudioMode mMode =
@@ -98,13 +100,13 @@
private:
// fmq and buffers
- std::shared_ptr<StatusMQ> mStatusMQ;
- std::shared_ptr<DataMQ> mInputMQ;
- std::shared_ptr<DataMQ> mOutputMQ;
+ std::shared_ptr<StatusMQ> mStatusMQ = nullptr;
+ std::shared_ptr<DataMQ> mInputMQ = nullptr;
+ std::shared_ptr<DataMQ> mOutputMQ = nullptr;
// std::shared_ptr<IEffect::OpenEffectReturn> mRet;
// work buffer set by effect instances, the access and update are in same thread
- std::vector<float> mWorkBuffer;
+ std::vector<float> mWorkBuffer = {};
- ::android::hardware::EventFlag* mEfGroup;
+ ::android::hardware::EventFlag* mEfGroup = nullptr;
};
} // namespace aidl::android::hardware::audio::effect