[pulseaudio-commits] r2327 - /branches/glitch-free/src/tests/interpol-test.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Thu May 1 12:25:25 PDT 2008
Author: lennart
Date: Thu May 1 21:25:24 2008
New Revision: 2327
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2327&root=pulseaudio&view=rev
Log:
some minor updates
Modified:
branches/glitch-free/src/tests/interpol-test.c
Modified: branches/glitch-free/src/tests/interpol-test.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/glitch-free/src/tests/interpol-test.c?rev=2327&root=pulseaudio&r1=2326&r2=2327&view=diff
==============================================================================
--- branches/glitch-free/src/tests/interpol-test.c (original)
+++ branches/glitch-free/src/tests/interpol-test.c Thu May 1 21:25:24 2008
@@ -42,10 +42,9 @@
static pa_stream *stream = NULL;
static pa_mainloop_api *mainloop_api = NULL;
-static void stream_write_cb(pa_stream *p, size_t length, void *userdata) {
-
+static void stream_write_cb(pa_stream *p, size_t nbytes, void *userdata) {
/* Just some silence */
- pa_stream_write(p, pa_xmalloc0(length), length, pa_xfree, 0, PA_SEEK_RELATIVE);
+ pa_stream_write(p, pa_xmalloc0(nbytes), nbytes, pa_xfree, 0, PA_SEEK_RELATIVE);
}
/* This is called whenever the context status changes */
@@ -63,7 +62,7 @@
static const pa_sample_spec ss = {
.format = PA_SAMPLE_S16LE,
.rate = 44100,
- .channels = 1
+ .channels = 2
};
fprintf(stderr, "Connection established.\n");
@@ -112,9 +111,10 @@
pa_threaded_mainloop_start(m);
for (k = 0; k < 5000; k++) {
- int success = 0, changed = 0;
+ pa_bool_t success = FALSE, changed = FALSE;
pa_usec_t t, rtc;
struct timeval now, tv;
+ pa_bool_t playing = FALSE;
pa_threaded_mainloop_lock(m);
@@ -122,22 +122,26 @@
const pa_timing_info *info;
if (pa_stream_get_time(stream, &t) >= 0)
- success = 1;
+ success = TRUE;
- if ((info = pa_stream_get_timing_info(stream)))
- if (last_info.tv_usec != info->timestamp.tv_usec || last_info.tv_sec != info->timestamp.tv_sec) {
- changed = 1;
+ if ((info = pa_stream_get_timing_info(stream))) {
+ if (memcmp(&last_info, &info->timestamp, sizeof(struct timeval))) {
+ changed = TRUE;
last_info = info->timestamp;
}
+ if (info->playing)
+ playing = TRUE;
+ }
}
pa_threaded_mainloop_unlock(m);
+ pa_gettimeofday(&now);
+
if (success) {
- pa_gettimeofday(&now);
-
rtc = pa_timeval_diff(&now, &start);
- printf("%i\t%llu\t%llu\t%llu\t%llu\t%u\n", k, (unsigned long long) rtc, (unsigned long long) t, (unsigned long long) (rtc-old_rtc), (unsigned long long) (t-old_t), changed);
+ printf("%i\t%llu\t%llu\t%llu\t%llu\t%u\t%u\n", k, (unsigned long long) rtc, (unsigned long long) t, (unsigned long long) (rtc-old_rtc), (unsigned long long) (t-old_t), changed, playing);
+ fflush(stdout);
old_t = t;
old_rtc = rtc;
}
More information about the pulseaudio-commits
mailing list