Remove timeout for handle creation API 52/114852/1
authorJeongmo Yang <jm80.yang@samsung.com>
Thu, 9 Feb 2017 07:24:06 +0000 (16:24 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Wed, 15 Feb 2017 08:45:38 +0000 (17:45 +0900)
In handle creation API, muse recorder module checks privilege for microphone use,
but it can be stuck for a long time if app does not have microphone privilege and there is no feedback for privilege popup.

[Version] 0.2.51
[Profile] Common
[Issue Type] Update
[Dependency module] N/A
[Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-3.0-mobile_20170207.1]

Change-Id: I319741ada0f39f2c6e8fbc6865d3255519f6775b
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
include/recorder_private.h
packaging/capi-media-recorder.spec
src/recorder.c

index daefa2c..504ba7f 100644 (file)
@@ -27,6 +27,7 @@ extern "C" {
 #endif
 
 #define RECORDER_CB_TIMEOUT        5
+#define RECORDER_CB_NO_TIMEOUT     0
 #define RECORDER_FILENAME_MAX      256
 
 #define RECORDER_MSG_PARAM_SET(param, msg_type, set_value) { \
index b259bfb..998374c 100644 (file)
@@ -1,7 +1,7 @@
 Name:       capi-media-recorder
 Summary:    A Recorder API
-Version:    0.2.50
-Release:    1
+Version:    0.2.51
+Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
index 1b6bd79..30a9cbe 100644 (file)
@@ -1234,16 +1234,22 @@ static int _recorder_client_wait_for_cb_return(muse_recorder_api_e api, recorder
        g_mutex_lock(&(cb_info->api_mutex[api]));
 
        if (cb_info->api_activating[api] == 0) {
-               end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_SECOND;
-               if (g_cond_wait_until(&(cb_info->api_cond[api]), &(cb_info->api_mutex[api]), end_time)) {
+               if (time_out == RECORDER_CB_NO_TIMEOUT) {
+                       LOGW("wait for api %d", api);
+                       g_cond_wait(&(cb_info->api_cond[api]), &(cb_info->api_mutex[api]));
                        ret = cb_info->api_ret[api];
                        cb_info->api_activating[api] = 0;
-
-                       /*LOGD("return value : 0x%x", ret);*/
+                       LOGW("api %d returned 0x%x", api, ret);
                } else {
-                       ret = RECORDER_ERROR_INVALID_OPERATION;
-
-                       LOGE("api %d was TIMED OUT!", api);
+                       end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_SECOND;
+                       if (g_cond_wait_until(&(cb_info->api_cond[api]), &(cb_info->api_mutex[api]), end_time)) {
+                               ret = cb_info->api_ret[api];
+                               cb_info->api_activating[api] = 0;
+                               /*LOGD("return value : 0x%x", ret);*/
+                       } else {
+                               ret = RECORDER_ERROR_INVALID_OPERATION;
+                               LOGE("api %d was TIMED OUT!", api);
+                       }
                }
        } else {
                ret = cb_info->api_ret[api];
@@ -1545,7 +1551,7 @@ static int _recorder_create_common(recorder_h *recorder, muse_recorder_type_e ty
 
        sock_fd = -1;
 
-       ret = _recorder_client_wait_for_cb_return(MUSE_RECORDER_API_CREATE, pc->cb_info, RECORDER_CB_TIMEOUT);
+       ret = _recorder_client_wait_for_cb_return(MUSE_RECORDER_API_CREATE, pc->cb_info, RECORDER_CB_NO_TIMEOUT);
 
        pc->cb_info->api_waiting[MUSE_RECORDER_API_CREATE] = 0;