- pa_stream_write(p, pa_xmalloc0(length), length, pa_xfree, 0, PA_SEEK_RELATIVE);
+
+ for (;;) {
+ void *data;
+
+ fail_unless((nbytes = pa_stream_writable_size(p)) != (size_t) -1);
+
+ if (nbytes <= 0)
+ break;
+
+ fail_unless(pa_stream_begin_write(p, &data, &nbytes) == 0);
+ pa_memzero(data, nbytes);
+ fail_unless(pa_stream_write(p, data, nbytes, NULL, 0, PA_SEEK_RELATIVE) == 0);
+ }
+}
+
+static void stream_read_cb(pa_stream *p, size_t nbytes, void *userdata) {
+ /* We don't care about the data, just drop it */
+
+ for (;;) {
+ const void *data;
+
+ pa_assert_se((nbytes = pa_stream_readable_size(p)) != (size_t) -1);
+
+ if (nbytes <= 0)
+ break;
+
+ fail_unless(pa_stream_peek(p, &data, &nbytes) == 0);
+ fail_unless(pa_stream_drop(p) == 0);
+ }
+}
+
+static void stream_latency_cb(pa_stream *p, void *userdata) {
+#ifndef INTERPOLATE
+ pa_operation *o;
+
+ o = pa_stream_update_timing_info(p, NULL, NULL);
+ pa_operation_unref(o);
+#endif