mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Audio : Fix a few minor issues with stream switcher class am: 035beba203
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2680756 Change-Id: I42680884d9a0675065028500096d7b7dcc00ffdf Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
committed by
Automerger Merge Worker
commit
f901f6a465
@@ -31,7 +31,9 @@ using aidl::android::media::audio::common::AudioDevice;
|
||||
namespace aidl::android::hardware::audio::core {
|
||||
|
||||
StreamSwitcher::StreamSwitcher(StreamContext* context, const Metadata& metadata)
|
||||
: mMetadata(metadata), mStream(new InnerStreamWrapper<StreamStub>(context, mMetadata)) {}
|
||||
: mContext(context),
|
||||
mMetadata(metadata),
|
||||
mStream(new InnerStreamWrapper<StreamStub>(context, mMetadata)) {}
|
||||
|
||||
ndk::ScopedAStatus StreamSwitcher::closeCurrentStream(bool validateStreamState) {
|
||||
if (!mStream) return ndk::ScopedAStatus::ok();
|
||||
@@ -100,6 +102,10 @@ ndk::ScopedAStatus StreamSwitcher::setVendorParameters(
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus StreamSwitcher::addEffect(const std::shared_ptr<IEffect>& in_effect) {
|
||||
if (in_effect == nullptr) {
|
||||
LOG(DEBUG) << __func__ << ": null effect";
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
||||
}
|
||||
if (mStream == nullptr) {
|
||||
LOG(ERROR) << __func__ << ": stream was closed";
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
||||
@@ -112,6 +118,10 @@ ndk::ScopedAStatus StreamSwitcher::addEffect(const std::shared_ptr<IEffect>& in_
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus StreamSwitcher::removeEffect(const std::shared_ptr<IEffect>& in_effect) {
|
||||
if (in_effect == nullptr) {
|
||||
LOG(DEBUG) << __func__ << ": null effect";
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
||||
}
|
||||
if (mStream == nullptr) {
|
||||
LOG(ERROR) << __func__ << ": stream was closed";
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
||||
|
||||
@@ -86,7 +86,8 @@ class StreamCommonInterfaceEx : virtual public StreamCommonInterface {
|
||||
template <typename T>
|
||||
class InnerStreamWrapper : public T, public StreamCommonInterfaceEx {
|
||||
public:
|
||||
InnerStreamWrapper(StreamContext* context, const Metadata& metadata) : T(context, metadata) {}
|
||||
template <typename... Args>
|
||||
InnerStreamWrapper(Args&&... args) : T(std::forward<Args>(args)...) {}
|
||||
StreamDescriptor::State getStatePriorToClosing() const override { return mStatePriorToClosing; }
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user