Camera3: don't let dequeueBuffer block indefinitely
The synchronous consumers (e.g. ImageReader) may be very slow when the clients have computational intensive image processings. When system load is high, these processing will be even much slower. This could starve the producer side and then cause dequeue/attach buffer block indefinitely. If clients intends to close the capture session, right after a capture request is submitted, the waitUntil drain could be blocked indefinitely if the capture request dequeue buffer call is blocked indefinitely, as the request thread will never become idle until the last dequeue buffer is done and the request is sent.This indefinite getBuffer() blocking could easily trigger the waitUntilDrained 5s timeout thus put the camera device into error state although there is nothing bad happening in the HAL. Introducing the timeout will avoid such bad situation. When consumer is slow, there will be no new request being sent to HAL, as there is really no new buffer available. Bug:30404840 CRs-Fixed: 1037189 Change-Id: Ibf08d2745911203bce6f31130800707f36d7f985
Loading
Please register or sign in to comment