]> code.delx.au - pulseaudio/commitdiff
print warnings about driver bugs at most once
authorLennart Poettering <lennart@poettering.net>
Sat, 21 Feb 2009 15:33:46 +0000 (16:33 +0100)
committerLennart Poettering <lennart@poettering.net>
Sat, 21 Feb 2009 15:33:46 +0000 (16:33 +0100)
src/modules/alsa/alsa-sink.c
src/modules/alsa/alsa-source.c
src/modules/alsa/alsa-util.c

index ed25a6f3139c345f76abfa455640b74446de52a2..ef51f1db486737a9645f0fbe45d4cd3cc1e05f83 100644 (file)
@@ -304,10 +304,12 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
 
         if (PA_UNLIKELY(n_bytes <= u->hwbuf_unused)) {
 
-            if (polled && pa_log_ratelimit())
-                pa_log(_("ALSA woke us up to write new data to the device, but there was actually nothing to write! "
-                         "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers. "
-                         "We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail_update() returned 0."));
+            if (polled)
+                PA_ONCE_BEGIN {
+                    pa_log(_("ALSA woke us up to write new data to the device, but there was actually nothing to write! "
+                             "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers. "
+                             "We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail_update() returned 0."));
+                } PA_ONCE_END;
 
 #ifdef DEBUG_TIMING
             pa_log_debug("Not filling up, because not necessary.");
@@ -431,10 +433,12 @@ static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
 
         if (PA_UNLIKELY(n_bytes <= u->hwbuf_unused)) {
 
-            if (polled && pa_log_ratelimit())
-                pa_log(_("ALSA woke us up to write new data to the device, but there was actually nothing to write! "
-                         "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers. "
-                         "We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail_update() returned 0."));
+            if (polled)
+                PA_ONCE_BEGIN {
+                    pa_log(_("ALSA woke us up to write new data to the device, but there was actually nothing to write! "
+                             "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers. "
+                             "We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail_update() returned 0."));
+                } PA_ONCE_END;
 
             break;
         }
index 4562689637d92078f83f7260eb23331aeb534ffc..fbc21f741d6433872d936e7fea84e63099c409f4 100644 (file)
@@ -287,10 +287,12 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
 
         if (PA_UNLIKELY(n_bytes <= 0)) {
 
-            if (polled && pa_log_ratelimit())
-                pa_log(_("ALSA woke us up to read new data from the device, but there was actually nothing to read! "
-                         "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers. "
-                         "We were woken up with POLLIN set -- however a subsequent snd_pcm_avail_update() returned 0."));
+            if (polled)
+                PA_ONCE_BEGIN {
+                    pa_log(_("ALSA woke us up to read new data from the device, but there was actually nothing to read! "
+                             "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers. "
+                             "We were woken up with POLLIN set -- however a subsequent snd_pcm_avail_update() returned 0."));
+                } PA_ONCE_END;
 
 #ifdef DEBUG_TIMING
             pa_log_debug("Not reading, because not necessary.");
@@ -406,10 +408,12 @@ static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
 
         if (PA_UNLIKELY(n_bytes <= 0)) {
 
-            if (polled && pa_log_ratelimit())
-                pa_log(_("ALSA woke us up to read new data from the device, but there was actually nothing to read! "
-                         "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers. "
-                         "We were woken up with POLLIN set -- however a subsequent snd_pcm_avail_update() returned 0."));
+            if (polled)
+                PA_ONCE_BEGIN {
+                    pa_log(_("ALSA woke us up to read new data from the device, but there was actually nothing to read! "
+                             "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers. "
+                             "We were woken up with POLLIN set -- however a subsequent snd_pcm_avail_update() returned 0."));
+                } PA_ONCE_END;
 
             break;
         }
index d00a80f157412ab34a504c69da33e7e2e359b1b5..4340cb3940571070d984bd13f820a2d3cacf98c7 100644 (file)
@@ -39,6 +39,7 @@
 #include <pulsecore/core-util.h>
 #include <pulsecore/atomic.h>
 #include <pulsecore/core-error.h>
+#include <pulsecore/once.h>
 
 #include "alsa-util.h"
 
@@ -1574,9 +1575,12 @@ snd_pcm_sframes_t pa_alsa_safe_avail(snd_pcm_t *pcm, size_t hwbuf_size, const pa
 
     if (k >= hwbuf_size * 3 ||
         k >= pa_bytes_per_second(ss)*10)
-        pa_log(_("snd_pcm_avail_update() returned a value that is exceptionally large: %lu bytes (%lu ms). "
-                 "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers."),
-               (unsigned long) k, (unsigned long) (pa_bytes_to_usec(k, ss) / PA_USEC_PER_MSEC));
+
+        PA_ONCE_BEGIN {
+            pa_log(_("snd_pcm_avail_update() returned a value that is exceptionally large: %lu bytes (%lu ms). "
+                     "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers."),
+                   (unsigned long) k, (unsigned long) (pa_bytes_to_usec(k, ss) / PA_USEC_PER_MSEC));
+        } PA_ONCE_END;
 
     return n;
 }
@@ -1606,9 +1610,11 @@ int pa_alsa_safe_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas
         k >= hwbuf_size * 3 ||
         k >= pa_bytes_per_second(ss)*10)
 
-        pa_log(_("snd_pcm_mmap_begin() returned a value that is exceptionally large: %lu bytes (%lu ms). "
-                 "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers."),
-               (unsigned long) k, (unsigned long) (pa_bytes_to_usec(k, ss) / PA_USEC_PER_MSEC));
+        PA_ONCE_BEGIN {
+            pa_log(_("snd_pcm_mmap_begin() returned a value that is exceptionally large: %lu bytes (%lu ms). "
+                     "Most likely this is an ALSA driver bug. Please report this issue to the ALSA developers."),
+                   (unsigned long) k, (unsigned long) (pa_bytes_to_usec(k, ss) / PA_USEC_PER_MSEC));
+        } PA_ONCE_END;
 
     return r;
 }