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
This commit is contained in:
Lennart Poettering 2010-01-08 20:07:34 +01:00 committed by Colin Guthrie
parent 66dbca1e06
commit 699233fb47
3 changed files with 55 additions and 57 deletions

View file

@ -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 */