[Title] Skipped a frame after to write a buffer
authorjinhyung.jo <jinhyung.jo@samsung.com>
Mon, 3 Sep 2012 13:09:16 +0000 (22:09 +0900)
committerjinhyung.jo <jinhyung.jo@samsung.com>
Mon, 3 Sep 2012 13:09:16 +0000 (22:09 +0900)
[Type] Bugfix
[Module] Emulator / Camera
[Priority] Major
[CQ#] N_SE-8705
[Redmine#]
[Problem] Green display occurs while capture first image
[Cause] Buffer is empty.
[Solution]
[TestCase]

tizen/src/hw/maru_camera_linux_pci.c
tizen/src/hw/maru_camera_win32_pci.c

index cf5f85708f14918775c46262715158f5179eeb88..703401060487b08ac8ebec3f83a284d3d854044e 100644 (file)
@@ -192,11 +192,6 @@ static int __v4l2_grab(MaruCamState *state)
         return -1;\r
 \r
     qemu_mutex_lock(&state->thread_mutex);\r
-       if (ready_count < MARUCAM_SKIPFRAMES) {\r
-        ++ready_count; /* skip a frame cause first some frame are distorted */\r
-        qemu_mutex_unlock(&state->thread_mutex);\r
-        return 0;\r
-    }\r
     if (state->req_frame == 0) {\r
         qemu_mutex_unlock(&state->thread_mutex);\r
         return 0;\r
@@ -224,15 +219,19 @@ static int __v4l2_grab(MaruCamState *state)
     }\r
 \r
     qemu_mutex_lock(&state->thread_mutex);\r
+    if (ready_count < MARUCAM_SKIPFRAMES) {\r
+        ++ready_count; /* skip a frame cause first some frame are distorted */\r
+        qemu_mutex_unlock(&state->thread_mutex);\r
+        return 0;\r
+    }\r
     if (state->streamon == _MC_THREAD_STREAMON) {\r
         state->req_frame = 0; /* clear request */\r
         state->isr |= 0x01;   /* set a flag of rasing a interrupt */\r
         qemu_bh_schedule(state->tx_bh);\r
-               ret = 1;\r
+        ret = 1;\r
     } else {\r
         ret = -1;\r
     }\r
-\r
     qemu_mutex_unlock(&state->thread_mutex);\r
     return ret;\r
 }\r
index 98f41860f1720ab6bdd32cf963a2c009c4d6ea4b..a11eb8f90210f0fd8de1d92ac766e8f3765f48c6 100644 (file)
@@ -1061,11 +1061,6 @@ static STDMETHODIMP marucam_device_callbackfn(ULONG dwSize, BYTE *pBuffer)
     uint32_t width, height;\r
 \r
     qemu_mutex_lock(&g_state->thread_mutex);\r
-    if (ready_count < MARUCAM_SKIPFRAMES) {\r
-        ++ready_count; /* skip a frame cause first some frame are distorted */\r
-        qemu_mutex_unlock(&g_state->thread_mutex);\r
-        return S_OK;\r
-    }\r
     if (g_state->req_frame == 0) {\r
         qemu_mutex_unlock(&g_state->thread_mutex);\r
         return S_OK;\r
@@ -1089,6 +1084,11 @@ static STDMETHODIMP marucam_device_callbackfn(ULONG dwSize, BYTE *pBuffer)
     }\r
 \r
     qemu_mutex_lock(&g_state->thread_mutex);\r
+    if (ready_count < MARUCAM_SKIPFRAMES) {\r
+        ++ready_count; /* skip a frame cause first some frame are distorted */\r
+        qemu_mutex_unlock(&g_state->thread_mutex);\r
+        return S_OK;\r
+    }\r
     g_state->req_frame = 0; /* clear request */\r
     g_state->isr |= 0x01; /* set a flag raising a interrupt. */\r
     qemu_bh_schedule(g_state->tx_bh);\r