From c492cf6514261b8d175e32d7f0660f6f707f6bce Mon Sep 17 00:00:00 2001 From: inhyeok Date: Tue, 8 Sep 2015 14:03:17 +0900 Subject: [PATCH] Unsubscribe play file end callback after calling user callback [Version] Release 0.9.258 [Profile] Common [Issue Type] Fix bugs Change-Id: I08d4d1e7def9b50ded221dc5ead334400da53a17 Signed-off-by: inhyeok --- include/mm_sound_client_dbus.h | 1 + mm_sound_client_dbus.c | 22 +++++++++++++++++++++- packaging/libmm-sound.spec | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/include/mm_sound_client_dbus.h b/include/mm_sound_client_dbus.h index 3caca7a..6534f76 100644 --- a/include/mm_sound_client_dbus.h +++ b/include/mm_sound_client_dbus.h @@ -31,6 +31,7 @@ int mm_sound_client_dbus_remove_available_route_changed_callback(void); int mm_sound_client_dbus_set_sound_path_for_active_device(mm_sound_device_out device_out, mm_sound_device_in device_in); int mm_sound_client_dbus_set_active_route_auto(void); int mm_sound_client_dbus_add_play_sound_end_callback(int handle, mm_sound_stop_callback_func stop_cb, void* userdata, unsigned int *subs_id); +int mm_sound_client_dbus_remove_play_sound_end_callback(unsigned int subs_id); int mm_sound_client_dbus_get_current_connected_device_list(int device_flags, GList** device_list); int mm_sound_client_dbus_add_device_connected_callback(int device_flags, mm_sound_device_connected_cb func, void* user_data, unsigned int *subs_id); int mm_sound_client_dbus_remove_device_connected_callback(unsigned int subs_id); diff --git a/mm_sound_client_dbus.c b/mm_sound_client_dbus.c index 4ac4be3..cd60d4d 100644 --- a/mm_sound_client_dbus.c +++ b/mm_sound_client_dbus.c @@ -46,6 +46,8 @@ #define DBUS_SIGNATURE_MAX 32 #define ERR_MSG_MAX 100 +#define CODEC_HANDLE_MAX 256 + #define FOCUS_HANDLE_MAX 512 #define FOCUS_HANDLE_INIT_VAL -1 @@ -110,6 +112,7 @@ GMainLoop *g_focus_loop; focus_sound_info_t g_focus_sound_handle[FOCUS_HANDLE_MAX]; focus_session_interrupt_info_t g_focus_session_interrupt_info = {NULL, NULL}; guint g_dbus_subs_ids[SIGNAL_MAX]; +guint g_dbus_play_file_end_subs_ids[CODEC_HANDLE_MAX]; guint g_dbus_prop_subs_ids[PULSEAUDIO_PROP_MAX]; const struct mm_sound_dbus_method_info g_methods[METHOD_CALL_MAX] = { @@ -683,6 +686,8 @@ static void _sound_server_dbus_signal_callback (GDBusConnection *connection, if (ended_handle == user_cb->mask) { debug_log("Interested playing handle end : %d", ended_handle); ((mm_sound_stop_callback_func)(user_cb->cb))(user_cb->userdata, ended_handle); + if (mm_sound_client_dbus_remove_play_sound_end_callback(g_dbus_play_file_end_subs_ids[ended_handle]) != MM_ERROR_NONE) + debug_error("mm_sound_client_dbus_remove_play_file_end_callback failed"); } else { debug_log("Not interested playing handle : %d", ended_handle); } @@ -785,6 +790,9 @@ static int _dbus_signal_subscribe_to(int dbus_to, sound_server_signal_t signalty } else { if (subs_id) *subs_id = (unsigned int)_subs_id; + else if(signaltype == SIGNAL_PLAY_FILE_END) { + g_dbus_play_file_end_subs_ids[mask] = _subs_id; + } } } else { debug_error("Get Dbus Connection Error"); @@ -1125,7 +1133,6 @@ int mm_sound_client_dbus_remove_volume_changed_callback(unsigned int subs_id) return ret; } - int mm_sound_client_dbus_get_audio_path(mm_sound_device_in *device_in, mm_sound_device_out *device_out) { int ret = MM_ERROR_NONE; @@ -1418,6 +1425,19 @@ int mm_sound_client_dbus_add_play_sound_end_callback(int handle, mm_sound_stop_c return ret; } +int mm_sound_client_dbus_remove_play_sound_end_callback(unsigned int subs_id) +{ + int ret = MM_ERROR_NONE; + debug_fenter(); + + if ((ret = _sound_server_dbus_signal_unsubscribe(subs_id)) != MM_ERROR_NONE) { + debug_error("Remove Play File End callback failed"); + } + + debug_fleave(); + return ret; +} + int mm_sound_client_dbus_add_active_device_changed_callback(const char *name, mm_sound_active_device_changed_cb func, void* user_data) { int ret = MM_ERROR_NONE; diff --git a/packaging/libmm-sound.spec b/packaging/libmm-sound.spec index bd1a6c5..d4c64ba 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.9.257 +Version: 0.9.258 Release: 0 Group: System/Libraries License: Apache-2.0 -- 2.7.4