summaryrefslogtreecommitdiffstats
path: root/src/tests/interpol-test.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-03-05 04:32:16 +0100
committerLennart Poettering <lennart@poettering.net>2009-03-05 04:32:16 +0100
commit9d29b96ac08c2762b27f6b191ec5807ee3ce58e7 (patch)
tree7c5524bdec5906a06e5c082c46fab5e875ef421e /src/tests/interpol-test.c
parent6427c70a851709ac12489808159a89e8498c8230 (diff)
make interpol test more interesting by corking/uncorking multiple times
Diffstat (limited to 'src/tests/interpol-test.c')
-rw-r--r--src/tests/interpol-test.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/tests/interpol-test.c b/src/tests/interpol-test.c
index 5f7ebb76..dd24e829 100644
--- a/src/tests/interpol-test.c
+++ b/src/tests/interpol-test.c
@@ -107,6 +107,7 @@ int main(int argc, char *argv[]) {
int k, r;
struct timeval start, last_info = { 0, 0 };
pa_usec_t old_t = 0, old_rtc = 0;
+ pa_bool_t corked = FALSE;
playback = argc <= 1 || !pa_streq(argv[1], "-r");
@@ -129,7 +130,7 @@ int main(int argc, char *argv[]) {
r = pa_threaded_mainloop_start(m);
assert(r >= 0);
- for (k = 0; k < 5000; k++) {
+ for (k = 0; k < 20000; k++) {
pa_bool_t success = FALSE, changed = FALSE;
pa_usec_t t, rtc;
struct timeval now, tv;
@@ -158,6 +159,8 @@ int main(int argc, char *argv[]) {
pa_gettimeofday(&now);
if (success) {
+ pa_bool_t cork_now;
+
rtc = pa_timeval_diff(&now, &start);
printf("%i\t%llu\t%llu\t%llu\t%llu\t%u\t%u\n", k,
(unsigned long long) rtc,
@@ -170,6 +173,18 @@ int main(int argc, char *argv[]) {
fflush(stdout);
old_t = t;
old_rtc = rtc;
+
+ cork_now = (rtc / (2*PA_USEC_PER_SEC)) % 2 == 1;
+
+ if (corked != cork_now) {
+ pa_threaded_mainloop_lock(m);
+ pa_operation_unref(pa_stream_cork(stream, cork_now, NULL, NULL));
+ pa_threaded_mainloop_unlock(m);
+
+ pa_log(cork_now ? "Corking" : "Uncorking");
+
+ corked = cork_now;
+ }
}
/* Spin loop, ugly but normal usleep() is just too badly grained */