[pulseaudio-commits] r2356 - /branches/glitch-free/src/pulsecore/protocol-native.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Fri May 2 18:34:45 PDT 2008
Author: lennart
Date: Sat May 3 03:34:45 2008
New Revision: 2356
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2356&root=pulseaudio&view=rev
Log:
when rewinding after the end of an underrun, make sure to rewind as much as we can, so that we deal properly with changed latencies of the sink
Modified:
branches/glitch-free/src/pulsecore/protocol-native.c
Modified: branches/glitch-free/src/pulsecore/protocol-native.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/glitch-free/src/pulsecore/protocol-native.c?rev=2356&root=pulseaudio&r1=2355&r2=2356&view=diff
==============================================================================
--- branches/glitch-free/src/pulsecore/protocol-native.c (original)
+++ branches/glitch-free/src/pulsecore/protocol-native.c Sat May 3 03:34:45 2008
@@ -1102,7 +1102,7 @@
static void handle_seek(playback_stream *s, int64_t indexw) {
playback_stream_assert_ref(s);
-/* pa_log("handle_seek: %llu -- %i", (unsigned long long) s->underrun, pa_memblockq_is_readable(s->memblockq)); */
+/* pa_log("handle_seek: %llu -- %i", (unsigned long long) s->sink_input->thread_info.underrun_for, pa_memblockq_is_readable(s->memblockq)); */
if (s->sink_input->thread_info.underrun_for > 0) {
@@ -1110,15 +1110,13 @@
if (pa_memblockq_is_readable(s->memblockq)) {
- size_t u = pa_memblockq_get_length(s->memblockq);
-
- if (u >= s->sink_input->thread_info.underrun_for)
- u = s->sink_input->thread_info.underrun_for;
-
/* We just ended an underrun, let's ask the sink
- * to rewrite */
-
- pa_sink_input_request_rewind(s->sink_input, u, TRUE, TRUE);
+ * for a complete rewind rewrite */
+
+ pa_log_debug("Requesting rewind due to end of underrun.");
+ pa_sink_input_request_rewind(s->sink_input,
+ s->sink_input->thread_info.underrun_for == (size_t) -1 ? 0 : s->sink_input->thread_info.underrun_for,
+ TRUE, TRUE);
}
} else {
@@ -1126,11 +1124,13 @@
indexr = pa_memblockq_get_read_index(s->memblockq);
- if (indexw < indexr)
+ if (indexw < indexr) {
/* OK, the sink already asked for this data, so
* let's have it usk us again */
+ pa_log_debug("Requesting rewind due to rewrite.");
pa_sink_input_request_rewind(s->sink_input, indexr - indexw, FALSE, FALSE);
+ }
}
request_bytes(s);
@@ -1162,9 +1162,9 @@
pa_assert(chunk);
-/* pa_log("sink input post: %lu", (unsigned long) chunk->length); */
-
windex = pa_memblockq_get_write_index(s->memblockq);
+
+/* pa_log("sink input post: %lu %lli", (unsigned long) chunk->length, (long long) windex); */
if (pa_memblockq_push_align(s->memblockq, chunk) < 0) {
pa_log_warn("Failed to push data into queue");
@@ -1173,6 +1173,8 @@
}
handle_seek(s, windex);
+
+/* pa_log("sink input post2: %lu", (unsigned long) pa_memblockq_get_length(s->memblockq)); */
return 0;
}
@@ -1280,7 +1282,7 @@
if (pa_memblockq_peek(s->memblockq, chunk) < 0) {
-/* pa_log("UNDERRUN"); */
+/* pa_log("UNDERRUN: %lu", pa_memblockq_get_length(s->memblockq)); */
if (s->drain_request && pa_sink_input_safe_to_remove(i)) {
s->drain_request = FALSE;
@@ -1288,7 +1290,7 @@
} else if (i->thread_info.playing_for > 0)
pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(s), PLAYBACK_STREAM_MESSAGE_UNDERFLOW, NULL, 0, NULL, NULL);
-/* pa_log("added %llu bytes, total is %llu", (unsigned long long) nbytes, (unsigned long long) s->underrun); */
+/* pa_log("adding %llu bytes, total is %llu", (unsigned long long) nbytes, (unsigned long long) i->thread_info.underrun_for); */
request_bytes(s);
More information about the pulseaudio-commits
mailing list