Loading include/media/stagefright/MediaBufferGroup.h +6 −3 Original line number Diff line number Diff line Loading @@ -34,9 +34,12 @@ public: void add_buffer(MediaBuffer *buffer); // Blocks until a buffer is available and returns it to the caller, // the returned buffer will have a reference count of 1. status_t acquire_buffer(MediaBuffer **buffer); // If nonBlocking is false, it blocks until a buffer is available and // passes it to the caller in *buffer, while returning OK. // The returned buffer will have a reference count of 1. // If nonBlocking is true and a buffer is not immediately available, // buffer is set to NULL and it returns WOULD_BLOCK. status_t acquire_buffer(MediaBuffer **buffer, bool nonBlocking = false); protected: virtual void signalBufferReturned(MediaBuffer *buffer); Loading media/libstagefright/MediaBufferGroup.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -55,7 +55,8 @@ void MediaBufferGroup::add_buffer(MediaBuffer *buffer) { mLastBuffer = buffer; } status_t MediaBufferGroup::acquire_buffer(MediaBuffer **out) { status_t MediaBufferGroup::acquire_buffer( MediaBuffer **out, bool nonBlocking) { Mutex::Autolock autoLock(mLock); for (;;) { Loading @@ -70,6 +71,11 @@ status_t MediaBufferGroup::acquire_buffer(MediaBuffer **out) { } } if (nonBlocking) { *out = NULL; return WOULD_BLOCK; } // All buffers are in use. Block until one of them is returned to us. mCondition.wait(mLock); } Loading Loading
include/media/stagefright/MediaBufferGroup.h +6 −3 Original line number Diff line number Diff line Loading @@ -34,9 +34,12 @@ public: void add_buffer(MediaBuffer *buffer); // Blocks until a buffer is available and returns it to the caller, // the returned buffer will have a reference count of 1. status_t acquire_buffer(MediaBuffer **buffer); // If nonBlocking is false, it blocks until a buffer is available and // passes it to the caller in *buffer, while returning OK. // The returned buffer will have a reference count of 1. // If nonBlocking is true and a buffer is not immediately available, // buffer is set to NULL and it returns WOULD_BLOCK. status_t acquire_buffer(MediaBuffer **buffer, bool nonBlocking = false); protected: virtual void signalBufferReturned(MediaBuffer *buffer); Loading
media/libstagefright/MediaBufferGroup.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -55,7 +55,8 @@ void MediaBufferGroup::add_buffer(MediaBuffer *buffer) { mLastBuffer = buffer; } status_t MediaBufferGroup::acquire_buffer(MediaBuffer **out) { status_t MediaBufferGroup::acquire_buffer( MediaBuffer **out, bool nonBlocking) { Mutex::Autolock autoLock(mLock); for (;;) { Loading @@ -70,6 +71,11 @@ status_t MediaBufferGroup::acquire_buffer(MediaBuffer **out) { } } if (nonBlocking) { *out = NULL; return WOULD_BLOCK; } // All buffers are in use. Block until one of them is returned to us. mCondition.wait(mLock); } Loading