|
|
|
@ -166,6 +166,7 @@ NdkCamera::NdkCamera(int32_t width, int32_t height, const NdkCamera::CAMERA_PARA
|
|
|
|
|
|
|
|
|
|
mCaptureTriggered = false;
|
|
|
|
|
mFocusTriggered = false;
|
|
|
|
|
mCaptureDispatched = false;
|
|
|
|
|
|
|
|
|
|
maxFrameDuration = 0;
|
|
|
|
|
afSupported = false;
|
|
|
|
@ -1300,15 +1301,21 @@ void NdkCamera::onImageAvailable(AImageReader* reader)
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<ACameraMetadata> result;
|
|
|
|
|
bool captureCompleted = false;
|
|
|
|
|
bool captureDispatchable = false;
|
|
|
|
|
m_locker.lock();
|
|
|
|
|
if (!mCaptureResults.empty())
|
|
|
|
|
{
|
|
|
|
|
captureCompleted = true;
|
|
|
|
|
result = mCaptureResults[0];
|
|
|
|
|
}
|
|
|
|
|
if (captureCompleted && !mCaptureDispatched)
|
|
|
|
|
{
|
|
|
|
|
mCaptureDispatched = true;
|
|
|
|
|
captureDispatchable = true;
|
|
|
|
|
}
|
|
|
|
|
m_locker.unlock();
|
|
|
|
|
|
|
|
|
|
if (captureCompleted)
|
|
|
|
|
if (captureCompleted && captureDispatchable)
|
|
|
|
|
{
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_DEBUG,"onOneCapture from onImageAvailable");
|
|
|
|
|
onOneCapture(mCharacteristics, result, mFinalLdr, ts - m_startTime, mOneFrame);
|
|
|
|
@ -1341,17 +1348,23 @@ void NdkCamera::onImageAvailable(AImageReader* reader)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool captureCompleted = false;
|
|
|
|
|
bool captureDispatchable = false;
|
|
|
|
|
|
|
|
|
|
size_t expectedTimes = mCaptureRequests.size() - 1;
|
|
|
|
|
m_locker.lock();
|
|
|
|
|
captureCompleted = mCaptureResults.size() >= expectedTimes && mCaptureFrames.size() >= expectedTimes;
|
|
|
|
|
if (captureCompleted && !mCaptureDispatched)
|
|
|
|
|
{
|
|
|
|
|
mCaptureDispatched = true;
|
|
|
|
|
captureDispatchable = true;
|
|
|
|
|
}
|
|
|
|
|
m_locker.unlock();
|
|
|
|
|
|
|
|
|
|
if (captureCompleted)
|
|
|
|
|
if (captureCompleted && captureDispatchable)
|
|
|
|
|
{
|
|
|
|
|
FireBurstCapture();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1766,6 +1779,7 @@ void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureReque
|
|
|
|
|
|
|
|
|
|
ACameraMetadata* pCopy = ACameraMetadata_copy(result);
|
|
|
|
|
bool captureCompleted = false;
|
|
|
|
|
bool captureDispatchable = false;
|
|
|
|
|
size_t expectedTimes = mCaptureRequests.size() - 1;
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<ACameraMetadata> captureResult(pCopy, ACameraMetadata_free);
|
|
|
|
@ -1774,9 +1788,14 @@ void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureReque
|
|
|
|
|
m_locker.lock();
|
|
|
|
|
mCaptureResults.push_back(captureResult);
|
|
|
|
|
captureCompleted = !mOneFrame.empty();
|
|
|
|
|
if (captureCompleted && !mCaptureDispatched)
|
|
|
|
|
{
|
|
|
|
|
mCaptureDispatched = true;
|
|
|
|
|
captureDispatchable = true;
|
|
|
|
|
}
|
|
|
|
|
m_locker.unlock();
|
|
|
|
|
|
|
|
|
|
if (captureCompleted)
|
|
|
|
|
if (captureCompleted && captureDispatchable)
|
|
|
|
|
{
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_DEBUG,"onOneCapture from onCaptureCompleted");
|
|
|
|
|
onOneCapture(mCharacteristics, captureResult, mFinalLdr, ts - m_startTime, mOneFrame);
|
|
|
|
@ -1787,9 +1806,14 @@ void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureReque
|
|
|
|
|
m_locker.lock();
|
|
|
|
|
mCaptureResults.push_back(captureResult);
|
|
|
|
|
captureCompleted = mCaptureFrames.size() >= expectedTimes && mCaptureResults.size() >= expectedTimes;
|
|
|
|
|
if (captureCompleted && !mCaptureDispatched)
|
|
|
|
|
{
|
|
|
|
|
mCaptureDispatched = true;
|
|
|
|
|
captureDispatchable = true;
|
|
|
|
|
}
|
|
|
|
|
m_locker.unlock();
|
|
|
|
|
|
|
|
|
|
if (captureCompleted)
|
|
|
|
|
if (captureCompleted && captureDispatchable)
|
|
|
|
|
{
|
|
|
|
|
FireBurstCapture();
|
|
|
|
|
}
|
|
|
|
|