Camera: Decrease latency when joining sequencer thread

Depending on timing, legacy camera clients that try to
disconnect may observe a random delay while waiting
for the capture sequencer thread to exit from its
respective 'threadLoop'. The delay there can be as much as
'kWaitDuration'.
To improve the average disconnect latency use a separate
and much smaller timeout when managing idle state.

Bug: 143557484
Test: atest cts/tests/camera/src/android/hardware/cts/

Change-Id: I164b3d37182cac776c0064047a5ef5b5a0f8b314
gugelfrei
Emilian Peev 5 years ago
parent 8814904b20
commit 039b9e940f

@ -265,7 +265,7 @@ CaptureSequencer::CaptureState CaptureSequencer::manageIdle(
Mutex::Autolock l(mInputMutex);
while (!mStartCapture) {
res = mStartCaptureSignal.waitRelative(mInputMutex,
kWaitDuration);
kIdleWaitDuration);
if (res == TIMED_OUT) break;
}
if (mStartCapture) {

@ -111,6 +111,7 @@ class CaptureSequencer:
* Internal to CaptureSequencer
*/
static const nsecs_t kWaitDuration = 100000000; // 100 ms
static const nsecs_t kIdleWaitDuration = 10000000; // 10 ms
static const int kMaxTimeoutsForPrecaptureStart = 10; // 1 sec
static const int kMaxTimeoutsForPrecaptureEnd = 20; // 2 sec
static const int kMaxTimeoutsForCaptureEnd = 40; // 4 sec

Loading…
Cancel
Save