From 699233fb47d133f6ea1e36e8354a386c23608d5a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 8 Jan 2010 20:07:34 +0100 Subject: native: fix request counter miscalculations Do not subtract bytes the client sends us beyond what we requested from our missing bytes counter. This was mostly a thinko that caused servers asking for too little data when the client initially sent more data than requested, because that data sent too much was accounted for twice. This commit fixes this miscalculation. http://bugzilla.redhat.com/show_bug.cgi?id=534130 --- src/pulse/stream.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/pulse/stream.c') diff --git a/src/pulse/stream.c b/src/pulse/stream.c index 40812566..0f9e50ab 100644 --- a/src/pulse/stream.c +++ b/src/pulse/stream.c @@ -741,6 +741,8 @@ void pa_command_request(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tag s->requested_bytes += bytes; + /* pa_log("got request for %lli, now at %lli", (long long) bytes, (long long) s->requested_bytes); */ + if (s->requested_bytes > 0 && s->write_callback) s->write_callback(s, (size_t) s->requested_bytes, s->write_userdata); @@ -1362,6 +1364,8 @@ int pa_stream_write( * that's OK, the server side applies the same error */ s->requested_bytes -= (seek == PA_SEEK_RELATIVE ? offset : 0) + (int64_t) length; + /* pa_log("wrote %lli, now at %lli", (long long) length, (long long) s->requested_bytes); */ + if (s->direction == PA_STREAM_PLAYBACK) { /* Update latency request correction */ -- cgit