From 4a2e0bcca6dc53df95430cb0e07ad5586793ab57 Mon Sep 17 00:00:00 2001 From: Sangchul Lee Date: Wed, 7 Mar 2018 12:57:10 +0900 Subject: [PATCH] Remove codes related to session backward compatibility dependency of mm-sound is removed also. attribute of "pid-for-sound-focus" is renamed to "client-pid". rename variable of asm_lock to interrupt_lock. [Version] 0.10.154 [Profile] Common [Issue Type] Clean-up Change-Id: I6717b7e26889eae5fc56b4863ea1aae435ac1ded Signed-off-by: Sangchul Lee --- configure.ac | 8 - packaging/libmm-camcorder.spec | 3 +- src/Makefile.am | 2 - src/include/mm_camcorder.h | 6 +- src/include/mm_camcorder_attribute.h | 3 +- src/include/mm_camcorder_internal.h | 31 +-- src/include/mm_camcorder_stillshot.h | 1 - src/mm_camcorder.c | 40 ++-- src/mm_camcorder_attribute.c | 103 +-------- src/mm_camcorder_internal.c | 396 ++--------------------------------- src/mm_camcorder_sound.c | 2 - src/mm_camcorder_stillshot.c | 3 +- src/mm_camcorder_util.c | 1 - src/mm_camcorder_videorec.c | 20 +- 14 files changed, 53 insertions(+), 566 deletions(-) diff --git a/configure.ac b/configure.ac index 060ba1d..3afe858 100644 --- a/configure.ac +++ b/configure.ac @@ -58,10 +58,6 @@ AC_SUBST(MM_RESOURCE_MANAGER_LIBS) fi AM_CONDITIONAL([MM_RESOURCE_MANAGER_SUPPORT], [test "x$MM_RESOURCE_MANAGER_SUPPORT" = "xyes"]) -PKG_CHECK_MODULES(MM_SOUND, mm-sound) -AC_SUBST(MM_SOUND_CFLAGS) -AC_SUBST(MM_SOUND_LIBS) - PKG_CHECK_MODULES(EXIF, libexif) AC_SUBST(EXIF_CFLAGS) AC_SUBST(EXIF_LIBS) @@ -74,10 +70,6 @@ PKG_CHECK_MODULES(GIO, gio-2.0) AC_SUBST(GIO_CFLAGS) AC_SUBST(GIO_LIBS) -PKG_CHECK_MODULES(MMSOUND, mm-sound) -AC_SUBST(MMSOUND_CFLAGS) -AC_SUBST(MMSOUND_LIBS) - PKG_CHECK_MODULES(MMUTIL_IMGP, mmutil-imgp) AC_SUBST(MMUTIL_IMGP_CFLAGS) AC_SUBST(MMUTIL_IMGP_LIBS) diff --git a/packaging/libmm-camcorder.spec b/packaging/libmm-camcorder.spec index aa38ad9..195a9d6 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.153 +Version: 0.10.154 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 @@ -11,7 +11,6 @@ BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(gio-2.0) BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(mm-common) -BuildRequires: pkgconfig(mm-sound) BuildRequires: pkgconfig(libexif) BuildRequires: pkgconfig(mmutil-imgp) BuildRequires: pkgconfig(mmutil-jpeg) diff --git a/src/Makefile.am b/src/Makefile.am index a3e1fcc..de5b06f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -39,7 +39,6 @@ libmmfcamcorder_la_CFLAGS = -I$(srcdir)/include \ $(GST_APP_CFLAGS) \ $(EXIF_CFLAGS) \ $(MM_COMMON_CFLAGS) \ - $(MMSOUND_CFLAGS) \ $(VCONF_CFLAGS) \ $(MMUTIL_IMGP_CFLAGS) \ $(MMUTIL_JPEG_CFLAGS) \ @@ -59,7 +58,6 @@ libmmfcamcorder_la_LIBADD = \ $(GST_APP_LIBS) \ $(MM_COMMON_LIBS) \ $(EXIF_LIBS) \ - $(MMSOUND_LIBS) \ $(VCONF_LIBS) \ $(MMUTIL_IMGP_LIBS) \ $(MMUTIL_JPEG_LIBS) \ diff --git a/src/include/mm_camcorder.h b/src/include/mm_camcorder.h index 9ca12b0..3e32465 100644 --- a/src/include/mm_camcorder.h +++ b/src/include/mm_camcorder.h @@ -1238,9 +1238,9 @@ extern "C" { #define MMCAM_DISPLAY_SOCKET_PATH "display-socket-path" /** - * PID for sound focus + * Client PID */ -#define MMCAM_PID_FOR_SOUND_FOCUS "pid-for-sound-focus" +#define MMCAM_CLIENT_PID "client-pid" /** * Root directory of application @@ -2223,8 +2223,6 @@ int mm_camcorder_realize(MMHandleType camcorder); * Most important resource that is released here is gstreamer pipeline of mm_camcorder. * Because most of resources, such as camera device, video display device, and audio I/O device, are operating on the gstreamer pipeline, * this function should be called to release its resources. - * Moreover, mm_camcorder is controlled by audio session manager. If an user doesn't call this function when he want to release mm_camcorder, - * other multimedia frameworks may face session problem. For more detail information, please refer mm_session module. * * @param[in] camcorder A handle of camcorder. * @return This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n diff --git a/src/include/mm_camcorder_attribute.h b/src/include/mm_camcorder_attribute.h index c28ada7..87afe27 100644 --- a/src/include/mm_camcorder_attribute.h +++ b/src/include/mm_camcorder_attribute.h @@ -179,7 +179,7 @@ typedef enum { MM_CAM_ENCODED_PREVIEW_GOP_INTERVAL, MM_CAM_RECORDER_TAG_ENABLE, MM_CAM_DISPLAY_SOCKET_PATH, - MM_CAM_PID_FOR_SOUND_FOCUS, + MM_CAM_CLIENT_PID, MM_CAM_ROOT_DIRECTORY, MM_CAM_SOUND_STREAM_INDEX, MM_CAM_SOUND_STREAM_TYPE, @@ -387,7 +387,6 @@ bool _mmcamcorder_commit_camera_flip(MMHandleType handle, int attr_idx, const mm bool _mmcamcorder_commit_camera_hdr_capture(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_encoded_preview_bitrate(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_encoded_preview_gop_interval(MMHandleType handle, int attr_idx, const mmf_value_t *value); -bool _mmcamcorder_commit_pid_for_sound_focus(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_sound_stream_info(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_tag(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_audio_replay_gain(MMHandleType handle, int attr_idx, const mmf_value_t *value); diff --git a/src/include/mm_camcorder_internal.h b/src/include/mm_camcorder_internal.h index 9c15b4a..ea73e6a 100644 --- a/src/include/mm_camcorder_internal.h +++ b/src/include/mm_camcorder_internal.h @@ -34,9 +34,6 @@ #include #include #include -#include -#include -#include #include #include #include @@ -395,11 +392,11 @@ do { \ #define _MMCAMCORDER_CMD_WAIT_UNTIL(handle, end_time) g_cond_wait_until(&_MMCAMCORDER_GET_CMD_COND(handle), &_MMCAMCORDER_GET_CMD_LOCK(handle), end_time) #define _MMCAMCORDER_CMD_SIGNAL(handle) g_cond_signal(&_MMCAMCORDER_GET_CMD_COND(handle)); -/* for ASM */ -#define _MMCAMCORDER_GET_ASM_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).asm_lock) -#define _MMCAMCORDER_LOCK_ASM(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_ASM_LOCK(handle)) -#define _MMCAMCORDER_TRYLOCK_ASM(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_ASM_LOCK(handle)) -#define _MMCAMCORDER_UNLOCK_ASM(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_ASM_LOCK(handle)) +/* for interruption */ +#define _MMCAMCORDER_GET_INTERRUPT_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).interrupt_lock) +#define _MMCAMCORDER_LOCK_INTERRUPT(handle) _MMCAMCORDER_LOCK_FUNC(_MMCAMCORDER_GET_INTERRUPT_LOCK(handle)) +#define _MMCAMCORDER_TRYLOCK_INTERRUPT(handle) _MMCAMCORDER_TRYLOCK_FUNC(_MMCAMCORDER_GET_INTERRUPT_LOCK(handle)) +#define _MMCAMCORDER_UNLOCK_INTERRUPT(handle) _MMCAMCORDER_UNLOCK_FUNC(_MMCAMCORDER_GET_INTERRUPT_LOCK(handle)) /* for state change */ #define _MMCAMCORDER_GET_STATE_LOCK(handle) (_MMCAMCORDER_CAST_MTSAFE(handle).state_lock) @@ -611,7 +608,6 @@ typedef enum { */ typedef enum { _MMCAMCORDER_STATE_CHANGE_NORMAL = 0, - _MMCAMCORDER_STATE_CHANGE_BY_FOCUS, _MMCAMCORDER_STATE_CHANGE_BY_RM, _MMCAMCORDER_STATE_CHANGE_BY_DPM, _MMCAMCORDER_STATE_CHANGE_BY_STORAGE @@ -649,7 +645,7 @@ typedef struct { GCond cond; /**< Condition (for general use) */ GMutex cmd_lock; /**< Mutex (for command) */ GCond cmd_cond; /**< Condition (for command) */ - GMutex asm_lock; /**< Mutex (for ASM) */ + GMutex interrupt_lock; /**< Mutex (for interruption) */ GMutex state_lock; /**< Mutex (for state change) */ GMutex gst_state_lock; /**< Mutex (for gst pipeline state change) */ GMutex gst_encode_state_lock; /**< Mutex (for gst encode pipeline state change) */ @@ -784,14 +780,7 @@ typedef struct mmf_camcorder { int capture_sound_count; /**< count for capture sound */ char *root_directory; /**< Root directory for device */ int resolution_changed; /**< Flag for preview resolution change */ - int sound_focus_register; /**< Use sound focus internally */ - int sound_focus_id; /**< id for sound focus */ - int sound_focus_watch_id; /**< id for sound focus watch */ - unsigned int sound_focus_subscribe_id; /**< subscribe id for sound focus signal */ int interrupt_code; /**< Interrupt code */ - int acquired_focus; /**< Current acquired focus */ - int session_type; /**< Session type */ - int session_flags; /**< Session flags */ int recreate_decoder; /**< Flag of decoder element recreation for encoded preview format */ _MMCamcorderInfoConverting caminfo_convert[CAMINFO_CONVERT_NUM]; /**< converting structure of camera info */ @@ -1295,14 +1284,8 @@ void _mmcamcorder_video_current_framerate_init(MMHandleType handle); int _mmcamcorder_video_current_framerate(MMHandleType handle); int _mmcamcorder_video_average_framerate(MMHandleType handle); -/* sound focus related function */ +/* for stopping forcedly */ void __mmcamcorder_force_stop(mmf_camcorder_t *hcamcorder, int state_change_by_system); -void _mmcamcorder_sound_focus_cb(int id, mm_sound_focus_type_e focus_type, - mm_sound_focus_state_e focus_state, const char *reason_for_change, - int option, const char *additional_info, void *user_data); -void _mmcamcorder_sound_focus_watch_cb(int id, mm_sound_focus_type_e focus_type, mm_sound_focus_state_e focus_state, - const char *reason_for_change, const char *additional_info, void *user_data); -void _mmcamcorder_sound_signal_callback(mm_sound_signal_name_t signal, int value, void *user_data); /* device policy manager */ void _mmcamcorder_dpm_camera_policy_changed_cb(const char *name, const char *value, void *user_data); diff --git a/src/include/mm_camcorder_stillshot.h b/src/include/mm_camcorder_stillshot.h index 58a9a62..a2c50e9 100644 --- a/src/include/mm_camcorder_stillshot.h +++ b/src/include/mm_camcorder_stillshot.h @@ -27,7 +27,6 @@ ========================================================================================*/ #include #include -#include #ifdef __cplusplus extern "C" { diff --git a/src/mm_camcorder.c b/src/mm_camcorder.c index 384153b..f5aa216 100644 --- a/src/mm_camcorder.c +++ b/src/mm_camcorder.c @@ -87,7 +87,7 @@ int mm_camcorder_realize(MMHandleType camcorder) _mmcam_dbg_err(""); - _MMCAMCORDER_LOCK_ASM(camcorder); + _MMCAMCORDER_LOCK_INTERRUPT(camcorder); traceBegin(TTRACE_TAG_CAMERA, "MMCAMCORDER:REALIZE"); @@ -95,7 +95,7 @@ int mm_camcorder_realize(MMHandleType camcorder) traceEnd(TTRACE_TAG_CAMERA); - _MMCAMCORDER_UNLOCK_ASM(camcorder); + _MMCAMCORDER_UNLOCK_INTERRUPT(camcorder); _mmcam_dbg_err("END"); @@ -111,7 +111,7 @@ int mm_camcorder_unrealize(MMHandleType camcorder) _mmcam_dbg_err(""); - _MMCAMCORDER_LOCK_ASM(camcorder); + _MMCAMCORDER_LOCK_INTERRUPT(camcorder); traceBegin(TTRACE_TAG_CAMERA, "MMCAMCORDER:UNREALIZE"); @@ -119,7 +119,7 @@ int mm_camcorder_unrealize(MMHandleType camcorder) traceEnd(TTRACE_TAG_CAMERA); - _MMCAMCORDER_UNLOCK_ASM(camcorder); + _MMCAMCORDER_UNLOCK_INTERRUPT(camcorder); _mmcam_dbg_err("END"); @@ -135,7 +135,7 @@ int mm_camcorder_start(MMHandleType camcorder) _mmcam_dbg_err(""); - _MMCAMCORDER_LOCK_ASM(camcorder); + _MMCAMCORDER_LOCK_INTERRUPT(camcorder); traceBegin(TTRACE_TAG_CAMERA, "MMCAMCORDER:START"); @@ -143,7 +143,7 @@ int mm_camcorder_start(MMHandleType camcorder) traceEnd(TTRACE_TAG_CAMERA); - _MMCAMCORDER_UNLOCK_ASM(camcorder); + _MMCAMCORDER_UNLOCK_INTERRUPT(camcorder); _mmcam_dbg_err("END"); @@ -159,7 +159,7 @@ int mm_camcorder_stop(MMHandleType camcorder) _mmcam_dbg_err(""); - _MMCAMCORDER_LOCK_ASM(camcorder); + _MMCAMCORDER_LOCK_INTERRUPT(camcorder); traceBegin(TTRACE_TAG_CAMERA, "MMCAMCORDER:STOP"); @@ -167,7 +167,7 @@ int mm_camcorder_stop(MMHandleType camcorder) traceEnd(TTRACE_TAG_CAMERA); - _MMCAMCORDER_UNLOCK_ASM(camcorder); + _MMCAMCORDER_UNLOCK_INTERRUPT(camcorder); _mmcam_dbg_err("END"); @@ -183,11 +183,11 @@ int mm_camcorder_capture_start(MMHandleType camcorder) _mmcam_dbg_err(""); - _MMCAMCORDER_LOCK_ASM(camcorder); + _MMCAMCORDER_LOCK_INTERRUPT(camcorder); error = _mmcamcorder_capture_start(camcorder); - _MMCAMCORDER_UNLOCK_ASM(camcorder); + _MMCAMCORDER_UNLOCK_INTERRUPT(camcorder); _mmcam_dbg_err("END"); @@ -203,11 +203,11 @@ int mm_camcorder_capture_stop(MMHandleType camcorder) _mmcam_dbg_err(""); - _MMCAMCORDER_LOCK_ASM(camcorder); + _MMCAMCORDER_LOCK_INTERRUPT(camcorder); error = _mmcamcorder_capture_stop(camcorder); - _MMCAMCORDER_UNLOCK_ASM(camcorder); + _MMCAMCORDER_UNLOCK_INTERRUPT(camcorder); _mmcam_dbg_err("END"); @@ -223,11 +223,11 @@ int mm_camcorder_record(MMHandleType camcorder) _mmcam_dbg_err(""); - _MMCAMCORDER_LOCK_ASM(camcorder); + _MMCAMCORDER_LOCK_INTERRUPT(camcorder); error = _mmcamcorder_record(camcorder); - _MMCAMCORDER_UNLOCK_ASM(camcorder); + _MMCAMCORDER_UNLOCK_INTERRUPT(camcorder); _mmcam_dbg_err("END"); @@ -243,11 +243,11 @@ int mm_camcorder_pause(MMHandleType camcorder) _mmcam_dbg_err(""); - _MMCAMCORDER_LOCK_ASM(camcorder); + _MMCAMCORDER_LOCK_INTERRUPT(camcorder); error = _mmcamcorder_pause(camcorder); - _MMCAMCORDER_UNLOCK_ASM(camcorder); + _MMCAMCORDER_UNLOCK_INTERRUPT(camcorder); _mmcam_dbg_err("END"); @@ -263,11 +263,11 @@ int mm_camcorder_commit(MMHandleType camcorder) _mmcam_dbg_err(""); - _MMCAMCORDER_LOCK_ASM(camcorder); + _MMCAMCORDER_LOCK_INTERRUPT(camcorder); error = _mmcamcorder_commit(camcorder); - _MMCAMCORDER_UNLOCK_ASM(camcorder); + _MMCAMCORDER_UNLOCK_INTERRUPT(camcorder); _mmcam_dbg_err("END"); @@ -283,11 +283,11 @@ int mm_camcorder_cancel(MMHandleType camcorder) _mmcam_dbg_err(""); - _MMCAMCORDER_LOCK_ASM(camcorder); + _MMCAMCORDER_LOCK_INTERRUPT(camcorder); error = _mmcamcorder_cancel(camcorder); - _MMCAMCORDER_UNLOCK_ASM(camcorder); + _MMCAMCORDER_UNLOCK_INTERRUPT(camcorder); _mmcam_dbg_err("END"); diff --git a/src/mm_camcorder_attribute.c b/src/mm_camcorder_attribute.c index fb85d7b..5e11308 100644 --- a/src/mm_camcorder_attribute.c +++ b/src/mm_camcorder_attribute.c @@ -1512,15 +1512,15 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info) NULL, }, { - MM_CAM_PID_FOR_SOUND_FOCUS, - "pid-for-sound-focus", + MM_CAM_CLIENT_PID, + "client-pid", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, {.int_min = 0}, {.int_max = _MMCAMCORDER_MAX_INT}, - _mmcamcorder_commit_pid_for_sound_focus, + NULL, }, { MM_CAM_ROOT_DIRECTORY, @@ -4528,100 +4528,6 @@ bool _mmcamcorder_commit_encoded_preview_gop_interval(MMHandleType handle, int a } -bool _mmcamcorder_commit_pid_for_sound_focus(MMHandleType handle, int attr_idx, const mmf_value_t *value) -{ - int new_pid = 0; - int ret = 0; - int current_state = MM_CAMCORDER_STATE_NONE; - mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - - mmf_return_val_if_fail(hcamcorder && value, FALSE); - - /* state check */ - current_state = _mmcamcorder_get_state(handle); - if (current_state > MM_CAMCORDER_STATE_NULL) { - _mmcam_dbg_log("invalid state %d", current_state); - hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE; - return FALSE; - } - - new_pid = value->value.i_val; - - _mmcam_dbg_warn("Commit : pid %d, current focus id %d, subscribe id %u", - new_pid, hcamcorder->sound_focus_id, hcamcorder->sound_focus_subscribe_id); - - /* unregister sound focus and unsubscribe sound signal before set new one */ - if (hcamcorder->sound_focus_id > 0) { - mm_sound_unregister_focus(hcamcorder->sound_focus_id); - _mmcam_dbg_log("unregister sound focus done"); - hcamcorder->sound_focus_id = 0; - } - - if (hcamcorder->sound_focus_subscribe_id > 0) { - mm_sound_unsubscribe_signal(hcamcorder->sound_focus_subscribe_id); - _mmcam_dbg_log("unsubscribe sound signal done"); - hcamcorder->sound_focus_subscribe_id = 0; - } - - ret = _mm_session_util_read_information(new_pid, &hcamcorder->session_type, &hcamcorder->session_flags); - if (ret == MM_ERROR_NONE) { - if (hcamcorder->session_type == MM_SESSION_TYPE_REPLACED_BY_STREAM) { - hcamcorder->sound_focus_register = FALSE; - _mmcam_dbg_warn("no need to use sound focus internally"); - } else { - /* check my session type : allow only media & call series here */ - if ((hcamcorder->session_type != MM_SESSION_TYPE_MEDIA) && - (hcamcorder->session_type != MM_SESSION_TYPE_MEDIA_RECORD) && - (hcamcorder->session_type != MM_SESSION_TYPE_CALL) && - (hcamcorder->session_type != MM_SESSION_TYPE_VIDEOCALL) && - (hcamcorder->session_type != MM_SESSION_TYPE_VOIP)) { - _mmcam_dbg_err("Blocked by session policy, my session_type[%s]", hcamcorder->session_type); - hcamcorder->error_code = MM_ERROR_POLICY_BLOCKED; - return FALSE; - } - - ret = mm_sound_focus_get_id(&hcamcorder->sound_focus_id); - if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("mm_sound_focus_get_id failed"); - hcamcorder->error_code = MM_ERROR_POLICY_BLOCKED; - return FALSE; - } - - ret = mm_sound_register_focus_for_session(hcamcorder->sound_focus_id, - new_pid, "media", _mmcamcorder_sound_focus_cb, hcamcorder); - if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("mm_sound_register_focus_for_session failed 0x%x", ret); - hcamcorder->sound_focus_id = 0; - hcamcorder->error_code = MM_ERROR_POLICY_BLOCKED; - return FALSE; - } - - hcamcorder->sound_focus_register = TRUE; - - _mmcam_dbg_log("mm_sound_register_focus_for_session done - id %d, session type %d, flags 0x%x", - hcamcorder->sound_focus_id, hcamcorder->session_type, hcamcorder->session_flags); - } - } else { - hcamcorder->session_type = 0; - hcamcorder->session_flags = 0; - hcamcorder->sound_focus_register = TRUE; - - _mmcam_dbg_warn("read session info failed. sound focus watch cb will be set."); - - ret = mm_sound_subscribe_signal_for_daemon(MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS, - new_pid, &hcamcorder->sound_focus_subscribe_id, - (mm_sound_signal_callback)_mmcamcorder_sound_signal_callback, (void*)hcamcorder); - if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("subscribe sound signal failed [0x%x]", ret); - hcamcorder->error_code = MM_ERROR_POLICY_BLOCKED; - return FALSE; - } - } - - return TRUE; -} - - bool _mmcamcorder_commit_sound_stream_info(MMHandleType handle, int attr_idx, const mmf_value_t *value) { int stream_index = 0; @@ -4644,9 +4550,6 @@ bool _mmcamcorder_commit_sound_stream_info(MMHandleType handle, int attr_idx, co return FALSE; } - /* unset watch callback if existed */ - _mmcamcorder_sound_signal_callback(MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS, 1, (void *)handle); - sc = MMF_CAMCORDER_SUBCONTEXT(handle); if (!sc || !sc->encode_element || !sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst) { diff --git a/src/mm_camcorder_internal.c b/src/mm_camcorder_internal.c index 7a5169d..0255c0b 100644 --- a/src/mm_camcorder_internal.c +++ b/src/mm_camcorder_internal.c @@ -72,7 +72,6 @@ static gint __mmcamcorder_gst_handle_library_error(MMHandleType handle, int static gint __mmcamcorder_gst_handle_core_error(MMHandleType handle, int code, GstMessage *message); static gint __mmcamcorder_gst_handle_resource_warning(MMHandleType handle, GstMessage *message , GError *error); static gboolean __mmcamcorder_handle_gst_warning(MMHandleType handle, GstMessage *message, GError *error); -static int __mmcamcorder_simulate_asm_conflict_table(int session_type, int pid); #ifdef _MMCAMCORDER_MM_RM_SUPPORT static int __mmcamcorder_resource_release_cb(mm_resource_manager_h rm, @@ -126,13 +125,12 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info) hcamcorder->sub_context = NULL; hcamcorder->old_state = MM_CAMCORDER_STATE_NONE; hcamcorder->capture_in_recording = FALSE; - hcamcorder->session_type = MM_SESSION_TYPE_MEDIA; g_mutex_init(&(hcamcorder->mtsafe).lock); g_cond_init(&(hcamcorder->mtsafe).cond); g_mutex_init(&(hcamcorder->mtsafe).cmd_lock); g_cond_init(&(hcamcorder->mtsafe).cmd_cond); - g_mutex_init(&(hcamcorder->mtsafe).asm_lock); + g_mutex_init(&(hcamcorder->mtsafe).interrupt_lock); g_mutex_init(&(hcamcorder->mtsafe).state_lock); g_mutex_init(&(hcamcorder->mtsafe).gst_state_lock); g_mutex_init(&(hcamcorder->mtsafe).gst_encode_state_lock); @@ -507,7 +505,7 @@ _ERR_DEFAULT_VALUE_INIT: g_cond_clear(&(hcamcorder->mtsafe).cond); g_mutex_clear(&(hcamcorder->mtsafe).cmd_lock); g_cond_clear(&(hcamcorder->mtsafe).cmd_cond); - g_mutex_clear(&(hcamcorder->mtsafe).asm_lock); + g_mutex_clear(&(hcamcorder->mtsafe).interrupt_lock); g_mutex_clear(&(hcamcorder->mtsafe).state_lock); g_mutex_clear(&(hcamcorder->mtsafe).gst_state_lock); g_mutex_clear(&(hcamcorder->mtsafe).gst_encode_state_lock); @@ -674,29 +672,6 @@ int _mmcamcorder_destroy(MMHandleType handle) /* Remove messages which are not called yet */ _mmcamcorder_remove_message_all(handle); - /* unset remained watch cb */ - if (hcamcorder->sound_focus_watch_id > 0) { - mm_sound_unset_focus_watch_callback(hcamcorder->sound_focus_watch_id); - _mmcam_dbg_warn("unset sound focus watch cb [id %d] done", hcamcorder->sound_focus_watch_id); - hcamcorder->sound_focus_watch_id = 0; - } - - /* unregister sound focus and unsubscribe sound signal */ - _mmcam_dbg_log("sound focus id %d, sound signal subscribe id %u", - hcamcorder->sound_focus_id, hcamcorder->sound_focus_subscribe_id); - - if (hcamcorder->sound_focus_id > 0) { - mm_sound_unregister_focus(hcamcorder->sound_focus_id); - _mmcam_dbg_log("unregister sound focus done"); - hcamcorder->sound_focus_id = 0; - } - - if (hcamcorder->sound_focus_subscribe_id > 0) { - mm_sound_unsubscribe_signal(hcamcorder->sound_focus_subscribe_id); - _mmcam_dbg_log("unsubscribe sound signal done"); - hcamcorder->sound_focus_subscribe_id = 0; - } - #ifdef _MMCAMCORDER_RM_SUPPORT if (hcamcorder->rm_handle != 0) { iret = rm_unregister(hcamcorder->rm_handle); @@ -746,7 +721,7 @@ int _mmcamcorder_destroy(MMHandleType handle) g_cond_clear(&(hcamcorder->mtsafe).cond); g_mutex_clear(&(hcamcorder->mtsafe).cmd_lock); g_cond_clear(&(hcamcorder->mtsafe).cmd_cond); - g_mutex_clear(&(hcamcorder->mtsafe).asm_lock); + g_mutex_clear(&(hcamcorder->mtsafe).interrupt_lock); g_mutex_clear(&(hcamcorder->mtsafe).state_lock); g_mutex_clear(&(hcamcorder->mtsafe).gst_state_lock); g_mutex_clear(&(hcamcorder->mtsafe).gst_encode_state_lock); @@ -794,10 +769,8 @@ _ERR_CAMCORDER_CMD_PRECON: int _mmcamcorder_realize(MMHandleType handle) { int ret = MM_ERROR_NONE; - int ret_sound = MM_ERROR_NONE; int state = MM_CAMCORDER_STATE_NONE; int display_surface_type = MM_DISPLAY_SURFACE_OVERLAY; - int pid_for_sound_focus = 0; double motion_rate = _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE; char *videosink_element_type = NULL; const char *videosink_name = NULL; @@ -857,67 +830,6 @@ int _mmcamcorder_realize(MMHandleType handle) MMCAM_CAMERA_RECORDING_MOTION_RATE, &motion_rate, NULL); - /* sound focus */ - if (hcamcorder->sound_focus_register) { - mm_camcorder_get_attributes(handle, NULL, - MMCAM_PID_FOR_SOUND_FOCUS, &pid_for_sound_focus, - NULL); - - if (pid_for_sound_focus == 0) { - pid_for_sound_focus = getpid(); - _mmcam_dbg_warn("pid for sound focus is not set, use my pid %d", pid_for_sound_focus); - } - - ret = __mmcamcorder_simulate_asm_conflict_table(hcamcorder->session_type, pid_for_sound_focus); - if (ret != MM_ERROR_NONE) - goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; - - /* acquire sound focus or set sound focus watch callback */ - if (hcamcorder->session_flags & MM_SESSION_OPTION_PAUSE_OTHERS) { - /* acquire sound focus */ - _mmcam_dbg_log("PAUSE_OTHERS - acquire sound focus"); - - ret_sound = mm_sound_acquire_focus(hcamcorder->sound_focus_id, FOCUS_FOR_BOTH, "mm-camcorder acquire focus"); - if (ret_sound != MM_ERROR_NONE) { - _mmcam_dbg_err("mm_sound_acquire_focus failed [0x%x]", ret_sound); - - ret = MM_ERROR_POLICY_BLOCKED; - goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; - } - - hcamcorder->acquired_focus = FOCUS_FOR_BOTH; - } else if (hcamcorder->session_flags & MM_SESSION_OPTION_UNINTERRUPTIBLE) { - /* do nothing */ - _mmcam_dbg_log("SESSION_UNINTERRUPTIBLE - do nothing for sound focus"); - } else { - /* unset remained watch cb */ - if (hcamcorder->sound_focus_watch_id > 0) { - mm_sound_unset_focus_watch_callback(hcamcorder->sound_focus_watch_id); - _mmcam_dbg_warn("unset sound focus watch cb [id %d] done", hcamcorder->sound_focus_watch_id); - hcamcorder->sound_focus_watch_id = 0; - } - - /* set sound focus watch callback */ - _mmcam_dbg_log("ETC - set sound focus watch callback - pid %d", pid_for_sound_focus); - - ret_sound = mm_sound_set_focus_watch_callback_for_session(pid_for_sound_focus, - FOCUS_FOR_BOTH, - (mm_sound_focus_changed_watch_cb)_mmcamcorder_sound_focus_watch_cb, - hcamcorder, - &hcamcorder->sound_focus_watch_id); - if (ret_sound != MM_ERROR_NONE) { - _mmcam_dbg_err("mm_sound_set_focus_watch_callback failed [0x%x]", ret_sound); - - ret = MM_ERROR_POLICY_BLOCKED; - goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; - } - - _mmcam_dbg_log("sound focus watch cb id %d", hcamcorder->sound_focus_watch_id); - } - } else { - _mmcam_dbg_log("no need to register sound focus"); - } - /* alloc sub context */ hcamcorder->sub_context = _mmcamcorder_alloc_subcontext(hcamcorder->type); if (!hcamcorder->sub_context) { @@ -1079,7 +991,7 @@ int _mmcamcorder_realize(MMHandleType handle) #ifdef _MMCAMCORDER_RM_SUPPORT mm_camcorder_get_attributes(handle, NULL, - MMCAM_PID_FOR_SOUND_FOCUS, &app_pid, + MMCAM_CLIENT_PID, &app_pid, NULL); rci.app_pid = app_pid; aul_app_get_appid_bypid(rci.app_pid, rci.app_id, sizeof(rci.app_id)); @@ -1238,18 +1150,6 @@ _ERR_CAMCORDER_CMD: _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK: _MMCAMCORDER_UNLOCK_CMD(hcamcorder); - if (hcamcorder->sound_focus_watch_id > 0) { - mm_sound_unset_focus_watch_callback(hcamcorder->sound_focus_watch_id); - _mmcam_dbg_warn("unset sound focus watch cb [id %d] done", hcamcorder->sound_focus_watch_id); - hcamcorder->sound_focus_watch_id = 0; - } - - if (hcamcorder->acquired_focus > 0) { - mm_sound_release_focus(hcamcorder->sound_focus_id, hcamcorder->acquired_focus, "mm-camcorder release focus"); - _mmcam_dbg_warn("release sound focus [focus %d] done", hcamcorder->acquired_focus); - hcamcorder->acquired_focus = 0; - } - _ERR_CAMCORDER_CMD_PRECON: _mmcam_dbg_err("Realize fail (type %d, state %d, ret %x)", hcamcorder->type, state, ret); @@ -1369,32 +1269,6 @@ int _mmcamcorder_unrealize(MMHandleType handle) /* Deinitialize main context member */ hcamcorder->command = NULL; - _mmcam_dbg_log("focus register %d, session flag 0x%x, state_change_by_system %d", - hcamcorder->sound_focus_register, hcamcorder->session_flags, hcamcorder->state_change_by_system); - - /* release sound focus or unset sound focus watch callback */ - _mmcam_dbg_log("by_system %d, flag 0x%x, acquired_focus %d, focus_id %d, watch_id %d", - hcamcorder->state_change_by_system, hcamcorder->session_flags, hcamcorder->acquired_focus, - hcamcorder->sound_focus_id, hcamcorder->sound_focus_watch_id); - - if (hcamcorder->state_change_by_system != _MMCAMCORDER_STATE_CHANGE_BY_FOCUS) { - if (hcamcorder->sound_focus_watch_id > 0) { - mm_sound_unset_focus_watch_callback(hcamcorder->sound_focus_watch_id); - _mmcam_dbg_warn("unset sound focus watch cb [id %d] done", hcamcorder->sound_focus_watch_id); - hcamcorder->sound_focus_watch_id = 0; - } - - if (hcamcorder->acquired_focus > 0) { - mm_sound_release_focus(hcamcorder->sound_focus_id, hcamcorder->acquired_focus, "mm-camcorder release focus"); - _mmcam_dbg_warn("release sound focus [focus %d] done", hcamcorder->acquired_focus); - hcamcorder->acquired_focus = 0; - } - } else { - _mmcam_dbg_warn("state change by focus. so, no need to unset watch callback"); - /* acquired focus will be released automatically */ - hcamcorder->acquired_focus = 0; - } - _MMCAMCORDER_UNLOCK_CMD(hcamcorder); _mmcamcorder_set_state(handle, MM_CAMCORDER_STATE_NULL); @@ -2519,10 +2393,6 @@ void _mmcamcorder_set_state(MMHandleType handle, int state) /* To discern who changes the state */ switch (hcamcorder->state_change_by_system) { - case _MMCAMCORDER_STATE_CHANGE_BY_FOCUS: - msg.id = MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM; - msg.param.state.code = hcamcorder->interrupt_code; - break; case _MMCAMCORDER_STATE_CHANGE_BY_RM: msg.id = MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_RM; msg.param.state.code = MM_ERROR_NONE; @@ -3241,183 +3111,6 @@ DROP_MESSAGE: } -void _mmcamcorder_sound_focus_cb(int id, mm_sound_focus_type_e focus_type, - mm_sound_focus_state_e focus_state, const char *reason_for_change, - int option, const char *additional_info, void *user_data) -{ - mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(user_data); - int current_state = MM_CAMCORDER_STATE_NONE; - - mmf_return_if_fail((MMHandleType)hcamcorder); - - current_state = _mmcamcorder_get_state((MMHandleType)hcamcorder); - if (current_state <= MM_CAMCORDER_STATE_NONE || current_state >= MM_CAMCORDER_STATE_NUM) { - _mmcam_dbg_err("Abnormal state. Or null handle. (%p, %d)", hcamcorder, current_state); - return; - } - - _mmcam_dbg_warn("sound focus callback : focus state %d, reason %s", - focus_state, reason_for_change ? reason_for_change : "N/A"); - - if (hcamcorder->session_flags & MM_SESSION_OPTION_UNINTERRUPTIBLE) { - _mmcam_dbg_warn("session flag is UNINTERRUPTIBLE. do nothing."); - return; - } - - _MMCAMCORDER_LOCK_ASM(hcamcorder); - - /* check the reason */ - if (!strncmp(reason_for_change, "ringtone-voip", __MMCAMCORDER_FOCUS_CHANGE_REASON_LEN) || - !strncmp(reason_for_change, "ringtone-call", __MMCAMCORDER_FOCUS_CHANGE_REASON_LEN) || - !strncmp(reason_for_change, "voip", __MMCAMCORDER_FOCUS_CHANGE_REASON_LEN) || - !strncmp(reason_for_change, "call-voice", __MMCAMCORDER_FOCUS_CHANGE_REASON_LEN)) { - hcamcorder->interrupt_code = MM_MSG_CODE_INTERRUPTED_BY_CALL_START; - } else if (!strncmp(reason_for_change, "alarm", __MMCAMCORDER_FOCUS_CHANGE_REASON_LEN)) { - hcamcorder->interrupt_code = MM_MSG_CODE_INTERRUPTED_BY_ALARM_START; - } else { - hcamcorder->interrupt_code = MM_MSG_CODE_INTERRUPTED_BY_MEDIA; - } - - if (focus_state == FOCUS_IS_RELEASED) { - hcamcorder->acquired_focus &= ~focus_type; - - _mmcam_dbg_warn("FOCUS is released [type %d, remained focus %d] : Stop pipeline[state:%d]", - focus_type, hcamcorder->acquired_focus, current_state); - - __mmcamcorder_force_stop(hcamcorder, _MMCAMCORDER_STATE_CHANGE_BY_FOCUS); - - _mmcam_dbg_warn("Finish opeartion. Pipeline is released"); - } else if (focus_state == FOCUS_IS_ACQUIRED) { - _MMCamcorderMsgItem msg; - - _mmcam_dbg_warn("FOCUS is ready to acquired [type %d, current %d]", - focus_type, hcamcorder->acquired_focus); - - msg.id = MM_MESSAGE_READY_TO_RESUME; - _mmcamcorder_send_message((MMHandleType)hcamcorder, &msg); - - _mmcam_dbg_warn("Finish opeartion"); - } else { - _mmcam_dbg_warn("unknown focus state %d", focus_state); - } - - _MMCAMCORDER_UNLOCK_ASM(hcamcorder); - - _mmcam_dbg_warn("done"); - - return; -} - - -void _mmcamcorder_sound_signal_callback(mm_sound_signal_name_t signal, int value, void *user_data) -{ - mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(user_data); - - mmf_return_if_fail(hcamcorder); - - _mmcam_dbg_warn("sound signal %d - value %d", signal, value); - - _MMCAMCORDER_LOCK_ASM(hcamcorder); - - if (signal == MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS && value == 1) { - _mmcam_dbg_warn("focus id %d, focus watch id %d", - hcamcorder->sound_focus_id, hcamcorder->sound_focus_watch_id); - - /* unregister focus related callback */ - if (hcamcorder->sound_focus_id > 0) { - if (hcamcorder->acquired_focus > 0) { - mm_sound_release_focus(hcamcorder->sound_focus_id, hcamcorder->acquired_focus, "mm-camcorder release focus"); - _mmcam_dbg_warn("release acquired focus [focus %d] done", hcamcorder->acquired_focus); - hcamcorder->acquired_focus = 0; - } - - mm_sound_unregister_focus(hcamcorder->sound_focus_id); - _mmcam_dbg_warn("unregister sound focus done"); - hcamcorder->sound_focus_id = 0; - } - - if (hcamcorder->sound_focus_watch_id > 0) { - mm_sound_unset_focus_watch_callback(hcamcorder->sound_focus_watch_id); - _mmcam_dbg_warn("unset watch cb done"); - hcamcorder->sound_focus_watch_id = 0; - } - } - - /* reset flag not to run sound focus related code since now */ - hcamcorder->sound_focus_register = FALSE; - - _MMCAMCORDER_UNLOCK_ASM(hcamcorder); - - _mmcam_dbg_warn("done"); - - return; -} - - -void _mmcamcorder_sound_focus_watch_cb(int id, mm_sound_focus_type_e focus_type, mm_sound_focus_state_e focus_state, - const char *reason_for_change, const char *additional_info, void *user_data) -{ - mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(user_data); - int current_state = MM_CAMCORDER_STATE_NONE; - - mmf_return_if_fail(hcamcorder); - - current_state = _mmcamcorder_get_state((MMHandleType)hcamcorder); - if (current_state <= MM_CAMCORDER_STATE_NONE || - current_state >= MM_CAMCORDER_STATE_NUM) { - _mmcam_dbg_err("Abnormal state. Or null handle. (%p, %d)", hcamcorder, current_state); - return; - } - - _mmcam_dbg_warn("sound focus watch callback : id %d, focus state %d, reason %s", - id, focus_state, reason_for_change ? reason_for_change : "N/A"); - - if (hcamcorder->session_flags & MM_SESSION_OPTION_UNINTERRUPTIBLE) { - _mmcam_dbg_warn("session flag is UNINTERRUPTIBLE. do nothing."); - return; - } - - _MMCAMCORDER_LOCK_ASM(hcamcorder); - - /* check the reason */ - if (!strncmp(reason_for_change, "ringtone-voip", __MMCAMCORDER_FOCUS_CHANGE_REASON_LEN) || - !strncmp(reason_for_change, "ringtone-call", __MMCAMCORDER_FOCUS_CHANGE_REASON_LEN) || - !strncmp(reason_for_change, "voip", __MMCAMCORDER_FOCUS_CHANGE_REASON_LEN) || - !strncmp(reason_for_change, "call-voice", __MMCAMCORDER_FOCUS_CHANGE_REASON_LEN)) { - hcamcorder->interrupt_code = MM_MSG_CODE_INTERRUPTED_BY_CALL_START; - } else if (!strncmp(reason_for_change, "alarm", __MMCAMCORDER_FOCUS_CHANGE_REASON_LEN)) { - hcamcorder->interrupt_code = MM_MSG_CODE_INTERRUPTED_BY_ALARM_START; - } else { - hcamcorder->interrupt_code = MM_MSG_CODE_INTERRUPTED_BY_MEDIA; - } - - if (focus_state == FOCUS_IS_RELEASED) { - _MMCamcorderMsgItem msg; - - _mmcam_dbg_warn("other process's FOCUS is released"); - - msg.id = MM_MESSAGE_READY_TO_RESUME; - _mmcamcorder_send_message((MMHandleType)hcamcorder, &msg); - - _mmcam_dbg_warn("Finish opeartion"); - } else if (focus_state == FOCUS_IS_ACQUIRED) { - _mmcam_dbg_warn("other process's FOCUS is acquired : Stop pipeline[state:%d]", current_state); - - __mmcamcorder_force_stop(hcamcorder, _MMCAMCORDER_STATE_CHANGE_BY_FOCUS); - - _mmcam_dbg_warn("Finish opeartion. Pipeline is released"); - } else { - _mmcam_dbg_warn("unknown focus state %d", focus_state); - } - - _MMCAMCORDER_UNLOCK_ASM(hcamcorder); - - _mmcam_dbg_warn("done"); - - return; -} - - void _mmcamcorder_dpm_camera_policy_changed_cb(const char *name, const char *value, void *user_data) { mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(user_data); @@ -3435,11 +3128,11 @@ void _mmcamcorder_dpm_camera_policy_changed_cb(const char *name, const char *val _mmcam_dbg_warn("camera policy [%s], current state [%d]", value, current_state); if (!strcmp(value, "disallowed")) { - _MMCAMCORDER_LOCK_ASM(hcamcorder); + _MMCAMCORDER_LOCK_INTERRUPT(hcamcorder); __mmcamcorder_force_stop(hcamcorder, _MMCAMCORDER_STATE_CHANGE_BY_DPM); - _MMCAMCORDER_UNLOCK_ASM(hcamcorder); + _MMCAMCORDER_UNLOCK_INTERRUPT(hcamcorder); _mmcamcorder_request_dpm_popup(hcamcorder->gdbus_conn, "camera"); } @@ -3764,9 +3457,6 @@ void __mmcamcorder_force_stop(mmf_camcorder_t *hcamcorder, int state_change_by_s memset(&msg, 0x0, sizeof(_MMCamcorderMsgItem)); switch (state_change_by_system) { - case _MMCAMCORDER_STATE_CHANGE_BY_FOCUS: - msg.id = MM_MESSAGE_CAMCORDER_STATE_CHANGE_STARTED_BY_ASM; - break; case _MMCAMCORDER_STATE_CHANGE_BY_RM: msg.id = MM_MESSAGE_CAMCORDER_STATE_CHANGE_STARTED_BY_RM; break; @@ -4036,7 +3726,7 @@ static gint __mmcamcorder_gst_handle_resource_error(MMHandleType handle, int cod _mmcam_dbg_err("DPM mic DISALLOWED - current state %d", current_state); - _MMCAMCORDER_LOCK_ASM(hcamcorder); + _MMCAMCORDER_LOCK_INTERRUPT(hcamcorder); current_state = _mmcamcorder_get_state((MMHandleType)hcamcorder); if (current_state >= MM_CAMCORDER_STATE_RECORDING) { @@ -4055,7 +3745,7 @@ static gint __mmcamcorder_gst_handle_resource_error(MMHandleType handle, int cod /* restore value */ hcamcorder->state_change_by_system = _MMCAMCORDER_STATE_CHANGE_NORMAL; - _MMCAMCORDER_UNLOCK_ASM(hcamcorder); + _MMCAMCORDER_UNLOCK_INTERRUPT(hcamcorder); _mmcamcorder_request_dpm_popup(hcamcorder->gdbus_conn, "microphone"); @@ -4255,64 +3945,6 @@ static gint __mmcamcorder_gst_handle_resource_warning(MMHandleType handle, GstMe return MM_ERROR_NONE; } -/* Conditions below are from ASM conflict table of Tizen 2.4 */ -static int __mmcamcorder_simulate_asm_conflict_table(int session_type, int pid) -{ - int ret = MM_ERROR_NONE; - char *stream_type = NULL; - char *ext_info = NULL; - int option = 0; - - /* check previous acquired focus of other PID */ - 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 (ext_info && (pid != atoi(ext_info))) { /* 'ext_info' should contain pid */ - if ((session_type == MM_SESSION_TYPE_CALL) || - (session_type == MM_SESSION_TYPE_VIDEOCALL) || - (session_type == MM_SESSION_TYPE_VOIP)) { - /* case 1. if my session type is call/videocall/voip */ - if (!strcmp(stream_type, "call-voice") || - !strcmp(stream_type, "call-video") || - !strcmp(stream_type, "ringtone-call")) { - _mmcam_dbg_err("Blocked by session policy, stream_type[%s] of acquired focus", stream_type); - ret = MM_ERROR_POLICY_BLOCKED; - } - } else if ((session_type == MM_SESSION_TYPE_MEDIA) || - (session_type == MM_SESSION_TYPE_MEDIA_RECORD)) { - /* case 2. if my session type is media */ - 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] of acquired focus", stream_type); - ret = MM_ERROR_POLICY_BLOCKED; - } - } - } else { - _mmcam_dbg_log("acquired focus is same process with it, skip it"); - } - } else { - /* No data case */ - _mmcam_dbg_warn("get stream type failed 0x%x, stream type %s, but ignore it", - ret, stream_type ? stream_type : "NULL"); - ret = MM_ERROR_NONE; - } - - if (stream_type) { - free(stream_type); - stream_type = NULL; - } - - if (ext_info) { - free(ext_info); - ext_info = NULL; - } - - return ret; -} - void _mmcamcorder_emit_signal(MMHandleType handle, const char *object_name, const char *interface_name, const char *signal_name, int value) @@ -4347,7 +3979,7 @@ static int __mmcamcorder_resource_release_cb(mm_resource_manager_h rm, _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder); - _MMCAMCORDER_LOCK_ASM(hcamcorder); + _MMCAMCORDER_LOCK_INTERRUPT(hcamcorder); if (res == hcamcorder->video_encoder_resource) { /* Stop video recording */ @@ -4360,7 +3992,7 @@ static int __mmcamcorder_resource_release_cb(mm_resource_manager_h rm, __mmcamcorder_force_stop(hcamcorder, _MMCAMCORDER_STATE_CHANGE_BY_RM); } - _MMCAMCORDER_UNLOCK_ASM(hcamcorder); + _MMCAMCORDER_UNLOCK_INTERRUPT(hcamcorder); _MMCAMCORDER_LOCK_RESOURCE(hcamcorder); @@ -4397,7 +4029,7 @@ rm_cb_result _mmcamcorder_rm_callback(int handle, rm_callback_type event_src, _mmcam_dbg_warn("current state %d (handle %p)", current_state, hcamcorder); - _MMCAMCORDER_LOCK_ASM(hcamcorder); + _MMCAMCORDER_LOCK_INTERRUPT(hcamcorder); /* set RM event code for sending it to application */ hcamcorder->interrupt_code = event_src; @@ -4412,7 +4044,7 @@ rm_cb_result _mmcamcorder_rm_callback(int handle, rm_callback_type event_src, break; } - _MMCAMCORDER_UNLOCK_ASM(hcamcorder); + _MMCAMCORDER_UNLOCK_INTERRUPT(hcamcorder); return cb_res; } @@ -4437,7 +4069,7 @@ int _mmcamcorder_manage_external_storage_state(MMHandleType handle, int storage_ return MM_ERROR_NONE; } - _MMCAMCORDER_LOCK_ASM(hcamcorder); + _MMCAMCORDER_LOCK_INTERRUPT(hcamcorder); /* check recording state */ current_state = _mmcamcorder_get_state(handle); @@ -4465,7 +4097,7 @@ int _mmcamcorder_manage_external_storage_state(MMHandleType handle, int storage_ _mmcamcorder_send_message(handle, &msg); _MANAGE_DONE: - _MMCAMCORDER_UNLOCK_ASM(hcamcorder); + _MMCAMCORDER_UNLOCK_INTERRUPT(hcamcorder); _mmcam_dbg_warn("done - ret 0x%x", ret); diff --git a/src/mm_camcorder_sound.c b/src/mm_camcorder_sound.c index cc899d9..7182fa4 100644 --- a/src/mm_camcorder_sound.c +++ b/src/mm_camcorder_sound.c @@ -22,8 +22,6 @@ /*======================================================================================= | INCLUDE FILES | =======================================================================================*/ -#include -#include #include "mm_camcorder_internal.h" #include "mm_camcorder_sound.h" diff --git a/src/mm_camcorder_stillshot.c b/src/mm_camcorder_stillshot.c index d8175a2..53adfb0 100644 --- a/src/mm_camcorder_stillshot.c +++ b/src/mm_camcorder_stillshot.c @@ -26,7 +26,6 @@ #include #include #include -#include #include "mm_camcorder_internal.h" #include "mm_camcorder_stillshot.h" #include "mm_camcorder_exifinfo.h" @@ -385,7 +384,7 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) info->next_shot_time = 0; info->multi_shot_stop = FALSE; - /* sound init to pause other session */ + /* sound init */ _mmcamcorder_sound_init(handle); } diff --git a/src/mm_camcorder_util.c b/src/mm_camcorder_util.c index 5e70de0..8cb41da 100644 --- a/src/mm_camcorder_util.c +++ b/src/mm_camcorder_util.c @@ -1276,7 +1276,6 @@ gboolean _mmcamcorder_send_message(MMHandleType handle, _MMCamcorderMsgItem *dat switch (data->id) { case MM_MESSAGE_CAMCORDER_STATE_CHANGED: - case MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM: case MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_RM: data->param.union_type = MM_MSG_UNION_STATE; break; diff --git a/src/mm_camcorder_videorec.c b/src/mm_camcorder_videorec.c index fea07bf..cbc5a0e 100644 --- a/src/mm_camcorder_videorec.c +++ b/src/mm_camcorder_videorec.c @@ -1209,18 +1209,8 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle) _mmcam_dbg_err(""); - if (hcamcorder->state_change_by_system != _MMCAMCORDER_STATE_CHANGE_BY_FOCUS) { - /* Play record stop sound */ - _mmcamcorder_sound_solo_play(handle, _MMCAMCORDER_SAMPLE_SOUND_NAME_REC_STOP, FALSE); - } else { - _mmcam_dbg_warn("Play stop sound through pulseaudio"); - - _mmcamcorder_sound_init(handle); - - _mmcamcorder_sound_play((MMHandleType)hcamcorder, _MMCAMCORDER_SAMPLE_SOUND_NAME_REC_STOP, TRUE); - - _mmcamcorder_sound_finalize(handle); - } + /* Play record stop sound */ + _mmcamcorder_sound_solo_play(handle, _MMCAMCORDER_SAMPLE_SOUND_NAME_REC_STOP, FALSE); /* remove blocking part */ MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE); @@ -1347,10 +1337,8 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle) info->filesize = 0; info->b_commiting = FALSE; - if (hcamcorder->state_change_by_system != _MMCAMCORDER_STATE_CHANGE_BY_FOCUS) { - /* check recording stop sound */ - _mmcamcorder_sound_solo_play_wait(handle); - } + /* check recording stop sound */ + _mmcamcorder_sound_solo_play_wait(handle); _mmcam_dbg_err("_MMCamcorder_CMD_COMMIT : end"); -- 2.7.4