Fix not to shutdown when playing streams. 15/185915/2
authorSeungbae Shin <seungbae.shin@samsung.com>
Fri, 3 Aug 2018 10:44:27 +0000 (19:44 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Mon, 6 Aug 2018 05:10:11 +0000 (14:10 +0900)
[Version] 0.12.25
[Issue Type] Bug

Change-Id: I63ed17dce2a220c2374c0cdbff68bae0663ac1cd

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

index 28dd206..00d815b 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-sound
 Summary:    MMSound Package contains client lib and sound_server binary
-Version:    0.12.24
+Version:    0.12.25
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 61ba338..571b196 100644 (file)
@@ -72,6 +72,31 @@ guint g_timer_id = 0;
 
 static int _MMSoundMgrCodecRegisterInterface(MMSoundPluginType *plugin);
 static int _MMSoundMgrCodecStopCallback(int param);
+static gboolean _mm_sound_mgr_codec_slot_is_empty();
+
+static gboolean _idle_cb(gpointer user_data)
+{
+       if (_mm_sound_mgr_codec_slot_is_empty()) {
+               debug_msg("slot is empty, ready to shutdown! %p", g_shutdown_cb);
+               if (g_shutdown_cb)
+                       g_shutdown_cb(NULL);
+       } else {
+               debug_warning("slot is not empty!!! no shutdown...");
+       }
+
+       return FALSE;
+}
+
+static gboolean _timeout_cb(gpointer user_data)
+{
+       debug_warning("TIMEOUT : add idle callback now...");
+
+       g_idle_add(_idle_cb, NULL);
+       g_timer_id = 0;
+
+       return FALSE;
+}
+
 
 /* FIXME : critical section for g_timer_id? */
 static void _mm_sound_mgr_codec_shutdown_timer_start()
@@ -80,9 +105,8 @@ static void _mm_sound_mgr_codec_shutdown_timer_start()
                debug_error("Already active timer [%d] exists", g_timer_id);
                return;
        }
-
        if (g_shutdown_cb) {
-               g_timer_id = g_timeout_add_seconds(SHUTDOWN_TIMEOUT_SEC, g_shutdown_cb, NULL);
+               g_timer_id = g_timeout_add_seconds(SHUTDOWN_TIMEOUT_SEC, _timeout_cb, NULL);
                debug_error("TIMER : new timer [%d]", g_timer_id);
        } else {
                debug_warning("No Timer started due to invalid shutdown callback");