Check state before destroy handle for video 29/157829/2 accepted/tizen/unified/20171101.064712 submit/tizen/20171031.024842
authorJeongmo Yang <jm80.yang@samsung.com>
Thu, 26 Oct 2017 10:32:06 +0000 (19:32 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Thu, 26 Oct 2017 10:37:48 +0000 (19:37 +0900)
Previously, recorder handle for video could be destroyed while recording.
Then, there is no way to stop recording, so the handle should not be destroyed while recording.

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

Change-Id: Idc3aa460673363e828a6c90e0c6cdd08a58fb469
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
legacy/src/legacy_recorder.c
packaging/mmsvc-recorder.spec

index cc5f96a..18d7555 100644 (file)
@@ -767,6 +767,20 @@ int legacy_recorder_destroy(recorder_h recorder)
        handle = (recorder_s *)recorder;
 
        if (handle->type == _RECORDER_TYPE_VIDEO) {
+               MMCamcorderStateType mm_state = MM_CAMCORDER_STATE_NONE;
+
+               /* check state */
+               ret = mm_camcorder_get_state(handle->mm_handle, &mm_state);
+               if (ret != MM_ERROR_NONE) {
+                       LOGE("get state failed 0x%x", ret);
+                       return __convert_recorder_error_code(__func__, ret);
+               }
+
+               if (mm_state >= MM_CAMCORDER_STATE_RECORDING) {
+                       LOGE("NOW RECORDING[%d], should not destroy", mm_state);
+                       return RECORDER_ERROR_INVALID_STATE;
+               }
+
                /* set to unsed */
                legacy_camera_lock(handle->mm_source.camera, true);
 
index ca28d8e..8fe93e7 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mmsvc-recorder
 Summary:    A Recorder module for muse server
-Version:    0.3.7
+Version:    0.3.8
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0