camera: prevent possible deadlock scenario

Hold scope of returnFrame lock for just the calculation
of refCount. Otherwise, we could have a scenario where
endImageCapture and stopRecording could cause a deadlock
competing for mReturnFrameLock and mLock. Issue arises
mainly because endImageCapture is signalled from
fillThisBuffer which stopRecording will need to get into.

Make sure mEventQ has a message before calling get() since
read on the pipe will block with notifyEvent holding mLock.

Change-Id: I3a125711632fa311fd794e300cd5008321a84c40
Signed-off-by: Tyler Luu <tluu@ti.com>
2 files changed