[pulseaudio-commits] 2 commits - src/modules src/pulsecore src/tests

Peter Meerwald pmeerw at kemper.freedesktop.org
Sun Nov 9 13:54:58 PST 2014


 src/modules/alsa/alsa-sink.c                 |    2 +-
 src/modules/alsa/alsa-source.c               |    2 +-
 src/modules/bluetooth/module-bluez4-device.c |    2 +-
 src/modules/bluetooth/module-bluez5-device.c |    2 +-
 src/modules/module-combine-sink.c            |    2 +-
 src/modules/module-esound-sink.c             |    2 +-
 src/modules/module-null-sink.c               |    2 +-
 src/modules/module-null-source.c             |    2 +-
 src/modules/module-pipe-sink.c               |    2 +-
 src/modules/module-pipe-source.c             |    2 +-
 src/modules/module-sine-source.c             |    2 +-
 src/modules/module-tunnel.c                  |    2 +-
 src/modules/oss/module-oss.c                 |    2 +-
 src/modules/raop/module-raop-sink.c          |    2 +-
 src/pulsecore/rtpoll.c                       |   14 ++++++++------
 src/pulsecore/rtpoll.h                       |    5 ++---
 src/tests/rtpoll-test.c                      |    4 ++--
 17 files changed, 26 insertions(+), 25 deletions(-)

New commits:
commit fa092af59cf64902a5caa99b4c17e2bf4bdbb290
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Tue Oct 28 13:46:37 2014 +0100

    rtpoll: Drop extra wait_op argument to pa_rtpoll_run()
    
    is always true, not used
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 31863c4..e256bbd 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1797,7 +1797,7 @@ static void thread_func(void *userdata) {
             pa_rtpoll_set_timer_disabled(u->rtpoll);
 
         /* Hmm, nothing to do. Let's sleep */
-        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
+        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
             goto fail;
 
         if (rtpoll_sleep > 0) {
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 8fb74df..111c517 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1516,7 +1516,7 @@ static void thread_func(void *userdata) {
             pa_rtpoll_set_timer_disabled(u->rtpoll);
 
         /* Hmm, nothing to do. Let's sleep */
-        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
+        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
             goto fail;
 
         if (rtpoll_sleep > 0) {
diff --git a/src/modules/bluetooth/module-bluez4-device.c b/src/modules/bluetooth/module-bluez4-device.c
index 0be0c57..aa0e037 100644
--- a/src/modules/bluetooth/module-bluez4-device.c
+++ b/src/modules/bluetooth/module-bluez4-device.c
@@ -1151,7 +1151,7 @@ static void thread_func(void *userdata) {
             pollfd->events = (short) (((u->sink && PA_SINK_IS_LINKED(u->sink->thread_info.state) && !writable) ? POLLOUT : 0) |
                                       (u->source && PA_SOURCE_IS_LINKED(u->source->thread_info.state) ? POLLIN : 0));
 
-        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) {
+        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0) {
             pa_log_debug("pa_rtpoll_run failed with: %d", ret);
             goto fail;
         }
diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c
index d077161..e6a8071 100644
--- a/src/modules/bluetooth/module-bluez5-device.c
+++ b/src/modules/bluetooth/module-bluez5-device.c
@@ -1498,7 +1498,7 @@ static void thread_func(void *userdata) {
             pollfd->events = (short) (((u->sink && PA_SINK_IS_LINKED(u->sink->thread_info.state) && !writable) ? POLLOUT : 0) |
                                       (u->source && PA_SOURCE_IS_LINKED(u->source->thread_info.state) ? POLLIN : 0));
 
-        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) {
+        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0) {
             pa_log_debug("pa_rtpoll_run failed with: %d", ret);
             goto fail;
         }
diff --git a/src/modules/module-combine-sink.c b/src/modules/module-combine-sink.c
index 9040314..4ebbc3f 100644
--- a/src/modules/module-combine-sink.c
+++ b/src/modules/module-combine-sink.c
@@ -335,7 +335,7 @@ static void thread_func(void *userdata) {
         }
 
         /* Hmm, nothing to do. Let's sleep */
-        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) {
+        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0) {
             pa_log_info("pa_rtpoll_run() = %i", ret);
             goto fail;
         }
diff --git a/src/modules/module-esound-sink.c b/src/modules/module-esound-sink.c
index bef3d8e..2410062 100644
--- a/src/modules/module-esound-sink.c
+++ b/src/modules/module-esound-sink.c
@@ -307,7 +307,7 @@ static void thread_func(void *userdata) {
             pollfd->events = (short) (PA_SINK_IS_OPENED(u->sink->thread_info.state) ? POLLOUT : 0);
         }
 
-        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
+        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
             goto fail;
 
         if (ret == 0)
diff --git a/src/modules/module-null-sink.c b/src/modules/module-null-sink.c
index c038b6c..c6493a7 100644
--- a/src/modules/module-null-sink.c
+++ b/src/modules/module-null-sink.c
@@ -226,7 +226,7 @@ static void thread_func(void *userdata) {
             pa_rtpoll_set_timer_disabled(u->rtpoll);
 
         /* Hmm, nothing to do. Let's sleep */
-        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
+        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
             goto fail;
 
         if (ret == 0)
diff --git a/src/modules/module-null-source.c b/src/modules/module-null-source.c
index e3e0167..b852f37 100644
--- a/src/modules/module-null-source.c
+++ b/src/modules/module-null-source.c
@@ -159,7 +159,7 @@ static void thread_func(void *userdata) {
             pa_rtpoll_set_timer_disabled(u->rtpoll);
 
         /* Hmm, nothing to do. Let's sleep */
-        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
+        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
             goto fail;
 
         if (ret == 0)
diff --git a/src/modules/module-pipe-sink.c b/src/modules/module-pipe-sink.c
index 4d82cc3..3404022 100644
--- a/src/modules/module-pipe-sink.c
+++ b/src/modules/module-pipe-sink.c
@@ -196,7 +196,7 @@ static void thread_func(void *userdata) {
         /* Hmm, nothing to do. Let's sleep */
         pollfd->events = (short) (u->sink->thread_info.state == PA_SINK_RUNNING ? POLLOUT : 0);
 
-        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
+        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
             goto fail;
 
         if (ret == 0)
diff --git a/src/modules/module-pipe-source.c b/src/modules/module-pipe-source.c
index 36e8732..d8d9443 100644
--- a/src/modules/module-pipe-source.c
+++ b/src/modules/module-pipe-source.c
@@ -184,7 +184,7 @@ static void thread_func(void *userdata) {
         /* Hmm, nothing to do. Let's sleep */
         pollfd->events = (short) (u->source->thread_info.state == PA_SOURCE_RUNNING ? POLLIN : 0);
 
-        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
+        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
             goto fail;
 
         if (ret == 0)
diff --git a/src/modules/module-sine-source.c b/src/modules/module-sine-source.c
index 338fedb..1d755f1 100644
--- a/src/modules/module-sine-source.c
+++ b/src/modules/module-sine-source.c
@@ -178,7 +178,7 @@ static void thread_func(void *userdata) {
             pa_rtpoll_set_timer_disabled(u->rtpoll);
 
         /* Hmm, nothing to do. Let's sleep */
-        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
+        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
             goto fail;
 
         if (ret == 0)
diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c
index cfbcd1a..bef6ae8 100644
--- a/src/modules/module-tunnel.c
+++ b/src/modules/module-tunnel.c
@@ -717,7 +717,7 @@ static void thread_func(void *userdata) {
             pa_sink_process_rewind(u->sink, 0);
 #endif
 
-        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
+        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
             goto fail;
 
         if (ret == 0)
diff --git a/src/modules/oss/module-oss.c b/src/modules/oss/module-oss.c
index d661bde..2926f67 100644
--- a/src/modules/oss/module-oss.c
+++ b/src/modules/oss/module-oss.c
@@ -1131,7 +1131,7 @@ static void thread_func(void *userdata) {
         }
 
         /* Hmm, nothing to do. Let's sleep */
-        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
+        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
             goto fail;
 
         if (ret == 0)
diff --git a/src/modules/raop/module-raop-sink.c b/src/modules/raop/module-raop-sink.c
index 13036d9..c510efd 100644
--- a/src/modules/raop/module-raop-sink.c
+++ b/src/modules/raop/module-raop-sink.c
@@ -466,7 +466,7 @@ static void thread_func(void *userdata) {
             pollfd->events = POLLOUT; /*PA_SINK_IS_OPENED(u->sink->thread_info.state)  ? POLLOUT : 0;*/
         }
 
-        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
+        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
             goto fail;
 
         if (ret == 0)
diff --git a/src/pulsecore/rtpoll.c b/src/pulsecore/rtpoll.c
index c657cb6..5f3ca8b 100644
--- a/src/pulsecore/rtpoll.c
+++ b/src/pulsecore/rtpoll.c
@@ -203,7 +203,7 @@ static void reset_all_revents(pa_rtpoll *p) {
     }
 }
 
-int pa_rtpoll_run(pa_rtpoll *p, bool wait_op) {
+int pa_rtpoll_run(pa_rtpoll *p) {
     pa_rtpoll_item *i;
     int r = 0;
     struct timeval timeout;
@@ -285,7 +285,7 @@ int pa_rtpoll_run(pa_rtpoll *p, bool wait_op) {
     pa_zero(timeout);
 
     /* Calculate timeout */
-    if (wait_op && !p->quit && p->timer_enabled) {
+    if (!p->quit && p->timer_enabled) {
         struct timeval now;
         pa_rtclock_get(&now);
 
@@ -298,7 +298,7 @@ int pa_rtpoll_run(pa_rtpoll *p, bool wait_op) {
         pa_usec_t now = pa_rtclock_now();
         p->awake = now - p->timestamp;
         p->timestamp = now;
-        if (wait_op && !p->quit && p->timer_enabled)
+        if (!p->quit && p->timer_enabled)
             pa_log("poll timeout: %d ms ",(int) ((timeout.tv_sec*1000) + (timeout.tv_usec / 1000)));
         else if (q->quit)
             pa_log("poll timeout is ZERO");
@@ -313,10 +313,10 @@ int pa_rtpoll_run(pa_rtpoll *p, bool wait_op) {
         struct timespec ts;
         ts.tv_sec = timeout.tv_sec;
         ts.tv_nsec = timeout.tv_usec * 1000;
-        r = ppoll(p->pollfd, p->n_pollfd_used, (!wait_op || p->quit || p->timer_enabled) ? &ts : NULL, NULL);
+        r = ppoll(p->pollfd, p->n_pollfd_used, (p->quit || p->timer_enabled) ? &ts : NULL, NULL);
     }
 #else
-    r = pa_poll(p->pollfd, p->n_pollfd_used, (!wait_op || p->quit || p->timer_enabled) ? (int) ((timeout.tv_sec*1000) + (timeout.tv_usec / 1000)) : -1);
+    r = pa_poll(p->pollfd, p->n_pollfd_used, (p->quit || p->timer_enabled) ? (int) ((timeout.tv_sec*1000) + (timeout.tv_usec / 1000)) : -1);
 #endif
 
     p->timer_elapsed = r == 0;
diff --git a/src/pulsecore/rtpoll.h b/src/pulsecore/rtpoll.h
index 96bb487..c0a4dda 100644
--- a/src/pulsecore/rtpoll.h
+++ b/src/pulsecore/rtpoll.h
@@ -57,11 +57,10 @@ pa_rtpoll *pa_rtpoll_new(void);
 void pa_rtpoll_free(pa_rtpoll *p);
 
 /* Sleep on the rtpoll until the time event, or any of the fd events
- * is triggered. If "wait" is 0 we don't sleep but only update the
- * struct pollfd. Returns negative on error, positive if the loop
+ * is triggered. Returns negative on error, positive if the loop
  * should continue to run, 0 when the loop should be terminated
  * cleanly. */
-int pa_rtpoll_run(pa_rtpoll *f, bool wait);
+int pa_rtpoll_run(pa_rtpoll *f);
 
 void pa_rtpoll_set_timer_absolute(pa_rtpoll *p, pa_usec_t usec);
 void pa_rtpoll_set_timer_relative(pa_rtpoll *p, pa_usec_t usec);
diff --git a/src/tests/rtpoll-test.c b/src/tests/rtpoll-test.c
index 2ac34f0..2cf8125 100644
--- a/src/tests/rtpoll-test.c
+++ b/src/tests/rtpoll-test.c
@@ -62,7 +62,7 @@ START_TEST (rtpoll_test) {
 
     pa_rtpoll_set_timer_relative(p, 10000000); /* 10 s */
 
-    pa_rtpoll_run(p, 1);
+    pa_rtpoll_run(p);
 
     pa_rtpoll_item_free(i);
 
@@ -74,7 +74,7 @@ START_TEST (rtpoll_test) {
     pollfd->fd = 0;
     pollfd->events = POLLIN;
 
-    pa_rtpoll_run(p, 1);
+    pa_rtpoll_run(p);
 
     pa_rtpoll_item_free(i);
 

commit 26385914972b4f25282c91efd9740a4b118d1852
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Tue Oct 28 13:17:00 2014 +0100

    rtpoll: Fix condition for DEBUG_TIMING output
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/pulsecore/rtpoll.c b/src/pulsecore/rtpoll.c
index 09e5e8a..c657cb6 100644
--- a/src/pulsecore/rtpoll.c
+++ b/src/pulsecore/rtpoll.c
@@ -298,10 +298,12 @@ int pa_rtpoll_run(pa_rtpoll *p, bool wait_op) {
         pa_usec_t now = pa_rtclock_now();
         p->awake = now - p->timestamp;
         p->timestamp = now;
-        if (!wait_op || p->quit || p->timer_enabled)
+        if (wait_op && !p->quit && p->timer_enabled)
             pa_log("poll timeout: %d ms ",(int) ((timeout.tv_sec*1000) + (timeout.tv_usec / 1000)));
-        else
+        else if (q->quit)
             pa_log("poll timeout is ZERO");
+        else
+            pa_log("poll timeout is FOREVER");
     }
 #endif
 



More information about the pulseaudio-commits mailing list