Merge branch 'tizen_3.0' into tizen 19/112719/1 accepted/tizen/common/20170203.161623 accepted/tizen/ivi/20170203.023107 accepted/tizen/mobile/20170203.023020 accepted/tizen/tv/20170203.023037 accepted/tizen/wearable/20170203.023054 submit/tizen/20170202.111238
authorSeungbae Shin <seungbae.shin@samsung.com>
Thu, 2 Feb 2017 09:55:57 +0000 (18:55 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Thu, 2 Feb 2017 09:55:57 +0000 (18:55 +0900)
Change-Id: I572bf70e1d33553edfff0cf02716cefc304782f1

common/mm_sound_dbus.c
focus_server/mm_sound_focus_server.c
focus_server/mm_sound_mgr_focus.c
include/mm_sound_common.h
mm_sound_client.c
mm_sound_pa_client.c
packaging/libmm-sound.spec
server/mm_sound_mgr_codec.c
server/mm_sound_mgr_ipc.c
server/mm_sound_mgr_ipc_dbus.c

index e33cc82..600d583 100644 (file)
@@ -315,8 +315,8 @@ static int _dbus_subscribe_signal(GDBusConnection *conn, const char* object_name
 
        debug_log("Dbus subscirbe signal with Obj'%s' Intf'%s' sig'%s'", object_name, intf_name, signal_name);
 
-       subs_id = g_dbus_connection_signal_subscribe(conn, NULL, intf_name, signal_name, object_name, \
-                        NULL , G_DBUS_SIGNAL_FLAGS_NONE , signal_cb, userdata, NULL );
+       subs_id = g_dbus_connection_signal_subscribe(conn, NULL, intf_name, signal_name, object_name,
+                                                                                               NULL, G_DBUS_SIGNAL_FLAGS_NONE , signal_cb, userdata, freefunc);
 
        if (!subs_id) {
                debug_error ("g_dbus_connection_signal_subscribe() failed ");
index 1080d4e..51d944d 100644 (file)
@@ -130,9 +130,7 @@ int main(int argc, char **argv)
 #if !defined(USE_SYSTEM_SERVER_PROCESS_MONITORING)
        int pid;
 #endif
-#ifdef TIZEN_TV
-       int fd_ss_ready = -1;
-#endif
+       int fd_fs_ready = -1;
 
        if (_get_option(argc, argv, &serveropt))
                return 1;
@@ -186,7 +184,6 @@ int main(int argc, char **argv)
                        }
                }
 
-#ifdef TIZEN_TV
                /* FIXME : This code is moved from sound_server temporally for TV migration
                                        As other modules which has dependancy on this file is cleared,
                                        this code will be removed */
@@ -197,15 +194,13 @@ int main(int argc, char **argv)
                } else {
                        debug_warning("SOUND_SERVER_READY(%s) event was created", SOUND_SERVER_READY);
                }
-#else
-               if ((fd_ss_ready = creat(SOUND_SERVER_READY, 0644)) != -1) {
-                       debug_warning("SOUND_SERVER_READY(%s) file was created", SOUND_SERVER_READY);
-                       close(fd_ss_ready);
+#endif
+               if ((fd_fs_ready = creat(FOCUS_SERVER_READY, 0644)) != -1) {
+                       debug_warning("FOCUS_SERVER_READY(%s) file was created", FOCUS_SERVER_READY);
+                       close(fd_fs_ready);
                } else {
-                       debug_error("cannot create SOUND_SERVER_READY(/tmp/.sound_server_ready)");
+                       debug_error("cannot create FOCUS_SERVER_READY(%s), errno(%d)", FOCUS_SERVER_READY, errno);
                }
-#endif
-#endif
 
                _mainloop_run();
        }
index 54b9a06..05bd28c 100644 (file)
@@ -281,14 +281,12 @@ static int _mm_sound_mgr_focus_do_watch_callback(focus_type_e focus_type, focus_
                                 *
                                 **************************************/
 RELEASE:
-                               if (filename) {
-                                       g_free (filename);
-                                       filename = NULL;
-                               }
-                               if (filename2) {
-                                       g_free (filename2);
-                                       filename2 = NULL;
-                               }
+                               g_free(filename);
+                               filename = NULL;
+
+                               g_free(filename2);
+                               filename2 = NULL;
+
                                if (fd_FOCUS != -1) {
                                        close(fd_FOCUS);
                                        fd_FOCUS = -1;
@@ -523,14 +521,12 @@ int _mm_sound_mgr_focus_do_callback(focus_command_e command, focus_node_t *victi
                _mm_sound_mgr_focus_do_watch_callback((focus_type_e)assaulter_param->request_type, command, victim_node, assaulter_param);
 
 RELEASE:
-       if (filename) {
-               g_free (filename);
-               filename = NULL;
-       }
-       if (filename2) {
-               g_free (filename2);
-               filename2 = NULL;
-       }
+       g_free(filename);
+       filename = NULL;
+
+       g_free(filename2);
+       filename2 = NULL;
+
        if (fd_FOCUS != -1) {
                close(fd_FOCUS);
                fd_FOCUS = -1;
index 1724ec2..495ae92 100644 (file)
 #endif
 
 #define PA_READY "/tmp/.pa_ready"
-
+#ifdef USE_LWIPC
 #define SOUND_SERVER_READY "/tmp/.sound_server_ready"
+#endif
+#define FOCUS_SERVER_READY "/tmp/.focus_server_ready"
 
 #define MMSOUND_ENTER_CRITICAL_SECTION(x_mutex) \
 switch ( pthread_mutex_lock( x_mutex ) ) \
index 87a6bf8..6c46fe2 100644 (file)
@@ -409,8 +409,7 @@ static void play_end_callback_data_free_func(void *data)
        struct callback_data *cb_data = (struct callback_data*) data;
 
        if (cb_data) {
-               if (cb_data->extra_data)
-                       g_free(cb_data->extra_data);
+               g_free(cb_data->extra_data);
                g_free(cb_data);
        }
 }
@@ -1295,6 +1294,11 @@ static void _focus_open_callback(int index, bool is_for_watching)
 
        debug_fenter();
 
+       if (index < 0 || index >= FOCUS_HANDLE_MAX) {
+               debug_error("Invalid focus handle index [%d]", index);
+               return;
+       }
+
        if (is_for_watching) {
                filename = g_strdup_printf("/tmp/FOCUS.%d.%d.wch", g_focus_sound_handle[index].focus_tid, g_focus_sound_handle[index].handle);
        } else {
@@ -1340,6 +1344,11 @@ void _focus_close_callback(int index, bool is_for_watching)
 
        debug_fenter();
 
+       if (index < 0 || index >= FOCUS_HANDLE_MAX) {
+               debug_error("Invalid focus handle index [%d]", index);
+               return;
+       }
+
        if (g_focus_sound_handle[index].focus_fd < 0) {
                debug_error("Close fail : index(%d)", index);
        } else {
@@ -1436,63 +1445,60 @@ static bool _focus_add_sound_callback(int index, int fd, gushort events, focus_g
        return true;
 
 ERROR:
-       if (g_src_funcs)
-               g_free(g_src_funcs);
-       if (g_poll_fd)
-               g_free(g_poll_fd);
+       g_free(g_src_funcs);
+       g_free(g_poll_fd);
        if (g_src)
                g_source_unref(g_src);
 
        return false;
 }
 
-static bool _focus_remove_sound_callback(int index, gushort events)
+static bool _focus_remove_sound_callback(int index)
 {
        bool ret = true;
+       focus_sound_info_t *h = NULL;
 
        debug_fenter();
 
-       g_mutex_clear(&g_focus_sound_handle[index].focus_lock);
+       if (index < 0 || index >= FOCUS_HANDLE_MAX) {
+               debug_error("Invalid focus handle index [%d]", index);
+               return false;
+       }
 
-       GSourceFuncs *g_src_funcs = g_focus_sound_handle[index].g_src_funcs;
-       GPollFD *g_poll_fd = g_focus_sound_handle[index].g_poll_fd;     /* store file descriptor */
-       if (!g_poll_fd) {
-               debug_error("g_poll_fd is null..");
+       h = &g_focus_sound_handle[index];
+
+       if (h->focus_src && h->g_poll_fd) {
+               debug_log("g_source_remove_poll : fd(%d), event(0x%x)",
+                               h->g_poll_fd->fd, h->g_poll_fd->events);
+               g_source_remove_poll(h->focus_src, h->g_poll_fd);
+       } else {
+               debug_error("[%d] focus_src[%p], g_poll_fd[%p]",
+                                       index, h->focus_src, h->g_poll_fd);
                ret = false;
-               goto RELEASE;
        }
-       g_poll_fd->fd = g_focus_sound_handle[index].focus_fd;
-       g_poll_fd->events = events;
 
-       if (!g_focus_sound_handle[index].focus_src) {
-               debug_error("g_focus_sound_handle[%d].focus_src is null..", index);
-               ret = false;
-               goto RELEASE;
+       if (h->focus_src) {
+               g_source_destroy(h->focus_src);
+               g_source_unref(h->focus_src);
+               h->focus_src = NULL;
        }
-       g_source_remove_poll(g_focus_sound_handle[index].focus_src, g_poll_fd);
-       debug_log("g_source_remove_poll : fd(%d), event(%x)", g_poll_fd->fd, g_poll_fd->events);
 
-RELEASE:
-       if (g_focus_sound_handle[index].focus_src)
-               g_source_destroy(g_focus_sound_handle[index].focus_src);
+       debug_log("g_free : g_src_funcs(%p), g_poll_fd(%p)",
+                       h->g_src_funcs, h->g_poll_fd);
 
-       debug_log("g_free : g_src_funcs(%x), g_poll_fd(%x)", g_src_funcs, g_poll_fd);
-       if (g_src_funcs) {
-               g_free(g_src_funcs);
-               g_src_funcs = NULL;
-       }
-       if (g_poll_fd) {
-               g_free(g_poll_fd);
-               g_poll_fd = NULL;
-       }
+       g_free(h->g_src_funcs);
+       h->g_src_funcs = NULL;
+
+       g_free(h->g_poll_fd);
+       h->g_poll_fd = NULL;
 
-       g_focus_sound_handle[index].g_src_funcs = NULL;
-       g_focus_sound_handle[index].g_poll_fd = NULL;
-       g_focus_sound_handle[index].focus_src = NULL;
-       g_focus_sound_handle[index].focus_callback = NULL;
-       g_focus_sound_handle[index].watch_callback = NULL;
+       h->focus_callback = NULL;
+       h->watch_callback = NULL;
+
+       g_mutex_clear(&h->focus_lock);
 
        debug_fleave();
+
        return ret;
 }
 
@@ -1500,16 +1506,20 @@ RELEASE:
 static void _focus_add_callback(int index, bool is_for_watching)
 {
        debug_fenter();
+
+       if (index < 0 || index >= FOCUS_HANDLE_MAX) {
+               debug_error("Invalid focus handle index [%d]", index);
+               return;
+       }
+
        if (!is_for_watching) {
-               if (!_focus_add_sound_callback(index, g_focus_sound_handle[index].focus_fd, (gushort)POLLIN | POLLPRI, _focus_callback_handler)) {
-                       debug_error("failed to _focus_add_sound_callback()");
-                       //return false;
-               }
+               if (!_focus_add_sound_callback(index, g_focus_sound_handle[index].focus_fd,
+                                                                       (gushort)POLLIN | POLLPRI, _focus_callback_handler))
+                       debug_error("failed to _focus_add_sound_callback(%p)", _focus_callback_handler);
        } else { // need to check if it's necessary
-               if (!_focus_add_sound_callback(index, g_focus_sound_handle[index].focus_fd, (gushort)POLLIN | POLLPRI, _focus_watch_callback_handler)) {
-                       debug_error("failed to _focus_add_sound_callback()");
-                       //return false;
-               }
+               if (!_focus_add_sound_callback(index, g_focus_sound_handle[index].focus_fd,
+                                                                       (gushort)POLLIN | POLLPRI, _focus_watch_callback_handler))
+                       debug_error("failed to _focus_add_sound_callback(%p)", _focus_watch_callback_handler);
        }
        debug_fleave();
 }
@@ -1517,10 +1527,8 @@ static void _focus_add_callback(int index, bool is_for_watching)
 static void _focus_remove_callback(int index)
 {
        debug_fenter();
-       if (!_focus_remove_sound_callback(index, (gushort)POLLIN | POLLPRI)) {
+       if (!_focus_remove_sound_callback(index))
                debug_error("failed to __focus_remove_sound_callback()");
-               //return false;
-       }
        debug_fleave();
 }
 
index 3cf52c5..9653075 100644 (file)
@@ -417,6 +417,9 @@ int mm_sound_pa_open(MMSoundHandleMode mode, mm_sound_handle_route_info *route_i
         handle->handle, handle->mode, handle->policy, handle->volume_type, handle->gain_type,
         handle->rate, handle->channels, ss->format, handle->stream_idx, handle->s, handle->source_type, handle_inout);
 
+    if (proplist)
+        pa_proplist_free(proplist);
+
     return handle->handle;
 
 fail:
index 1edffbd..510f092 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-sound
 Summary:    MMSound Package contains client lib and sound_server binary
-Version:    0.10.84
+Version:    0.10.87
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index d0f917e..8dc3591 100644 (file)
@@ -43,7 +43,7 @@
 
 #define _ENABLE_KEYTONE        /* Temporal test code */
 
-/* #define FOCUS_INTEGRATION */
+#define FOCUS_INTEGRATION
 
 typedef struct {
        int (*callback)(int, void *, void *, int);      /* msg_type(pid) client callback & client data info */
@@ -242,7 +242,8 @@ int MMSoundMgrCodecPlay(int *slotid, const mmsound_mgr_codec_param_t *param)
        }
 
        /*The count num means codec type WAV, MP3 */
-       debug_msg("DTMF[%d] Repeat[%d] Volume[%f] plugin_codec[%d]\n", param->tone, param->repeat_count, param->volume, count);
+       debug_msg("DTMF[%d] Repeat[%d] Volume[%f] plugin_codec[%d], session(type[%d],option[%d])\n",
+               param->tone, param->repeat_count, param->volume, count, param->session_type, param->session_options);
 
        if (g_plugins[count].GetSupportTypes == NULL) { /* Codec not found */
                debug_error("unsupported file type %d\n", count);
index e5654f0..415623f 100644 (file)
@@ -75,6 +75,7 @@ int _MMSoundMgrIpcPlayFile(char* filename,int tone, int repeat, int volume, int
        param.volume_config = volume_config;
        param.priority = priority;
        param.session_type = session_type;
+       param.session_options = session_options;
        param.param = (void*)client_pid;
        param.source = source;
        param.handle_route = handle_route;
index 1fc3ec1..b580b28 100644 (file)
@@ -298,7 +298,7 @@ send_reply:
 static void handle_method_play_file_start(GDBusMethodInvocation* invocation)
 {
        gchar* filename = NULL;
-       char *stream_type = NULL;
+       gchar *stream_type = NULL;
        gint32 ret = MM_ERROR_NONE, slotid = 0;
        gint32 tone = 0, repeat = 0, volume = 0, vol_config = 0, priority = 0;
        gint32 session_type = 0, session_option = 0, pid = 0, handle_route =0, stream_index = 0;
@@ -323,6 +323,7 @@ static void handle_method_play_file_start(GDBusMethodInvocation* invocation)
        ret = _MMSoundMgrIpcPlayFile(filename, tone, repeat, volume, vol_config, priority,
                                session_type, session_option, _get_sender_pid(invocation), handle_route, enable_session, &slotid, stream_type, stream_index);
 
+
 send_reply:
        if (ret == MM_ERROR_NONE) {
                _method_call_return_value(invocation, g_variant_new("(i)", slotid));
@@ -330,13 +331,16 @@ send_reply:
                _method_call_return_error(invocation, ret);
        }
 
+       g_free(filename);
+       g_free(stream_type);
+
        debug_fleave();
 }
 
 static void handle_method_play_file_start_with_stream_info(GDBusMethodInvocation* invocation)
 {
        gchar* filename = NULL;
-       char *stream_type = NULL;
+       gchar *stream_type = NULL;
        gint32 ret = MM_ERROR_NONE, slotid = 0;
        gint32 repeat = 0, volume = 0, priority = 0, pid = 0, handle_route =0, stream_index = 0;
        GVariant *params = NULL;
@@ -366,6 +370,9 @@ send_reply:
                _method_call_return_error(invocation, ret);
        }
 
+       g_free(filename);
+       g_free(stream_type);
+
        debug_fleave();
 }
 
@@ -373,7 +380,7 @@ static void handle_method_play_dtmf(GDBusMethodInvocation* invocation)
 {
        int ret = MM_ERROR_NONE, slotid = 0;
        int tone = 0, repeat = 0, volume = 0, vol_config = 0, session_type = 0, session_option = 0, pid = 0, stream_index = 0;
-       char* stream_type = NULL;
+       gchar* stream_type = NULL;
        gboolean enable_session = 0;
        GVariant *params = NULL;
 
@@ -398,6 +405,7 @@ send_reply:
                _method_call_return_error(invocation, ret);
        }
 
+       g_free(stream_type);
 
        debug_fleave();
 }