#include <utils/Trace.h>
#include <utils/CallStack.h>
+static const nsecs_t DEQUEUE_TIMEOUT_VALUE = seconds(5);
+
+
// Macros for including the BufferQueue name in log messages
#define ST_LOGV(x, ...) ALOGV("[%s] "x, mConsumerName.string(), ##__VA_ARGS__)
#define ST_LOGD(x, ...) ALOGD("[%s] "x, mConsumerName.string(), ##__VA_ARGS__)
ST_LOGE("dequeueBuffer: would block! returning an error instead.");
return WOULD_BLOCK;
}
- mDequeueCondition.wait(mMutex);
+ if (mDequeueCondition.waitRelative(mMutex, DEQUEUE_TIMEOUT_VALUE)) {
+ ST_LOGE("dequeueBuffer: time out and will free all buffer!");
+ freeAllBuffersLocked();
+ }
}
}