diff options
author | Lennart Poettering <lennart@poettering.net> | 2008-05-09 22:28:38 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2008-05-09 22:28:38 +0000 |
commit | 580d56358d9d15792613fc4be886c71059c58a36 (patch) | |
tree | 4f7b248821153c3644e967395912d7b5b625120c | |
parent | 0ea0e0694ecd5e8b626b8e8414d5c8f7107233a3 (diff) |
modify test to generate data events out-of-order
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/glitch-free@2391 fefdeb5f-60dc-0310-8127-8f9354f1896f
-rw-r--r-- | src/tests/smoother-test.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/tests/smoother-test.c b/src/tests/smoother-test.c index 0816e76c..de037724 100644 --- a/src/tests/smoother-test.c +++ b/src/tests/smoother-test.c @@ -47,25 +47,25 @@ int main(int argc, char*argv[]) { 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; |