divide pa_ready and pulseaudio_ready 47/90147/4 accepted/tizen/3.0/ivi/20161011.062156 accepted/tizen/common/20160929.162932 accepted/tizen/ivi/20160930.040728 accepted/tizen/mobile/20160930.040351 accepted/tizen/tv/20160930.040538 accepted/tizen/wearable/20160930.040637 submit/tizen/20160928.043825 submit/tizen_3.0_ivi/20161010.000006
authorMok Jeongho <jho.mok@samsung.com>
Wed, 28 Sep 2016 13:11:12 +0000 (22:11 +0900)
committerMok Jeongho <jho.mok@samsung.com>
Thu, 29 Sep 2016 04:19:10 +0000 (13:19 +0900)
Change-Id: Iaa28a573e57df4d2af4eea4bcdd53c7a25454370

packaging/pulseaudio.spec
src/daemon/main.c

index 512e134..edbc6e0 100644 (file)
@@ -11,7 +11,7 @@
 Name:             pulseaudio
 Summary:          Improved Linux sound server
 Version:          5.0
-Release:          95
+Release:          96
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
 URL:              http://pulseaudio.org
@@ -224,6 +224,9 @@ export CFLAGS+=" -DTIZEN_PROFILE_WEARABLE -DADJUST_ANDROID_BITPOOL"
 %if "%{?tizen_profile_name}" == "tv"
 echo "tizen profile tv"
 export CFLAGS+=" -DTIZEN_PROFILE_TV "
+%if "%{?TIZEN_PRODUCT_TV}" == "1"
+export CFLAGS+=" -DTIZEN_FEATURE_TV_PROD "
+%endif
 %endif
 
 export LD_AS_NEEDED=0
index 5ee6c85..ea4ad79 100755 (executable)
@@ -99,9 +99,6 @@
 #include <pulsecore/cpu-x86.h>
 #include <pulsecore/cpu-orc.h>
 
-#if defined (USE_PA_READY) && defined (USE_LWIPC)
-#include <lwipc.h>
-#endif
 #include "cmdline.h"
 #include "cpulimit.h"
 #include "daemon-conf.h"
 #include "server-lookup.h"
 
 #ifdef __TIZEN__
-#ifdef USE_PA_READY
+
+#ifdef TIZEN_FEATURE_TV_PROD
 #ifdef USE_LWIPC
-#define PA_READY "pulseaudio_ready"
+#include <lwipc.h>
+#define PULSEAUDIO_READY "pulseaudio_ready"
 #else
-#define PA_READY "/tmp/.pa_ready"
+#define PULSEAUDIO_READY "/tmp/.pulseaudio_ready"
 #endif
+#endif /* TIZEN_FEATURE_TV_PROD */
+
+#ifdef USE_PA_READY
+#define PA_READY "/tmp/.pa_ready"
 #endif
+
 #endif /* __TIZEN__ */
 #ifdef HAVE_LIBWRAP
 /* Only one instance of these variables */
@@ -412,6 +416,26 @@ fail:
 }
 #endif
 
+#ifdef __TIZEN__
+static int create_ready_file(const char *path) {
+    int ready_fd = -1;
+
+    if (path == NULL) {
+        pa_log_error("Ready file path is null");
+        return -1;
+    }
+
+    if ((ready_fd = creat(path, 0644)) == -1) {
+        pa_log_error("Failed to create READY FILE(%s) : %s", path, pa_cstrerror(errno));
+        return -1;
+    }
+
+    pa_log_warn("READY FILE (%s) was created", path);
+    close(ready_fd);
+    return 0;
+}
+#endif
+
 int main(int argc, char *argv[]) {
     pa_core *c = NULL;
     pa_strbuf *buf = NULL;
@@ -441,12 +465,6 @@ int main(int argc, char *argv[]) {
     bool start_server;
 #endif
 
-#ifdef __TIZEN__
-#if defined(USE_PA_READY) && !defined(USE_LWIPC)
-    int fd_pa_ready = -1;
-#endif
-#endif /* __TIZEN__ */
-
     pa_log_set_ident("pulseaudio");
     pa_log_set_level(PA_LOG_NOTICE);
     pa_log_set_flags(PA_LOG_COLORS|PA_LOG_PRINT_FILE|PA_LOG_PRINT_LEVEL, PA_LOG_RESET);
@@ -1202,14 +1220,19 @@ int main(int argc, char *argv[]) {
 #ifdef __TIZEN__
     /* broadcast if we're ready */
 #ifdef USE_PA_READY
+    if (create_ready_file(PA_READY) < 0)
+        pa_log_error("Failed to create ready file(%s) for other audio service", PA_READY);
+#endif
+
+#ifdef TIZEN_FEATURE_TV_PROD
 #ifdef USE_LWIPC
-    if (LwipcEventDone(PA_READY) < 0)
-        pa_log_error("cannot create PULSEAUDIO_READY(pulseaudio_ready)");
+    if (LwipcEventDone(PULSEAUDIO_READY) < 0)
+        pa_log_error("cannot create PULSEAUDIO_READY(%s)", PULSEAUDIO_READY);
     else
-        pa_log_warn("PULSEAUDIO_READY(%s) event was created", PA_READY);
+        pa_log_warn("PULSEAUDIO_READY(%s) event was created", PULSEAUDIO_READY);
 #else
-    if ((fd_pa_ready = creat(PA_READY, 0644)) != -1)
-        close(fd_pa_ready);
+    if (create_ready_file(PULSEAUDIO_READY) < 0)
+        pa_log_error("Failed to create ready file(%s) for external services", PULSEAUDIO_READY);
 #endif
 #endif
 #endif /* __TIZEN__ */