diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2009-11-12 16:55:43 +0100 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2009-12-01 12:47:38 +0100 |
commit | eaad1f4568ab1cf731aafe1cc28f4dffcc09d7a0 (patch) | |
tree | 809e9b7bb5ac959414d085c472aca8f5c27f3561 | |
parent | dc5d369957624f0f7968674b7cc79bf1a2e2c302 (diff) |
stream: improve transport_usec calculationtimings
Transport_usec contains the delay betweem the client and the server. When the
client and the server have synchronized clocks we can calculate this by taking
the difference between when the server generated a timing update and when we got
the reply.
Before this patch, the difference between when we generated the request and when
the server generated the reply was used, which could seriously overestimate the
transport delay when the server did a lot of work between receiving the request
and generating the reply (such as opening the device).
-rw-r--r-- | src/pulse/stream.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/pulse/stream.c b/src/pulse/stream.c index 83aeef6a5..695bf6a16 100644 --- a/src/pulse/stream.c +++ b/src/pulse/stream.c @@ -1629,10 +1629,9 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command, if (pa_timeval_cmp(&local, &remote) <= 0 && pa_timeval_cmp(&remote, &now) <= 0) { /* local and remote seem to have synchronized clocks */ - if (o->stream->direction == PA_STREAM_PLAYBACK) - i->transport_usec = pa_timeval_diff(&remote, &local); - else - i->transport_usec = pa_timeval_diff(&now, &remote); + /* the transport time with synchronized clocks is the difference + * between when the server generated the reply and when we got it */ + i->transport_usec = pa_timeval_diff(&now, &remote); i->synchronized_clocks = TRUE; i->timestamp = remote; |