[pulseaudio-commits] r2391 - /branches/glitch-free/src/tests/smoother-test.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Fri May 9 15:28:39 PDT 2008


Author: lennart
Date: Sat May 10 00:28:38 2008
New Revision: 2391

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2391&root=pulseaudio&view=rev
Log:
modify test to generate data events out-of-order

Modified:
    branches/glitch-free/src/tests/smoother-test.c

Modified: branches/glitch-free/src/tests/smoother-test.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/glitch-free/src/tests/smoother-test.c?rev=2391&root=pulseaudio&r1=2390&r2=2391&view=diff
==============================================================================
--- branches/glitch-free/src/tests/smoother-test.c (original)
+++ branches/glitch-free/src/tests/smoother-test.c Sat May 10 00:28:38 2008
@@ -47,25 +47,25 @@
 
     srand(0);
 
-    for (m = 0, u = 0; u < PA_ELEMENTSOF(msec)-2; u+= 2) {
+    for (m = 0, u = 0; u < PA_ELEMENTSOF(msec); u+= 2) {
 
-        msec[u] = m+1;
-        msec[u+1] = m + rand() % 2000 - 1000;
+        msec[u] = m+1 + (rand() % 100) - 50;
+        msec[u+1] = m + (rand() % 2000) - 1000;
 
         m += rand() % 100;
+
+        if (msec[u] < 0)
+            msec[u] = 0;
 
         if (msec[u+1] < 0)
             msec[u+1] = 0;
     }
 
-    msec[PA_ELEMENTSOF(msec)-2] = 0;
-    msec[PA_ELEMENTSOF(msec)-1] = 0;
-
-    s = pa_smoother_new(1000*PA_USEC_PER_MSEC, 2000*PA_USEC_PER_MSEC, TRUE);
+    s = pa_smoother_new(700*PA_USEC_PER_MSEC, 2000*PA_USEC_PER_MSEC, TRUE, 6);
 
     for (x = 0, u = 0; x < PA_USEC_PER_SEC * 10; x += PA_USEC_PER_MSEC) {
 
-        while (msec[u] > 0 && (pa_usec_t) msec[u]*PA_USEC_PER_MSEC < x) {
+        while (u < PA_ELEMENTSOF(msec) && (pa_usec_t) msec[u]*PA_USEC_PER_MSEC < x) {
             pa_smoother_put(s, msec[u]*PA_USEC_PER_MSEC, msec[u+1]*PA_USEC_PER_MSEC);
             printf("%i\t\t%i\n", msec[u],  msec[u+1]);
             u += 2;




More information about the pulseaudio-commits mailing list