From: Seungbae Shin Date: Tue, 13 Sep 2016 10:29:57 +0000 (+0900) Subject: Check mic feature when setting session type to voip X-Git-Tag: accepted/tizen/common/20160921.162155~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=330c8a0d2109176f5470fdcb29f1e1ef2b97b9d3;p=platform%2Fcore%2Fapi%2Fsound-manager.git Check mic feature when setting session type to voip This code is from tizen 2.4 which is added recently [Version] 0.3.64 [Profile] Common [Issue Type] TC Change-Id: Id81f096240c05abac1d49f9e5b75e94f6b8992e4 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index ffce898..4d67822 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ SET(service "media") SET(submodule "sound-manager") # for package file -SET(dependents "mm-sound dlog capi-base-common mm-session libpulse gio-2.0 vconf") +SET(dependents "mm-sound dlog capi-base-common mm-session libpulse gio-2.0 vconf capi-system-info") SET(pc_dependents "capi-base-common") # for deb diff --git a/packaging/capi-media-sound-manager.spec b/packaging/capi-media-sound-manager.spec index 6fa8374..fc646e0 100755 --- a/packaging/capi-media-sound-manager.spec +++ b/packaging/capi-media-sound-manager.spec @@ -1,6 +1,6 @@ Name: capi-media-sound-manager Summary: Sound Manager library -Version: 0.3.63 +Version: 0.3.64 Release: 0 Group: Multimedia/API License: Apache-2.0 @@ -14,6 +14,7 @@ BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(libpulse) BuildRequires: pkgconfig(gio-2.0) +BuildRequires: pkgconfig(capi-system-info) Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig diff --git a/src/sound_manager.c b/src/sound_manager.c index 82b934a..aae3c41 100644 --- a/src/sound_manager.c +++ b/src/sound_manager.c @@ -16,7 +16,9 @@ #include "sound_manager.h" #include "sound_manager_private.h" +#include +#define FEATURE_MICROPHONE "http://tizen.org/feature/microphone" _session_interrupt_info_s g_session_interrupt_cb_table = {0, 0, NULL, NULL}; _volume_changed_info_s g_volume_changed_cb_table = {0, NULL, NULL}; @@ -470,12 +472,21 @@ int sound_manager_set_session_type(sound_session_type_e type) int ret = MM_ERROR_NONE; int cur_session = -1; int new_session = MM_SESSION_TYPE_MEDIA; + bool mic_enable = false; LOGI(">> enter : type=%d", type); if (type < SOUND_SESSION_TYPE_MEDIA || type > SOUND_SESSION_TYPE_VOIP) return _convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT); + /* If session type is VOIP but MIC is not enabled, return false */ + if (type == SOUND_SESSION_TYPE_VOIP) { + ret = system_info_get_platform_bool(FEATURE_MICROPHONE, &mic_enable); + LOGI("system_info_platform [%s]=[%d], ret[%d]", FEATURE_MICROPHONE, mic_enable, ret); + if (ret != SYSTEM_INFO_ERROR_NONE || !mic_enable) + return _convert_sound_manager_error_code(__func__, MM_ERROR_NOT_SUPPORT_API); + } + /* it is not supported both session and stream feature at the same time */ if (g_stream_info_count) { LOGE("Could not set this type(%d) because of being used stream feature", type);