Loading include/media/VolumeShaper.h +13 −8 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ public: , mId(-1) { } Configuration(const Configuration &configuration) explicit Configuration(const Configuration &configuration) : Interpolator<S, T>(*static_cast<const Interpolator<S, T> *>(&configuration)) , mType(configuration.mType) , mOptionFlags(configuration.mOptionFlags) Loading Loading @@ -236,6 +236,7 @@ public: clampVolume(); } // The parcel layout must match VolumeShaper.java status_t writeToParcel(Parcel *parcel) const { if (parcel == nullptr) return BAD_VALUE; return parcel->writeInt32((int32_t)mType) Loading Loading @@ -300,15 +301,19 @@ public: : Operation(FLAG_NONE, -1 /* replaceId */) { } explicit Operation(Flag flags, int replaceId) Operation(Flag flags, int replaceId) : Operation(flags, replaceId, std::numeric_limits<S>::quiet_NaN() /* xOffset */) { } Operation(const Operation &operation) explicit Operation(const Operation &operation) : Operation(operation.mFlags, operation.mReplaceId, operation.mXOffset) { } explicit Operation(Flag flags, int replaceId, S xOffset) explicit Operation(const sp<Operation> &operation) : Operation(*operation.get()) { } Operation(Flag flags, int replaceId, S xOffset) : mFlags(flags) , mReplaceId(replaceId) , mXOffset(xOffset) { Loading Loading @@ -375,7 +380,7 @@ public: // must match with VolumeShaper.java in frameworks/base class State : public RefBase { public: explicit State(T volume, S xOffset) State(T volume, S xOffset) : mVolume(volume) , mXOffset(xOffset) { } Loading Loading @@ -480,7 +485,7 @@ public: // TODO: Since we pass configuration and operation as shared pointers // there is a potential risk that the caller may modify these after // delivery. Currently, we don't require copies made here. explicit VolumeShaper( VolumeShaper( const sp<VolumeShaper::Configuration> &configuration, const sp<VolumeShaper::Operation> &operation) : mConfiguration(configuration) // we do not make a copy Loading Loading @@ -793,7 +798,7 @@ public: void reset() { AutoMutex _l(mLock); mVolumeShapers.clear(); mLastFrame = -1; mLastFrame = 0; // keep mVolumeShaperIdCounter as is. } Loading Loading @@ -835,7 +840,7 @@ private: mutable Mutex mLock; double mSampleRate; // in samples (frames) per second int64_t mLastFrame; // logging purpose only int64_t mLastFrame; // logging purpose only, 0 on start int32_t mVolumeShaperIdCounter; // a counter to return a unique volume shaper id. std::pair<T /* volume */, bool /* active */> mLastVolume; std::list<VolumeShaper> mVolumeShapers; // list provides stable iterators on erase Loading Loading
include/media/VolumeShaper.h +13 −8 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ public: , mId(-1) { } Configuration(const Configuration &configuration) explicit Configuration(const Configuration &configuration) : Interpolator<S, T>(*static_cast<const Interpolator<S, T> *>(&configuration)) , mType(configuration.mType) , mOptionFlags(configuration.mOptionFlags) Loading Loading @@ -236,6 +236,7 @@ public: clampVolume(); } // The parcel layout must match VolumeShaper.java status_t writeToParcel(Parcel *parcel) const { if (parcel == nullptr) return BAD_VALUE; return parcel->writeInt32((int32_t)mType) Loading Loading @@ -300,15 +301,19 @@ public: : Operation(FLAG_NONE, -1 /* replaceId */) { } explicit Operation(Flag flags, int replaceId) Operation(Flag flags, int replaceId) : Operation(flags, replaceId, std::numeric_limits<S>::quiet_NaN() /* xOffset */) { } Operation(const Operation &operation) explicit Operation(const Operation &operation) : Operation(operation.mFlags, operation.mReplaceId, operation.mXOffset) { } explicit Operation(Flag flags, int replaceId, S xOffset) explicit Operation(const sp<Operation> &operation) : Operation(*operation.get()) { } Operation(Flag flags, int replaceId, S xOffset) : mFlags(flags) , mReplaceId(replaceId) , mXOffset(xOffset) { Loading Loading @@ -375,7 +380,7 @@ public: // must match with VolumeShaper.java in frameworks/base class State : public RefBase { public: explicit State(T volume, S xOffset) State(T volume, S xOffset) : mVolume(volume) , mXOffset(xOffset) { } Loading Loading @@ -480,7 +485,7 @@ public: // TODO: Since we pass configuration and operation as shared pointers // there is a potential risk that the caller may modify these after // delivery. Currently, we don't require copies made here. explicit VolumeShaper( VolumeShaper( const sp<VolumeShaper::Configuration> &configuration, const sp<VolumeShaper::Operation> &operation) : mConfiguration(configuration) // we do not make a copy Loading Loading @@ -793,7 +798,7 @@ public: void reset() { AutoMutex _l(mLock); mVolumeShapers.clear(); mLastFrame = -1; mLastFrame = 0; // keep mVolumeShaperIdCounter as is. } Loading Loading @@ -835,7 +840,7 @@ private: mutable Mutex mLock; double mSampleRate; // in samples (frames) per second int64_t mLastFrame; // logging purpose only int64_t mLastFrame; // logging purpose only, 0 on start int32_t mVolumeShaperIdCounter; // a counter to return a unique volume shaper id. std::pair<T /* volume */, bool /* active */> mLastVolume; std::list<VolumeShaper> mVolumeShapers; // list provides stable iterators on erase Loading