hardware: samsung_slsi: libcamera2: Apply pending JPEG count to in_progress
authorSungjoong Kang <sj3.kang@samsung.com>
Mon, 8 Oct 2012 23:15:15 +0000 (16:15 -0700)
committerAlex Ray <aray@google.com>
Tue, 9 Oct 2012 21:37:23 +0000 (14:37 -0700)
Apply the count of pending JPEG output to the result of
get_in_progress_count.

BUG: 7276954
Change-Id: I89aa1311618423d089c9572c9a292d90eb5de92d
Signed-off-by: Sungjoong Kang <sj3.kang@samsung.com>
libcamera2/ExynosCameraHWInterface2.cpp
libcamera2/ExynosCameraHWInterface2.h

index ecfd430a5b26b1207d255e2fd281bda5b6593c75..0975d7c1117b6bcbb4d662c8c17e23fe557e76e2 100644 (file)
@@ -954,6 +954,7 @@ ExynosCameraHWInterface2::ExynosCameraHWInterface2(int cameraId, camera2_device_
             m_afTriggerId(0),
             m_afPendingTriggerId(0),
             m_afModeWaitingCnt(0),
+            m_jpegEncodingCount(0),
             m_scpForceSuspended(false),
             m_halDevice(dev),
             m_nightCaptureCnt(0),
@@ -1609,8 +1610,9 @@ int ExynosCameraHWInterface2::setFrameQueueDstOps(const camera2_frame_queue_dst_
 int ExynosCameraHWInterface2::getInProgressCount()
 {
     int inProgressCount = m_requestManager->GetNumEntries();
-    ALOGV("DEBUG(%s): # of dequeued req (%d)", __FUNCTION__, inProgressCount);
-    return inProgressCount;
+    ALOGV("DEBUG(%s): # of dequeued req (%d) jpeg(%d) = (%d)", __FUNCTION__,
+        inProgressCount, m_jpegEncodingCount, (inProgressCount + m_jpegEncodingCount));
+    return (inProgressCount + m_jpegEncodingCount);
 }
 
 int ExynosCameraHWInterface2::flushCapturesInProgress()
@@ -4129,6 +4131,7 @@ void ExynosCameraHWInterface2::m_streamThreadFunc(SignalDrivenThread * self)
 }
 int ExynosCameraHWInterface2::m_jpegCreator(StreamThread *selfThread, ExynosBuffer *srcImageBuf, nsecs_t frameTimeStamp)
 {
+    Mutex::Autolock lock(m_jpegEncoderLock);
     stream_parameters_t     *selfStreamParms = &(selfThread->m_parameters);
     substream_parameters_t  *subParms        = &m_subStreams[STREAM_ID_JPEG];
     status_t    res;
@@ -4160,6 +4163,8 @@ int ExynosCameraHWInterface2::m_jpegCreator(StreamThread *selfThread, ExynosBuff
         return 1;
     }
 
+    m_jpegEncodingCount++;
+
     m_getRatioSize(selfStreamParms->width, selfStreamParms->height,
                     m_streamThreads[0]->m_parameters.width, m_streamThreads[0]->m_parameters.height,
                     &srcCropX, &srcCropY,
@@ -4322,6 +4327,7 @@ int ExynosCameraHWInterface2::m_jpegCreator(StreamThread *selfThread, ExynosBuff
                 subParms->svcBufIndex,  subParms->svcBufStatus[subParms->svcBufIndex]);
         }
     }
+    m_jpegEncodingCount--;
     return 0;
 }
 
index d51cd254a1a61fad2cfa43cd9f464d94c6fe587e..59a808cf63db0f2d65319dff255a55588ff6b785 100644 (file)
@@ -660,6 +660,8 @@ class MainThread : public SignalDrivenThread {
     int                                 m_vdisDupFrame;
 
     mutable Mutex                       m_qbufLock;
+    mutable Mutex                       m_jpegEncoderLock;
+    int                                 m_jpegEncodingCount;
 
     bool                                m_scpForceSuspended;
     int                                 m_afState;