Allow placement of Pipe buffer to be specified
Change-Id: I2f6b68089ecfe85cd975d29ad0d0afd13c487002
diff --git a/include/media/nbaio/Pipe.h b/include/media/nbaio/Pipe.h
index c784129..eba37bc 100644
--- a/include/media/nbaio/Pipe.h
+++ b/include/media/nbaio/Pipe.h
@@ -30,7 +30,11 @@
public:
// maxFrames will be rounded up to a power of 2, and all slots are available. Must be >= 2.
- Pipe(size_t maxFrames, const NBAIO_Format& format);
+ // buffer is an optional parameter specifying the virtual address of the pipe buffer,
+ // which must be of size roundup(maxFrames) * Format_frameSize(format) bytes.
+ Pipe(size_t maxFrames, const NBAIO_Format& format, void *buffer = NULL);
+
+ // If a buffer was specified in the constructor, it is not automatically freed by destructor.
virtual ~Pipe();
// NBAIO_Port interface
@@ -57,6 +61,7 @@
void * const mBuffer;
volatile int32_t mRear; // written by android_atomic_release_store
volatile int32_t mReaders; // number of PipeReader clients currently attached to this Pipe
+ const bool mFreeBufferInDestructor;
};
} // namespace android