Check pulseaudio ready file in _mm_sound_play_keysound 24/170924/1 accepted/tizen/unified/20180227.062923 submit/tizen/20180226.072000
authorJungsup Lee <jungsup4.lee@samsung.com>
Tue, 20 Feb 2018 04:43:12 +0000 (13:43 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Fri, 23 Feb 2018 07:37:06 +0000 (16:37 +0900)
Check "/tmp/.pulseaudio_ready" file before access "/tmp/keytone"

[Version] 0.12.11
[Issue Type] Bug Fix

Signed-off-by: Jungsup Lee <jungsup4.lee@samsung.com>
Change-Id: Ib5d91e2733bdf390f277faf1efcb2d4cdfbbec48

Makefile.am
mm_sound_keysound.c
packaging/libmm-sound.spec

index d3a162cd47292469c27b585695ec45b6c6edcfd4..3b201a9785ce7d50e3008c42013f9df305b0c442 100644 (file)
@@ -83,6 +83,11 @@ libmmfkeysound_la_LIBADD = $(MMCOMMON_LIBS) $(VCONF_LIBS) $(GIO_LIBS)
 libmmfkeysound_la_CFLAGS += $(MMLOGSVR_CFLAGS) -DMMF_LOG_OWNER=0x020 -DMMF_DEBUG_PREFIX=\"MMF-SOUND\"
 libmmfkeysound_la_LIBADD += $(MMLOGSVR_LIBS)
 
+if USE_LWIPC
+libmmfkeysound_la_CFLAGS += $(LWIPC_CFLAGS) -DUSE_LWIPC
+libmmfkeysound_la_LIBADD += $(LWIPC_LIBS)
+endif
+
 lib_LTLIBRARIES += libmmfbootsound.la
 
 includelibmmfbootsounddir = $(includedir)/mmf
index def3eeaf377dac0aa748aacac21d7b8273a47f8b..dcac05121a9709bdfb0de78cf47652d86524e903 100644 (file)
 
 #include "include/mm_sound_common.h"
 
+#ifdef USE_LWIPC
+#include <lwipc.h>
+#define PULSEAUDIO_READY "/tmp/.pulseaudio_ready"
+#endif
+
 #define PA_BUS_NAME                              "org.pulseaudio.Server"
 #define PA_SOUND_PLAYER_OBJECT_PATH              "/org/pulseaudio/SoundPlayer"
 #define PA_SOUND_PLAYER_INTERFACE                "org.pulseaudio.SoundPlayer"
@@ -118,12 +123,38 @@ int mm_sound_play_keysound(const char *filename, int volume_config)
        return _mm_sound_play_keysound(filename, volume_config, IPC_TYPE_PIPE);
 }
 
+#ifdef USE_LWIPC
+static bool _mm_sound_check_pa_ready()
+{
+       int ret = 0;
+       static bool is_pa_ready = false;
+
+       if (is_pa_ready)
+               return true;
+
+       debug_msg("LwipcIsDone start >> ");
+       ret = LwipcIsDone(PULSEAUDIO_READY);
+       debug_msg("LwipcIsDone end << %d", ret);
+
+       is_pa_ready = (ret > 0) ? true : false;
+
+       return is_pa_ready;
+}
+#endif
+
 static int _mm_sound_play_keysound(const char *filename, int volume_config, ipc_type_t ipc_type)
 {
        int ret = MM_ERROR_NONE;
        const char *role = NULL;
        const char *vol_gain_type = NULL;
 
+#ifdef USE_LWIPC
+       if (!_mm_sound_check_pa_ready()) {
+               debug_error("Pulseaudio is not ready!");
+               return MM_ERROR_SOUND_INVALID_STATE;
+       }
+#endif
+
        if (!filename)
                return MM_ERROR_SOUND_INVALID_FILE;
 
index af0acd0b953255b4455c4abc72c369380e2a617b..6987d570ea18e6ffbd7692518b5800dc0823070d 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-sound
 Summary:    MMSound Package contains client lib and sound_server binary
-Version:    0.12.10
+Version:    0.12.11
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0