Add pa-ready feature 35/169335/5
authorSeungbae Shin <seungbae.shin@samsung.com>
Tue, 6 Feb 2018 05:17:55 +0000 (14:17 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Fri, 9 Feb 2018 06:45:00 +0000 (06:45 +0000)
original patches
 :44106a0434254ce6798fcd6cb8a06642fb6a2d7c - jho.mok@samsung.com - 2016-09-08- make pa-ready as feature
 :4c30a4731d5ab495a3e5105396f09a31f931b739 - jaska.uimonen@intel.com - 2013-08-08 - create pa_ready file - samsung

[Version] 11.1-11
[Issue Type] feature

Change-Id: Ief098e2aaed7e94d8f8d9ef03e98ce7b8284c700

configure.ac
packaging/pulseaudio.spec
src/Makefile.am
src/daemon/main.c

index 24cfc36..a8408da 100644 (file)
@@ -1491,6 +1491,18 @@ AC_ARG_ENABLE(udev-with-usb-only, AC_HELP_STRING([--enable-udev-with-usb-only],
 ],[TIZEN_UDEV_USB_ONLY=no])
 AM_CONDITIONAL(TIZEN_UDEV_USB_ONLY, test "x$TIZEN_UDEV_USB_ONLY" = "xyes")
 
+#### PA READY ####
+
+AC_ARG_ENABLE(paready, AC_HELP_STRING([--enable-paready], [enable pulseaudio ready feature]),
+[
+ case "${enableval}" in
+     yes) TIZEN_PA_READY=yes ;;
+     no)  TIZEN_PA_READY=no ;;
+     *)   AC_MSG_ERROR(bad value ${enableval} for --enable-paready) ;;
+ esac
+ ],[TIZEN_PA_READY=no])
+AM_CONDITIONAL([TIZEN_PA_READY], [test "x$TIZEN_PA_READY" = "xyes"])
+
 ###################################
 #            Output               #
 ###################################
@@ -1744,6 +1756,7 @@ echo "
       pcm dump:                    ${TIZEN_PCM_DUMP}
       security:                    ${TIZEN_SECURITY}
       udev with usb only:          ${TIZEN_UDEV_USB_ONLY}
+      pa ready:                    ${TIZEN_PA_READY}
 "
 
 if test "${ENABLE_SPEEX}" = "no" && test "${ENABLE_WEBRTC}" = "no" && test "${ENABLE_ADRIAN_EC}" = "no" ; then
index 07148b0..826bc5b 100644 (file)
@@ -3,7 +3,7 @@
 Name:             pulseaudio
 Summary:          Improved Linux sound server
 Version:          11.1
-Release:          10
+Release:          11
 Group:            Multimedia/Audio
 License:          LGPL-2.1
 URL:              http://pulseaudio.org
@@ -204,6 +204,7 @@ NOCONFIGURE=yes ./bootstrap.sh
         --enable-pcm-dump \
         --enable-security \
         --enable-udev-with-usb-only \
+        --enable-paready \
 
 %__make %{?_smp_mflags} V=0
 
index ff2668f..679e7e0 100644 (file)
@@ -185,6 +185,10 @@ if TIZEN_DLOG
 pulseaudio_CFLAGS += -DTIZEN_DLOG
 endif
 
+if TIZEN_PA_READY
+pulseaudio_CFLAGS += -DTIZEN_PA_READY
+endif
+
 ###################################
 #       Utility programs          #
 ###################################
index f35252d..d264910 100644 (file)
 #include "ltdl-bind-now.h"
 #include "server-lookup.h"
 
+#ifdef TIZEN_PA_READY
+#include <fcntl.h>
+#define PA_READY "/tmp/.pa_ready"
+#endif
+
 #ifdef HAVE_LIBWRAP
 /* Only one instance of these variables */
 int allow_severity = LOG_INFO;
@@ -366,6 +371,31 @@ fail:
 }
 #endif
 
+#ifdef TIZEN_PA_READY
+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;
+}
+
+static void notify_daemon_ready(void) {
+    if (create_ready_file(PA_READY) < 0)
+        pa_log_error("Failed to create ready file(%s) for other audio service", PA_READY);
+}
+#endif /* TIZEN_PA_READY */
+
 int main(int argc, char *argv[]) {
     pa_core *c = NULL;
     pa_strbuf *buf = NULL;
@@ -1134,6 +1164,11 @@ int main(int argc, char *argv[]) {
 
     pa_log_info("Daemon startup complete.");
 
+#ifdef TIZEN_PA_READY
+    /* broadcast if we're ready */
+    notify_daemon_ready();
+#endif
+
 #ifdef HAVE_SYSTEMD_DAEMON
     sd_notify(0, "READY=1");
 #endif