Stop evas rendering when change preview resolution while previewing 35/96035/1
authorJeongmo Yang <jm80.yang@samsung.com>
Mon, 7 Nov 2016 11:14:56 +0000 (20:14 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Mon, 7 Nov 2016 11:14:56 +0000 (20:14 +0900)
Without stopping evas rendering, the last camera buffer will not returned to camerasrc,
so timeout is occurred in camerasrc.

[Version] 0.2.83
[Profile] Common
[Issue Type] Bug fix
[Dependency module] N/A
[Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-mobile_20161101.3]

Change-Id: I5f8aeac23b11a0887b926717b9f5c17967f468b0
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
packaging/capi-media-camera.spec
src/camera.c

index 08a950d..0deac73 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-camera
 Summary:    A Camera API
-Version:    0.2.82
+Version:    0.2.83
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 9ece7f4..7d3db69 100644 (file)
@@ -3196,6 +3196,7 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ
 int camera_set_preview_resolution(camera_h camera, int width, int height)
 {
        int ret = CAMERA_ERROR_NONE;
+       camera_state_e current_state = CAMERA_STATE_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION;
        camera_msg_param param;
@@ -3206,6 +3207,20 @@ int camera_set_preview_resolution(camera_h camera, int width, int height)
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
 
+       if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
+               ret = camera_get_state(camera, &current_state);
+               if (ret != CAMERA_ERROR_NONE) {
+                       LOGE("failed to get current state 0x%x", ret);
+                       return ret;
+               }
+
+               if (current_state == CAMERA_STATE_PREVIEW) {
+                       ret = _camera_stop_evas_rendering(camera, false);
+                       if (ret != CAMERA_ERROR_NONE)
+                               return ret;
+               }
+       }
+
        value = (width << 16) | height;
        CAMERA_MSG_PARAM_SET(param, INT, value);
 
@@ -3215,6 +3230,11 @@ int camera_set_preview_resolution(camera_h camera, int width, int height)
 
        LOGD("ret : 0x%x", ret);
 
+       if (current_state == CAMERA_STATE_PREVIEW) {
+               LOGW("restart evas rendering");
+               _camera_start_evas_rendering(camera);
+       }
+
        return ret;
 }