mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
make interpol test more interesting by corking/uncorking multiple times
This commit is contained in:
parent
6427c70a85
commit
9d29b96ac0
1 changed files with 16 additions and 1 deletions
|
|
@ -107,6 +107,7 @@ int main(int argc, char *argv[]) {
|
||||||
int k, r;
|
int k, r;
|
||||||
struct timeval start, last_info = { 0, 0 };
|
struct timeval start, last_info = { 0, 0 };
|
||||||
pa_usec_t old_t = 0, old_rtc = 0;
|
pa_usec_t old_t = 0, old_rtc = 0;
|
||||||
|
pa_bool_t corked = FALSE;
|
||||||
|
|
||||||
playback = argc <= 1 || !pa_streq(argv[1], "-r");
|
playback = argc <= 1 || !pa_streq(argv[1], "-r");
|
||||||
|
|
||||||
|
|
@ -129,7 +130,7 @@ int main(int argc, char *argv[]) {
|
||||||
r = pa_threaded_mainloop_start(m);
|
r = pa_threaded_mainloop_start(m);
|
||||||
assert(r >= 0);
|
assert(r >= 0);
|
||||||
|
|
||||||
for (k = 0; k < 5000; k++) {
|
for (k = 0; k < 20000; k++) {
|
||||||
pa_bool_t success = FALSE, changed = FALSE;
|
pa_bool_t success = FALSE, changed = FALSE;
|
||||||
pa_usec_t t, rtc;
|
pa_usec_t t, rtc;
|
||||||
struct timeval now, tv;
|
struct timeval now, tv;
|
||||||
|
|
@ -158,6 +159,8 @@ int main(int argc, char *argv[]) {
|
||||||
pa_gettimeofday(&now);
|
pa_gettimeofday(&now);
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
|
pa_bool_t cork_now;
|
||||||
|
|
||||||
rtc = pa_timeval_diff(&now, &start);
|
rtc = pa_timeval_diff(&now, &start);
|
||||||
printf("%i\t%llu\t%llu\t%llu\t%llu\t%u\t%u\n", k,
|
printf("%i\t%llu\t%llu\t%llu\t%llu\t%u\t%u\n", k,
|
||||||
(unsigned long long) rtc,
|
(unsigned long long) rtc,
|
||||||
|
|
@ -170,6 +173,18 @@ int main(int argc, char *argv[]) {
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
old_t = t;
|
old_t = t;
|
||||||
old_rtc = rtc;
|
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 */
|
/* Spin loop, ugly but normal usleep() is just too badly grained */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue