From 183c240139c8817936724a71c719e14306aed6c3 Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Tue, 2 May 2017 13:15:29 +0900 Subject: [PATCH] Check acquired focus type for backward compatibility of session [Version] 0.10.118 [Profile] Common [Issue Type] Update [Dependency module] N/A [Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-unified_20170427.3] Change-Id: Id5b1114abefb243c382af78b4d16ee691ef5fbe8 Signed-off-by: Jeongmo Yang --- packaging/libmm-camcorder.spec | 2 +- src/mm_camcorder_internal.c | 34 ++++++++++++++++++++++++++++++++++ src/mm_camcorder_videorec.c | 4 +--- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/packaging/libmm-camcorder.spec b/packaging/libmm-camcorder.spec index ecb71f7..16e5d05 100644 --- a/packaging/libmm-camcorder.spec +++ b/packaging/libmm-camcorder.spec @@ -1,6 +1,6 @@ Name: libmm-camcorder Summary: Camera and recorder library -Version: 0.10.117 +Version: 0.10.118 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/mm_camcorder_internal.c b/src/mm_camcorder_internal.c index 855f456..741cc35 100644 --- a/src/mm_camcorder_internal.c +++ b/src/mm_camcorder_internal.c @@ -869,6 +869,9 @@ int _mmcamcorder_realize(MMHandleType handle) int app_pid = 0; int resource_count = 0; #endif /* _MMCAMCORDER_RM_SUPPORT */ + char *stream_type = NULL; + char *ext_info = NULL; + int option = 0; mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); @@ -933,6 +936,37 @@ int _mmcamcorder_realize(MMHandleType handle) /* do nothing */ _mmcam_dbg_log("SESSION_UNINTERRUPTIBLE - do nothing for sound focus"); } else { + /* check previous acquired focus */ + ret = mm_sound_get_stream_type_of_acquired_focus(FOCUS_FOR_BOTH, &stream_type, &option, &ext_info); + if (ret == MM_ERROR_NONE && stream_type) { + if (!strcmp(stream_type, "alarm") || + !strcmp(stream_type, "ringtone-voip") || + !strcmp(stream_type, "ringtone-call") || + !strcmp(stream_type, "voip") || + !strcmp(stream_type, "call-voice") || + !strcmp(stream_type, "call-video")) { + _mmcam_dbg_err("Blocked by session policy, stream_type [%s]", stream_type); + ret = MM_ERROR_POLICY_BLOCKED; + } + } else { + _mmcam_dbg_err("get stream type failed 0x%x, stream type %s", + ret, stream_type ? stream_type : "NULL"); + ret = MM_ERROR_POLICY_BLOCKED; + } + + if (stream_type) { + free(stream_type); + stream_type = NULL; + } + + if (ext_info) { + free(ext_info); + ext_info = NULL; + } + + if (ret != MM_ERROR_NONE) + goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; + /* unset remained watch cb */ if (hcamcorder->sound_focus_watch_id > 0) { mm_sound_unset_focus_watch_callback(hcamcorder->sound_focus_watch_id); diff --git a/src/mm_camcorder_videorec.c b/src/mm_camcorder_videorec.c index 70badfc..fee3fe5 100644 --- a/src/mm_camcorder_videorec.c +++ b/src/mm_camcorder_videorec.c @@ -407,8 +407,6 @@ int _mmcamcorder_remove_encode_pipeline(MMHandleType handle) _MMCAMCORDER_LOCK_RESOURCE(hcamcorder); if (resource_manager->is_release_cb_calling == FALSE) { - gint64 end_time = 0; - /* release resource */ ret = _mmcamcorder_resource_manager_release(resource_manager); @@ -416,8 +414,8 @@ int _mmcamcorder_remove_encode_pipeline(MMHandleType handle) #ifdef _MMCAMCORDER_MURPHY_WAIT_TO_RELEASE_SUB_RESOURCE if (resource_manager->acquire_remain < resource_manager->acquire_count) { /* wait for resource release */ + gint64 end_time = g_get_monotonic_time() + (__MMCAMCORDER_RESOURCE_WAIT_TIME * G_TIME_SPAN_SECOND); _mmcam_dbg_log("resource is not released all. wait for signal..."); - end_time = g_get_monotonic_time() + (__MMCAMCORDER_RESOURCE_WAIT_TIME * G_TIME_SPAN_SECOND); _MMCAMCORDER_RESOURCE_WAIT_UNTIL(hcamcorder, end_time); } #endif /* _MMCAMCORDER_MURPHY_WAIT_TO_RELEASE_SUB_RESOURCE */ -- 2.34.1