From: jinhyung.jo Date: Mon, 3 Sep 2012 13:09:16 +0000 (+0900) Subject: [Title] Skipped a frame after to write a buffer X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~1444^2~38^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d0f0c175503e02141e952d48d3ea2e332a19f0ac;p=sdk%2Femulator%2Fqemu.git [Title] Skipped a frame after to write a buffer [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] --- diff --git a/tizen/src/hw/maru_camera_linux_pci.c b/tizen/src/hw/maru_camera_linux_pci.c index cf5f85708f..7034010604 100644 --- a/tizen/src/hw/maru_camera_linux_pci.c +++ b/tizen/src/hw/maru_camera_linux_pci.c @@ -192,11 +192,6 @@ static int __v4l2_grab(MaruCamState *state) return -1; qemu_mutex_lock(&state->thread_mutex); - if (ready_count < MARUCAM_SKIPFRAMES) { - ++ready_count; /* skip a frame cause first some frame are distorted */ - qemu_mutex_unlock(&state->thread_mutex); - return 0; - } if (state->req_frame == 0) { qemu_mutex_unlock(&state->thread_mutex); return 0; @@ -224,15 +219,19 @@ static int __v4l2_grab(MaruCamState *state) } qemu_mutex_lock(&state->thread_mutex); + if (ready_count < MARUCAM_SKIPFRAMES) { + ++ready_count; /* skip a frame cause first some frame are distorted */ + qemu_mutex_unlock(&state->thread_mutex); + return 0; + } if (state->streamon == _MC_THREAD_STREAMON) { state->req_frame = 0; /* clear request */ state->isr |= 0x01; /* set a flag of rasing a interrupt */ qemu_bh_schedule(state->tx_bh); - ret = 1; + ret = 1; } else { ret = -1; } - qemu_mutex_unlock(&state->thread_mutex); return ret; } diff --git a/tizen/src/hw/maru_camera_win32_pci.c b/tizen/src/hw/maru_camera_win32_pci.c index 98f41860f1..a11eb8f902 100644 --- a/tizen/src/hw/maru_camera_win32_pci.c +++ b/tizen/src/hw/maru_camera_win32_pci.c @@ -1061,11 +1061,6 @@ static STDMETHODIMP marucam_device_callbackfn(ULONG dwSize, BYTE *pBuffer) uint32_t width, height; qemu_mutex_lock(&g_state->thread_mutex); - if (ready_count < MARUCAM_SKIPFRAMES) { - ++ready_count; /* skip a frame cause first some frame are distorted */ - qemu_mutex_unlock(&g_state->thread_mutex); - return S_OK; - } if (g_state->req_frame == 0) { qemu_mutex_unlock(&g_state->thread_mutex); return S_OK; @@ -1089,6 +1084,11 @@ static STDMETHODIMP marucam_device_callbackfn(ULONG dwSize, BYTE *pBuffer) } qemu_mutex_lock(&g_state->thread_mutex); + if (ready_count < MARUCAM_SKIPFRAMES) { + ++ready_count; /* skip a frame cause first some frame are distorted */ + qemu_mutex_unlock(&g_state->thread_mutex); + return S_OK; + } g_state->req_frame = 0; /* clear request */ g_state->isr |= 0x01; /* set a flag raising a interrupt. */ qemu_bh_schedule(g_state->tx_bh);