[polypaudio-commits] r705 - /trunk/src/polypcore/protocol-native.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Thu Apr 13 11:27:35 PDT 2006


Author: lennart
Date: Thu Apr 13 20:27:35 2006
New Revision: 705

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=705&root=polypaudio&view=rev
Log:
include in-flux resampled chunk in latency calculations of playback streams

Modified:
    trunk/src/polypcore/protocol-native.c

Modified: trunk/src/polypcore/protocol-native.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/protocol-native.c?rev=705&root=polypaudio&r1=704&r2=705&view=diff
==============================================================================
--- trunk/src/polypcore/protocol-native.c (original)
+++ trunk/src/polypcore/protocol-native.c Thu Apr 13 20:27:35 2006
@@ -1045,6 +1045,7 @@
     struct playback_stream *s;
     struct timeval tv, now;
     uint32_t idx;
+    pa_usec_t latency;
     assert(c && t);
     
     if (pa_tagstruct_getu32(t, &idx) < 0 ||
@@ -1060,7 +1061,12 @@
     CHECK_VALIDITY(c->pstream, s->type == PLAYBACK_STREAM, tag, PA_ERR_NOENTITY);
 
     reply = reply_new(tag);
-    pa_tagstruct_put_usec(reply, pa_sink_get_latency(s->sink_input->sink));
+
+    latency = pa_sink_get_latency(s->sink_input->sink);
+    if (s->sink_input->resampled_chunk.memblock)
+        latency += pa_bytes_to_usec(s->sink_input->resampled_chunk.length, &s->sink_input->sample_spec);
+    pa_tagstruct_put_usec(reply, latency);
+    
     pa_tagstruct_put_usec(reply, 0);
     pa_tagstruct_put_boolean(reply, pa_memblockq_is_readable(s->memblockq));
     pa_tagstruct_put_timeval(reply, &tv);




More information about the pulseaudio-commits mailing list