libcamera: avoid a race condition on starting and stopping a recording
precondition: preview is running -- call startRecording() -- a preview frame arrives, causing the record callback to be called, and then blocks on mRecordWait.wait() -- call stopRecording(), which sets mReleasedRecordingFrame and signals mRecordWait; -- call startRecording(), which clears mReleasedRecordingFrame; -- receivePreviewFrame() wakes up, checks mReleasedRecordingFrame, and blocks again on mRecordWait.wait(), without having notified the client. Signed-off-by: Iliyan Malchev <malchev@google.com>
This commit is contained in:
parent
ed604c67ee
commit
32b7f2804e
@ -1547,7 +1547,7 @@ void QualcommCameraHardware::receivePreviewFrame(struct msm_frame *frame)
|
||||
if(rcb != NULL) {
|
||||
Mutex::Autolock rLock(&mRecordFrameLock);
|
||||
rcb(mPreviewHeap->mBuffers[mPreviewFrameOffset], rdata);
|
||||
while(mReleasedRecordingFrame != true) {
|
||||
if (mReleasedRecordingFrame != true) {
|
||||
LOGV("block for release frame request/command");
|
||||
mRecordWait.wait(mRecordFrameLock);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user