Add state check in cancel 61/148561/1
authorSeokHoon Lee <andy.shlee@samsung.com>
Fri, 8 Sep 2017 06:31:33 +0000 (15:31 +0900)
committerSeokHoon Lee <andy.shlee@samsung.com>
Fri, 8 Sep 2017 06:33:10 +0000 (15:33 +0900)
- Cancel api should works in recording or paused state
- remove audio io depandency

Signed-off-by: SeokHoon Lee <andy.shlee@samsung.com>
Change-Id: I3ce4a6ab0f5b9e9a4bbf80156faa9d48a919a5f5

CMakeLists.txt
packaging/capi-media-streamrecorder.spec
src/streamrecorder_private.c

index 195f9c8..cdf2b4a 100644 (file)
@@ -22,8 +22,8 @@ SET(service "media")
 SET(submodule "streamrecorder")
 
 # for package file
-SET(dependents "dlog mm-streamrecorder capi-media-audio-io capi-media-tool")
-SET(pc_dependents "capi-base-common capi-media-audio-io capi-media-tool")
+SET(dependents "dlog mm-streamrecorder capi-media-tool")
+SET(pc_dependents "capi-base-common capi-media-tool")
 
 SET(fw_name "${project_prefix}-${service}-${submodule}")
 
index a4b50b3..88e17e4 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-streamrecorder
 Summary:    A Streamrecorder library in Tizen Native API
-Version:    0.0.14
+Version:    0.0.15
 Release:    0
 Group:      Multimedia/Other
 License:    Apache-2.0
@@ -10,7 +10,6 @@ BuildRequires:  pkgconfig(dlog)
 Buildrequires:  pkgconfig(mm-streamrecorder)
 BuildRequires:  pkgconfig(capi-base-common)
 BuildRequires:  pkgconfig(capi-media-tool)
-BuildRequires:  pkgconfig(capi-media-audio-io)
 BuildRequires:  pkgconfig(libtbm)
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
index 6f7cc7b..54444fc 100644 (file)
@@ -391,13 +391,25 @@ int _streamrecorder_commit(streamrecorder_h recorder)
 
 int _streamrecorder_cancel(streamrecorder_h recorder)
 {
+       int ret = MM_ERROR_NONE;
        streamrecorder_s *handle = (streamrecorder_s *)recorder;
+       streamrecorder_state_e state = STREAMRECORDER_STATE_NONE;
 
        if (recorder == NULL) {
                LOGE("NULL pointer handle");
                return STREAMRECORDER_ERROR_INVALID_PARAMETER;
        }
 
+       ret = streamrecorder_get_state(recorder, &state);
+       if (ret != MM_ERROR_NONE) {
+               return __convert_streamrecorder_error_code(__func__, ret);
+       }
+
+       if (!(state == STREAMRECORDER_STATE_RECORDING || state == STREAMRECORDER_STATE_PAUSED)) {
+               LOGE("STREAMRECORDER_ERROR_INVALID_STATE (state:%d)", state);
+               return STREAMRECORDER_ERROR_INVALID_STATE;
+       }
+
        return __convert_streamrecorder_error_code(__func__, mm_streamrecorder_cancel(handle->mm_handle));
 }