Don't time out prematurely for video encoding waiting for output buffers
o For timelapse video encoding, the timelapse between two neighoring
input frames could be very long
Change-Id: I2b6f9c392f2237deae71c894efc7fc3692431796
related-to-bug: 5160548
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 644c413..27dfeab 100755
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -3199,9 +3199,16 @@
}
status_t OMXCodec::waitForBufferFilled_l() {
+
+ if (mIsEncoder) {
+ // For timelapse video recording, the timelapse video recording may
+ // not send an input frame for a _long_ time. Do not use timeout
+ // for video encoding.
+ return mBufferFilled.wait(mLock);
+ }
status_t err = mBufferFilled.waitRelative(mLock, kBufferFilledEventTimeOutUs);
if (err != OK) {
- LOGE("Timed out waiting for buffers from video encoder: %d/%d",
+ CODEC_LOGE("Timed out waiting for output buffers: %d/%d",
countBuffersWeOwn(mPortBuffers[kPortIndexInput]),
countBuffersWeOwn(mPortBuffers[kPortIndexOutput]));
}