From fef9f89b7b7a7569181565b8a8cf0c80bf34ebda Mon Sep 17 00:00:00 2001 From: Seungbae Shin Date: Mon, 16 Oct 2017 20:39:53 +0900 Subject: [PATCH] disable signal handler for VD dotnet application, cleanup will be done by external call fix for coding rule included [Version] 0.11.29 [Issue Type] Product / Dotnet Change-Id: I5ed9ec1bc21bfddfd553d577bb048870123c8c50 (cherry picked from commit c5426e625d881fa2e75e2e5ba5d404c8c9166169) --- include/mm_sound.h | 4 ++ include/mm_sound_client.h | 4 ++ mm_sound.c | 89 ++++++++++++++++-------------- mm_sound_client.c | 132 +++++++++++++++++++++++++++------------------ packaging/libmm-sound.spec | 2 +- 5 files changed, 138 insertions(+), 93 deletions(-) diff --git a/include/mm_sound.h b/include/mm_sound.h index 8caa3e0..dfd80b0 100644 --- a/include/mm_sound.h +++ b/include/mm_sound.h @@ -1065,6 +1065,10 @@ int mm_sound_send_signal(mm_sound_signal_name_t signal_type, int value); int mm_sound_get_signal_value(mm_sound_signal_name_t signal_type, int *value); int mm_sound_is_stream_on_device(int stream_id, MMSoundDevice_t device_h, bool *is_on); +#ifdef TIZEN_TV +void mm_sound_dotnet_cleanup(int signo); +#endif + /** @} */ diff --git a/include/mm_sound_client.h b/include/mm_sound_client.h index 5c293e0..a1a4dbc 100644 --- a/include/mm_sound_client.h +++ b/include/mm_sound_client.h @@ -90,4 +90,8 @@ typedef void (*mm_sound_device_state_changed_wrapper_cb)(int device_id, const ch const char *name, int vendor_id, int product_id, int *stream_id, int stream_num, void *userdata); typedef void (*mm_sound_stop_callback_wrapper_func)(int id, void *userdata); +#ifdef TIZEN_TV +void mm_sound_client_cleanup(void); +#endif + #endif /* __MM_SOUND_CLIENT_H__ */ diff --git a/mm_sound.c b/mm_sound.c index 3490e36..333d2de 100644 --- a/mm_sound.c +++ b/mm_sound.c @@ -68,12 +68,13 @@ typedef struct _subscribe_cb { int client_pid; } subscribe_cb_t; -static const char* _get_volume_str (volume_type_t type) +static const char* _get_volume_str(volume_type_t type) { - static const char *volume_type_str[VOLUME_TYPE_MAX] = - { "SYSTEM", "NOTIFICATION", "ALARM", "RINGTONE", "MEDIA", "CALL", "VOIP", "VOICE", "FIXED"}; + static const char *volume_type_str[VOLUME_TYPE_MAX] = { + "SYSTEM", "NOTIFICATION", "ALARM", "RINGTONE", "MEDIA", "CALL", "VOIP", "VOICE", "FIXED" + }; - return (type >= VOLUME_TYPE_SYSTEM && type < VOLUME_TYPE_MAX)? volume_type_str[type] : "Unknown"; + return (type >= VOLUME_TYPE_SYSTEM && type < VOLUME_TYPE_MAX) ? volume_type_str[type] : "Unknown"; } static int _validate_volume(volume_type_t type, int value) @@ -81,8 +82,7 @@ static int _validate_volume(volume_type_t type, int value) if (value < 0) return -1; - switch (type) - { + switch (type) { case VOLUME_TYPE_CALL: case VOLUME_TYPE_VOIP: if (value >= VOLUME_MAX_BASIC) { @@ -192,7 +192,7 @@ int mm_sound_volume_primary_type_set(volume_type_t type) int ret = MM_ERROR_NONE; /* Check input param */ - if(type < VOLUME_TYPE_UNKNOWN || type >= VOLUME_TYPE_MAX) { + if (type < VOLUME_TYPE_UNKNOWN || type >= VOLUME_TYPE_MAX) { debug_error("invalid argument"); return MM_ERROR_INVALID_ARGUMENT; } @@ -214,7 +214,7 @@ int mm_sound_volume_primary_type_get(volume_type_t *type) int voltype = VOLUME_TYPE_RINGTONE; /* Check input param */ - if(type == NULL) { + if (type == NULL) { debug_error("invalid argument"); return MM_ERROR_INVALID_ARGUMENT; } @@ -346,7 +346,7 @@ int mm_sound_play_sound_ex(MMSoundPlayParam *param, int *handle) debug_critical("The sound hadle cannot be get [%d]", lhandle); } - debug_warning ("success : handle=[%p]", handle); + debug_warning("success : handle=[%p]", handle); return MM_ERROR_NONE; } @@ -373,7 +373,7 @@ int mm_sound_play_sound_with_stream_info(const char *filename, char *stream_type return err; } - debug_warning ("success : handle=[%p]", handle); + debug_warning("success : handle=[%p]", handle); return MM_ERROR_NONE; @@ -385,14 +385,14 @@ int mm_sound_stop_sound(int handle) { int err; - debug_warning ("enter : handle=[%d]", handle); + debug_warning("enter : handle=[%d]", handle); /* Stop sound */ err = mm_sound_client_stop_sound(handle); if (err < 0) { debug_error("Fail to stop sound"); return err; } - debug_warning ("success : handle=[%d]", handle); + debug_warning("success : handle=[%d]", handle); return MM_ERROR_NONE; } @@ -401,7 +401,7 @@ int mm_sound_stop_sound(int handle) //// MMSOUND TONE APIs /////////////////////////////////// EXPORT_API -int mm_sound_play_tone_ex (MMSoundTone_t num, int volume_config, const double volume, const int duration, int *handle, bool enable_session) +int mm_sound_play_tone_ex(MMSoundTone_t num, int volume_config, const double volume, const int duration, int *handle, bool enable_session) { int lhandle = -1; int err = MM_ERROR_NONE; @@ -452,7 +452,7 @@ int mm_sound_play_tone_with_stream_info(MMSoundTone_t tone, char *stream_type, i int err = MM_ERROR_NONE; err = mm_sound_client_play_tone_with_stream_info(tone, stream_type, stream_id, volume, duration, handle); - if (err <0) { + if (err < 0) { debug_error("Failed to play sound"); return err; } @@ -463,9 +463,9 @@ int mm_sound_play_tone_with_stream_info(MMSoundTone_t tone, char *stream_type, i EXPORT_API -int mm_sound_play_tone (MMSoundTone_t num, int volume_config, const double volume, const int duration, int *handle) +int mm_sound_play_tone(MMSoundTone_t num, int volume_config, const double volume, const int duration, int *handle) { - return mm_sound_play_tone_ex (num, volume_config, volume, duration, handle, true); + return mm_sound_play_tone_ex(num, volume_config, volume, duration, handle, true); } /////////////////////////////////// @@ -526,7 +526,8 @@ int mm_sound_remove_test_callback(unsigned int subs_id) return ret; } -static int _convert_signal_name_str_to_enum (const char *name_str, mm_sound_signal_name_t *name_enum) { +static int _convert_signal_name_str_to_enum(const char *name_str, mm_sound_signal_name_t *name_enum) +{ int ret = MM_ERROR_NONE; if (!name_str || !name_enum) @@ -541,7 +542,7 @@ static int _convert_signal_name_str_to_enum (const char *name_str, mm_sound_sign return ret; } -static void _dbus_signal_callback (const char *signal_name, int value, void *user_data) +static void _dbus_signal_callback(const char *signal_name, int value, void *user_data) { int ret = MM_ERROR_NONE; mm_sound_signal_name_t signal; @@ -565,7 +566,7 @@ static void _dbus_signal_callback (const char *signal_name, int value, void *use * |<-- pid (16bits) -->|<-- value (16bits) -->|, * FYI, #define PID_MAX_DEFAULT (CONFIG_BASE_SMALL ? 0x1000 : 0x8000). * In case of daemon usage, it uses the client_pid of subscribe_cb. */ - debug_msg ("client_pid[%d], getpid[%d], value>>16[%d], callback[%p]", + debug_msg("client_pid[%d], getpid[%d], value>>16[%d], callback[%p]", subscribe_cb->client_pid, getpid(), (value >> 16), subscribe_cb); if ((subscribe_cb->client_pid ? subscribe_cb->client_pid : getpid()) == (value >> 16)) subscribe_cb->callback(signal, (value & 0x0000FFFF), subscribe_cb->user_data); @@ -586,13 +587,13 @@ static void signal_callback(GDBusConnection *conn, GVariant *parameters, gpointer user_data) { - int value=0; + int value = 0; const GVariantType* value_type; - debug_msg ("sender : %s, object : %s, interface : %s, signal : %s", + debug_msg("sender : %s, object : %s, interface : %s, signal : %s", sender_name, object_path, interface_name, signal_name); if (g_variant_is_of_type(parameters, G_VARIANT_TYPE("(i)"))) { - g_variant_get(parameters, "(i)",&value); + g_variant_get(parameters, "(i)", &value); debug_msg(" - value : 0x08%x", value); _dbus_signal_callback(signal_name, value, user_data); } else { @@ -615,7 +616,7 @@ int mm_sound_subscribe_signal(mm_sound_signal_name_t signal_type, unsigned int * MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(&g_subscribe_cb_list_mutex, MM_ERROR_SOUND_INTERNAL); if (signal_type >= MM_SOUND_SIGNAL_MAX || !subscribe_id) { - debug_error ("invalid argument, signal(%d), subscribe_id(%p)", signal_type, subscribe_id); + debug_error("invalid argument, signal(%d), subscribe_id(%p)", signal_type, subscribe_id); ret = MM_ERROR_INVALID_ARGUMENT; goto error; } @@ -632,8 +633,8 @@ int mm_sound_subscribe_signal(mm_sound_signal_name_t signal_type, unsigned int * g_dbus_conn_mmsound = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err); if (!g_dbus_conn_mmsound || err) { - debug_error ("g_bus_get_sync() error (%s) ", err ? err->message : NULL); - g_error_free (err); + debug_error("g_bus_get_sync() error (%s) ", err ? err->message : NULL); + g_error_free(err); ret = MM_ERROR_SOUND_INTERNAL; goto error; } @@ -642,7 +643,7 @@ int mm_sound_subscribe_signal(mm_sound_signal_name_t signal_type, unsigned int * NULL, G_DBUS_SIGNAL_FLAGS_NONE, signal_callback, subscribe_cb, free); if (subs_id == 0) { - debug_error ("g_dbus_connection_signal_subscribe() error (%d)", subs_id); + debug_error("g_dbus_connection_signal_subscribe() error (%d)", subs_id); ret = MM_ERROR_SOUND_INTERNAL; g_object_unref(g_dbus_conn_mmsound); goto error; @@ -680,7 +681,7 @@ int mm_sound_subscribe_signal_for_daemon(mm_sound_signal_name_t signal_type, int MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(&g_subscribe_cb_list_mutex, MM_ERROR_SOUND_INTERNAL); if (signal_type >= MM_SOUND_SIGNAL_MAX || !client_pid || !subscribe_id) { - debug_error ("invalid argument, signal(%d), client_pid(%d), subscribe_id(%p)", signal_type, client_pid, subscribe_id); + debug_error("invalid argument, signal(%d), client_pid(%d), subscribe_id(%p)", signal_type, client_pid, subscribe_id); ret = MM_ERROR_INVALID_ARGUMENT; goto error; } @@ -698,8 +699,8 @@ int mm_sound_subscribe_signal_for_daemon(mm_sound_signal_name_t signal_type, int g_dbus_conn_mmsound = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err); if (!g_dbus_conn_mmsound || err) { - debug_error ("g_bus_get_sync() error (%s) ", err ? err->message : NULL); - g_error_free (err); + debug_error("g_bus_get_sync() error (%s) ", err ? err->message : NULL); + g_error_free(err); ret = MM_ERROR_SOUND_INTERNAL; goto error; } @@ -708,7 +709,7 @@ int mm_sound_subscribe_signal_for_daemon(mm_sound_signal_name_t signal_type, int NULL, G_DBUS_SIGNAL_FLAGS_NONE, signal_callback, subscribe_cb, free); if (subs_id == 0) { - debug_error ("g_dbus_connection_signal_subscribe() error (%d)", subs_id); + debug_error("g_dbus_connection_signal_subscribe() error (%d)", subs_id); ret = MM_ERROR_SOUND_INTERNAL; g_object_unref(g_dbus_conn_mmsound); goto error; @@ -761,14 +762,14 @@ int mm_sound_send_signal(mm_sound_signal_name_t signal_type, int value) MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(&g_subscribe_cb_list_mutex, MM_ERROR_SOUND_INTERNAL); if (signal_type >= MM_SOUND_SIGNAL_MAX) { - debug_error ("invalid argument, signal(%d)", signal_type); + debug_error("invalid argument, signal(%d)", signal_type); ret = MM_ERROR_INVALID_ARGUMENT; goto error; } conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err); if (!conn || err) { - debug_error ("g_bus_get_sync() error (%s)", err ? err->message : NULL); + debug_error("g_bus_get_sync() error (%s)", err ? err->message : NULL); ret = MM_ERROR_SOUND_INTERNAL; goto error; } @@ -780,27 +781,27 @@ int mm_sound_send_signal(mm_sound_signal_name_t signal_type, int value) * FYI, #define PID_MAX_DEFAULT (CONFIG_BASE_SMALL ? 0x1000 : 0x8000). */ value |= ((int)getpid() << 16); if ((_mm_session_util_write_information((int)getpid(), MM_SESSION_TYPE_REPLACED_BY_STREAM, 0))) - debug_error ("failed to _mm_session_util_write_information for MM_SESSION_TYPE_REPLACED_BY_STREAM"); + debug_error("failed to _mm_session_util_write_information for MM_SESSION_TYPE_REPLACED_BY_STREAM"); } - dbus_ret = g_dbus_connection_emit_signal (conn, + dbus_ret = g_dbus_connection_emit_signal(conn, NULL, MM_SOUND_DBUS_OBJECT_PATH, MM_SOUND_DBUS_INTERFACE, dbus_signal_name_str[signal_type], - g_variant_new ("(i)", value), + g_variant_new("(i)", value), &err); if (!dbus_ret || err) { - debug_error ("g_dbus_connection_emit_signal() error (%s)", err ? err->message : NULL); + debug_error("g_dbus_connection_emit_signal() error (%s)", err ? err->message : NULL); ret = MM_ERROR_SOUND_INTERNAL; goto error; } dbus_ret = g_dbus_connection_flush_sync(conn, NULL, &err); if (!dbus_ret || err) { - debug_error ("g_dbus_connection_flush_sync() error (%s)", err ? err->message : NULL); + debug_error("g_dbus_connection_flush_sync() error (%s)", err ? err->message : NULL); ret = MM_ERROR_SOUND_INTERNAL; goto error; } g_object_unref(conn); - debug_msg ("sending signal[%s], value[%d] success", dbus_signal_name_str[signal_type], value); + debug_msg("sending signal[%s], value[%d] success", dbus_signal_name_str[signal_type], value); MMSOUND_LEAVE_CRITICAL_SECTION(&g_subscribe_cb_list_mutex); @@ -810,7 +811,7 @@ int mm_sound_send_signal(mm_sound_signal_name_t signal_type, int value) error: if (err) - g_error_free (err); + g_error_free(err); if (conn) g_object_unref(conn); @@ -837,6 +838,16 @@ int mm_sound_get_signal_value(mm_sound_signal_name_t signal_type, int *value) return ret; } +#ifdef TIZEN_TV +EXPORT_API +void mm_sound_dotnet_cleanup(int signo) +{ + debug_warning("Dotnet cleanup %d : Start", signo); + mm_sound_client_cleanup(); + debug_warning("Dotnet cleanup %d : End", signo); +} +#endif + __attribute__ ((constructor)) static void _mm_sound_initialize(void) { diff --git a/mm_sound_client.c b/mm_sound_client.c index 2dcbbc5..635c96d 100644 --- a/mm_sound_client.c +++ b/mm_sound_client.c @@ -146,9 +146,21 @@ typedef struct _focus_idle_event { int data; } focus_idle_event_t; -void _system_signal_handler(int signo, siginfo_t *siginfo, void *context) +void mm_sound_client_cleanup(void) { int ret = MM_ERROR_NONE; + + if (g_need_emergent_exit) { + ret = mm_sound_proxy_emergent_exit(getpid()); + if (ret == MM_ERROR_NONE) + debug_msg("Success to emergnet_exit"); + else + debug_error("Error occurred : 0x%x", ret); + } +} + +void _system_signal_handler(int signo, siginfo_t *siginfo, void *context) +{ sigset_t old_mask, all_mask; debug_warning("Got signal : signo(%d)", signo); @@ -158,13 +170,7 @@ void _system_signal_handler(int signo, siginfo_t *siginfo, void *context) sigfillset(&all_mask); sigprocmask(SIG_BLOCK, &all_mask, &old_mask); - if (g_need_emergent_exit) { - ret = mm_sound_proxy_emergent_exit(getpid()); - if (ret == MM_ERROR_NONE) - debug_msg("Success to emergnet_exit"); - else - debug_error("Error occurred : 0x%x", ret); - } + mm_sound_client_cleanup(); sigprocmask(SIG_SETMASK, &old_mask, NULL); /* signal unblock */ @@ -213,16 +219,35 @@ void _system_signal_handler(int signo, siginfo_t *siginfo, void *context) debug_warning("signal handling end"); } +#ifdef TIZEN_TV +static bool _is_dotnet_app(void) +{ + char *is_dotnet = NULL; + + is_dotnet = getenv("DOTNET_APP"); + if (is_dotnet && atoi(is_dotnet) == 1) + return true; + else + return false; +} +#endif + int mm_sound_client_initialize(void) { int ret = MM_ERROR_NONE; + struct sigaction system_action; + debug_fenter(); mm_sound_proxy_initialize(); g_idle_event_src = 0; - - struct sigaction system_action; +#ifdef TIZEN_TV + if (_is_dotnet_app()) { + debug_warning("no signal handler for dotnet!!"); + return ret; + } +#endif system_action.sa_sigaction = _system_signal_handler; system_action.sa_flags = SA_NOCLDSTOP | SA_SIGINFO; @@ -245,20 +270,7 @@ int mm_sound_client_finalize(void) debug_fenter(); - if (g_need_emergent_exit) { - ret = mm_sound_proxy_emergent_exit(getpid()); - if (ret == MM_ERROR_NONE) - debug_msg("Success to emergent_exit"); - else - debug_error("Error occurred : 0x%x", ret); - } - - sigaction(SIGINT, &system_int_old_action, NULL); - sigaction(SIGABRT, &system_abrt_old_action, NULL); - sigaction(SIGSEGV, &system_segv_old_action, NULL); - sigaction(SIGTERM, &system_term_old_action, NULL); - sigaction(SIGSYS, &system_sys_old_action, NULL); - sigaction(SIGXCPU, &system_xcpu_old_action, NULL); + mm_sound_client_cleanup(); ret = mm_sound_proxy_finalize(); @@ -270,6 +282,20 @@ int mm_sound_client_finalize(void) } #endif +#ifdef TIZEN_TV + if (_is_dotnet_app()) { + debug_warning("no signal handler for dotnet!!"); + return ret; + } +#endif + + sigaction(SIGINT, &system_int_old_action, NULL); + sigaction(SIGABRT, &system_abrt_old_action, NULL); + sigaction(SIGSEGV, &system_segv_old_action, NULL); + sigaction(SIGTERM, &system_term_old_action, NULL); + sigaction(SIGSYS, &system_sys_old_action, NULL); + sigaction(SIGXCPU, &system_xcpu_old_action, NULL); + debug_fleave(); return ret; } @@ -360,7 +386,7 @@ int mm_sound_client_play_tone(int number, int volume_config, double volume, debug_warning("Read Session Information failed. use default \"media\" type"); session_type = MM_SESSION_TYPE_MEDIA; - if(MM_ERROR_NONE != mm_session_init(session_type)) { + if (MM_ERROR_NONE != mm_session_init(session_type)) { debug_critical("MMSessionInit() failed"); return MM_ERROR_POLICY_INTERNAL; } @@ -445,7 +471,7 @@ int mm_sound_client_play_sound(MMSoundPlayParam *param, int tone, int *handle) int session_type = MM_SESSION_TYPE_MEDIA; int session_options = 0; int is_focus_registered = 0; -// int instance = -1; /* instance is unique to communicate with server : client message queue filter type */ +// int instance = -1; /* instance is unique to communicate with server : client message queue filter type */ int volume_type = MM_SOUND_VOLUME_CONFIG_TYPE(param->volume_config); char stream_type[MAX_STREAM_TYPE_LEN] = {0, }; struct callback_data *cb_data = NULL; @@ -465,11 +491,11 @@ int mm_sound_client_play_sound(MMSoundPlayParam *param, int tone, int *handle) param->skip_session = true; if (param->skip_session == false) { - if(MM_ERROR_NONE != _mm_session_util_read_information(-1, &session_type, &session_options)) { + if (MM_ERROR_NONE != _mm_session_util_read_information(-1, &session_type, &session_options)) { debug_warning("Read MMSession Type failed. use default \"media\" type"); session_type = MM_SESSION_TYPE_MEDIA; - if(MM_ERROR_NONE != mm_session_init(session_type)) { + if (MM_ERROR_NONE != mm_session_init(session_type)) { debug_critical("MMSessionInit() failed"); return MM_ERROR_POLICY_INTERNAL; } @@ -564,7 +590,7 @@ int mm_sound_client_stop_sound(int handle) return ret; } -static int _mm_sound_client_device_list_dump (GList *device_list) +static int _mm_sound_client_device_list_dump(GList *device_list) { int ret = MM_ERROR_NONE; GList *list = NULL; @@ -964,7 +990,7 @@ int __convert_volume_type_to_str(int volume_type, char **volume_type_str) debug_error("unexpected volume type [%d]", volume_type); return MM_ERROR_SOUND_INTERNAL; } - if (!strncmp(*volume_type_str,"", VOLUME_TYPE_LEN)) { + if (!strncmp(*volume_type_str, "", VOLUME_TYPE_LEN)) { debug_error("could not find the volume_type[%d] in this switch case statement", volume_type); ret = MM_ERROR_SOUND_INTERNAL; } else { @@ -1128,13 +1154,13 @@ static gboolean _interrupted_completed(gpointer *data) } static void _session_interrupted_cb(int id, mm_sound_focus_type_e focus_type, mm_sound_focus_state_e state, - const char *reason_for_change, const char *ext_info, void *user_data) + const char *reason_for_change, const char *ext_info, void *user_data) { debug_msg("id(%d), focus_type(%d), state(%d), reason(%s)", id, focus_type, state, reason_for_change); if (id != g_focus_session_interrupt_info.watch_cb_id) { debug_error("id is not valid(param id:%d, g_focus_session_interrupt_watch_cb_id:%d)", - id, g_focus_session_interrupt_info.watch_cb_id); + id, g_focus_session_interrupt_info.watch_cb_id); return; } if (!g_focus_session_interrupt_info.user_cb) { @@ -1164,7 +1190,7 @@ int mm_sound_client_set_session_interrupt_callback(mm_sound_focus_session_interr /* add internal focus watch callback */ if (g_focus_session_interrupt_info.watch_cb_id == -1) { if ((ret = mm_sound_client_set_focus_watch_callback(getpid(), FOCUS_FOR_BOTH, true, true, _session_interrupted_cb, NULL, - &g_focus_session_interrupt_info.watch_cb_id))) { + &g_focus_session_interrupt_info.watch_cb_id))) { debug_error("failed to mm_sound_client_set_focus_watch_callback(), ret(0x%x)", ret); return ret; } @@ -1190,7 +1216,7 @@ int mm_sound_client_unset_session_interrupt_callback(void) /* remove internal focus watch callback */ if ((ret = mm_sound_client_unset_focus_watch_callback(g_focus_session_interrupt_info.watch_cb_id))) { debug_error("failed to mm_sound_client_unset_focus_watch_callback(), id(%d), ret(0x%x)", - g_focus_session_interrupt_info.watch_cb_id, ret); + g_focus_session_interrupt_info.watch_cb_id, ret); return ret; } g_focus_session_interrupt_info.watch_cb_id = -1; @@ -1217,7 +1243,7 @@ static gpointer _focus_thread_func(gpointer data) static gboolean _focus_fd_prepare(GSource *source, gint *timeout) { #ifdef __DEBUG__ - debug_warning("[ PREPARE : %p, (%p, %d)", source, timeout, timeout? *timeout : -1); + debug_warning("[ PREPARE : %p, (%p, %d)", source, timeout, timeout ? *timeout : -1); #endif return FALSE; } @@ -1256,7 +1282,7 @@ static int _focus_find_index_by_handle(int handle) for (i = 0; i < FOCUS_HANDLE_MAX; i++) { if (g_focus_sound_handle[i].focus_callback && handle == g_focus_sound_handle[i].handle) { /* debug_msg("found index(%d) for handle(%d)", i, handle);*/ - return (handle == FOCUS_HANDLE_INIT_VAL)? -1 : i; + return (handle == FOCUS_HANDLE_INIT_VAL) ? -1 : i; } } return -1; @@ -1268,7 +1294,7 @@ static int _focus_watch_find_index_by_handle(int handle) for (i = 0; i < FOCUS_HANDLE_MAX; i++) { if (g_focus_sound_handle[i].watch_callback && handle == g_focus_sound_handle[i].handle) { /* debug_msg("found index(%d) for watch handle(%d)", i, handle);*/ - return (handle == FOCUS_HANDLE_INIT_VAL)? -1 : i; + return (handle == FOCUS_HANDLE_INIT_VAL) ? -1 : i; } } return -1; @@ -1297,10 +1323,10 @@ static gboolean _focus_callback_handler(gpointer user_data) int changed_state = -1; count = read(poll_fd->fd, &cb_data, sizeof(cb_data)); - if (count < 0){ + if (count < 0) { char str_error[256]; strerror_r(errno, str_error, sizeof(str_error)); - debug_error("GpollFD read fail, errno=%d(%s)",errno, str_error); + debug_error("GpollFD read fail, errno=%d(%s)", errno, str_error); return G_SOURCE_CONTINUE; } changed_state = cb_data.state; @@ -1377,10 +1403,10 @@ static gboolean _focus_watch_callback_handler(gpointer user_data) if (poll_fd->revents & (POLLIN | POLLPRI)) { count = read(poll_fd->fd, &cb_data, sizeof(cb_data)); - if (count < 0){ + if (count < 0) { char str_error[256]; strerror_r(errno, str_error, sizeof(str_error)); - debug_error("GpollFD read fail, errno=%d(%s)",errno, str_error); + debug_error("GpollFD read fail, errno=%d(%s)", errno, str_error); return G_SOURCE_CONTINUE; } @@ -1824,7 +1850,7 @@ int mm_sound_client_is_focus_cb_thread(GThread *mine, bool *result) } int mm_sound_client_register_focus(int id, int pid, const char *stream_type, bool is_for_session, - mm_sound_focus_changed_cb callback, void* user_data) + mm_sound_focus_changed_cb callback, void* user_data) { int ret = MM_ERROR_NONE; int instance; @@ -1858,7 +1884,7 @@ int mm_sound_client_register_focus(int id, int pid, const char *stream_type, boo goto cleanup; } } else { - debug_error("Error occurred : 0x%x",ret); + debug_error("Error occurred : 0x%x", ret); goto cleanup; } @@ -1953,7 +1979,7 @@ int mm_sound_client_set_focus_reacquisition(int id, bool reacquisition, bool is_ if (ret == MM_ERROR_NONE) { debug_msg("Success to set focus reacquisition to [%d]", reacquisition); } else { - debug_error("Error occurred : 0x%x",ret); + debug_error("Error occurred : 0x%x", ret); goto cleanup; } } else { @@ -2011,13 +2037,13 @@ int mm_sound_client_get_acquired_focus_stream_type(int focus_type, char **stream ret = mm_sound_proxy_get_acquired_focus_stream_type(focus_type, &stream_type_str, option, &ext_info_str); if (ret == MM_ERROR_NONE) { debug_msg("Success to get stream type of acquired focus, stream_type(%s), ext_info(%s)", - stream_type_str, ext_info_str); + stream_type_str, ext_info_str); *stream_type = strdup(stream_type_str); *ext_info = strdup(ext_info_str); g_free(stream_type_str); g_free(ext_info_str); } else { - debug_error("Error occurred : 0x%x",ret); + debug_error("Error occurred : 0x%x", ret); } debug_fleave(); @@ -2074,7 +2100,7 @@ int mm_sound_client_release_focus(int id, mm_sound_focus_type_e type, int option if (ret == MM_ERROR_NONE) debug_msg("Success to release focus"); else - debug_error("Error occurred : 0x%x",ret); + debug_error("Error occurred : 0x%x", ret); cleanup: MMSOUND_LEAVE_CRITICAL_SECTION(&g_index_mutex); @@ -2107,7 +2133,7 @@ int mm_sound_client_deliver_focus(int pid, int src_id, int dst_id, mm_sound_focu } int mm_sound_client_set_focus_watch_callback(int pid, mm_sound_focus_type_e focus_type, bool is_for_session, bool is_for_monitor, - mm_sound_focus_changed_watch_cb callback, void* user_data, int *id) + mm_sound_focus_changed_watch_cb callback, void* user_data, int *id) { int ret = MM_ERROR_NONE; int instance; @@ -2144,7 +2170,7 @@ int mm_sound_client_set_focus_watch_callback(int pid, mm_sound_focus_type_e focu g_focus_sound_handle[index].unset_watch_callback_requested = false; ret = mm_sound_proxy_set_focus_watch_callback(pid, g_focus_sound_handle[index].handle, focus_type, - is_for_session, is_for_monitor, callback, user_data); + is_for_session, is_for_monitor, callback, user_data); if (ret == MM_ERROR_NONE) { debug_msg("Success to watch focus"); @@ -2154,7 +2180,7 @@ int mm_sound_client_set_focus_watch_callback(int pid, mm_sound_focus_type_e focu goto cleanup; } } else { - debug_error("Error occurred : 0x%x",ret); + debug_error("Error occurred : 0x%x", ret); goto cleanup; } @@ -2212,13 +2238,13 @@ int mm_sound_client_unset_focus_watch_callback(int id) g_focus_sound_handle[index].is_used = false; ret = mm_sound_proxy_unset_focus_watch_callback(g_focus_sound_handle[index].focus_tid, - g_focus_sound_handle[index].handle, - g_focus_sound_handle[index].is_for_session); + g_focus_sound_handle[index].handle, + g_focus_sound_handle[index].is_for_session); if (ret == MM_ERROR_NONE) debug_msg("Success to unwatch focus"); else - debug_error("Error occurred : 0x%x",ret); + debug_error("Error occurred : 0x%x", ret); g_mutex_unlock(&g_focus_sound_handle[index].focus_lock); diff --git a/packaging/libmm-sound.spec b/packaging/libmm-sound.spec index 9164958..c52ff64 100644 --- a/packaging/libmm-sound.spec +++ b/packaging/libmm-sound.spec @@ -1,6 +1,6 @@ Name: libmm-sound Summary: MMSound Package contains client lib and sound_server binary -Version: 0.11.28 +Version: 0.11.29 Release: 0 Group: System/Libraries License: Apache-2.0 -- 2.7.4