SingleStateQueue: Add last method to Mutator
Obtains last value written.
Test: see bug for CL topic and test
Bug: 80272001
Change-Id: Ia71752970ac2e66bb1c89cd9e06691fc88f64647
diff --git a/media/libmedia/include/media/SingleStateQueue.h b/media/libmedia/include/media/SingleStateQueue.h
index d423962..c2761cb 100644
--- a/media/libmedia/include/media/SingleStateQueue.h
+++ b/media/libmedia/include/media/SingleStateQueue.h
@@ -99,6 +99,13 @@
return mShared->mAck - sequence >= 0;
}
+ // returns the last value written (or the contents of the shared buffer after initialization
+ // if no value was written).
+ T last() const
+ { // assume no sequence check required - we are the writer.
+ return mShared->mValue;
+ }
+
private:
int32_t mSequence;
Shared * const mShared;