Invoke stop callback always 76/127476/2 accepted/tizen/unified/20170428.032929 submit/tizen/20170427.124253
authorJeongho Mok <jho.mok@samsung.com>
Thu, 27 Apr 2017 10:13:26 +0000 (19:13 +0900)
committerJeongho Mok <jho.mok@samsung.com>
Thu, 27 Apr 2017 12:33:32 +0000 (21:33 +0900)
[Version] 0.10.110
[Profile] Common
[Issue Type] Fix Bug

Change-Id: I62a7907b11cafccf7d277ef435ca9a4ddc4892a1

packaging/libmm-sound.spec
server/mm_sound_mgr_codec.c
server/mm_sound_thread_pool.c

index e0d8d1d..b7bbe9a 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-sound
 Summary:    MMSound Package contains client lib and sound_server binary
-Version:    0.10.109
+Version:    0.10.110
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index e057f86..f0437fd 100644 (file)
@@ -944,13 +944,13 @@ static int _MMSoundMgrCodecStopCallback(int param)
 {
        int err = MM_ERROR_NONE;
 
-       debug_enter("(Slot : %d)\n", param);
-
        if (param < 0 || param >= MANAGER_HANDLE_MAX) {
                debug_error ("Slot index param [%d] is invalid", param);
                return MM_ERROR_INVALID_ARGUMENT;
        }
 
+       debug_enter("(Slot : %d) stop-by-user : %d\n", param, g_slots[param].stop_by_user);
+
        if (g_slots[param].stop_by_user == false) {
                SLOT_LOCK();
        }
@@ -996,10 +996,8 @@ static int _MMSoundMgrCodecStopCallback(int param)
        }
 #endif
 
-       if (g_slots[param].stop_by_user == false) {
-               __mm_sound_mgr_ipc_notify_play_file_end(param);
-               debug_msg("Client callback msg_type (instance) : [%d]\n", (int)g_slots[param].param);
-       }
+       __mm_sound_mgr_ipc_notify_play_file_end(param);
+       debug_msg("Client callback msg_type (instance) : [%d]\n", (int)g_slots[param].param);
 
        debug_msg("Handle allocated handle : [0x%08X]\n", g_slots[param].plughandle);
        err = g_plugins[g_slots[param].pluginid].Destroy(g_slots[param].plughandle);
index 7434a2c..659fe1d 100644 (file)
@@ -91,6 +91,8 @@ int MMSoundThreadPoolInit()
        int i=0;
        GError *error = NULL;
 
+       debug_enter();
+
        /* Create thread pool (non-exclude mode with infinite max threads) */
        g_pool = g_thread_pool_new(__ThreadWork, NULL, -1, FALSE, &error);
        if (g_pool == NULL && error != NULL) {
@@ -116,6 +118,8 @@ int MMSoundThreadPoolInit()
 
        MMSoundThreadPoolDump(TRUE);
 
+       debug_leave();
+
        return MM_ERROR_NONE;
 }
 
@@ -123,6 +127,13 @@ int MMSoundThreadPoolRun(void *param, void (*func)(void*))
 {
        GError *error = NULL;
 
+       debug_enter();
+
+       if (g_pool == NULL) {
+               debug_error("No thread pool initialized....\n");
+               return MM_ERROR_SOUND_INTERNAL;
+       }
+
        /* Dump current thread pool */
        MMSoundThreadPoolDump(FALSE);
 
@@ -147,6 +158,8 @@ int MMSoundThreadPoolRun(void *param, void (*func)(void*))
                return MM_ERROR_SOUND_INTERNAL;
        }
 
+       debug_leave();
+
        return MM_ERROR_NONE;
 }
 
@@ -160,8 +173,14 @@ int MMSoundThreadPoolFini(void)
        If wait_ is TRUE, the functions does not return before all tasks to be processed
        (dependent on immediate, whether all or only the currently running) are ready.
        Otherwise the function returns immediately. */
-       debug_msg("thread pool will be free\n");
-       g_thread_pool_free(g_pool, TRUE, FALSE);
+       debug_enter();
+
+       if (g_pool) {
+               debug_msg("thread pool will be free\n");
+               g_thread_pool_free(g_pool, TRUE, FALSE);
+               g_pool = NULL;
+       }
 
+       debug_leave();
        return MM_ERROR_NONE;
 }