[polypaudio-commits] r1029 - in /trunk/src/polyp: internal.h stream.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Mon Jun 19 05:37:45 PDT 2006
Author: lennart
Date: Mon Jun 19 14:37:43 2006
New Revision: 1029
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1029&root=polypaudio&view=rev
Log:
* rework latency interpolation to make it smoother
* increase latency update interval to 100ms
Modified:
trunk/src/polyp/internal.h
trunk/src/polyp/stream.c
Modified: trunk/src/polyp/internal.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/internal.h?rev=1029&root=polypaudio&r1=1028&r2=1029&view=diff
==============================================================================
--- trunk/src/polyp/internal.h (original)
+++ trunk/src/polyp/internal.h Mon Jun 19 14:37:43 2006
@@ -136,9 +136,8 @@
pa_time_event *auto_timing_update_event;
int auto_timing_update_requested;
- pa_usec_t ipol_usec;
- int ipol_usec_valid;
- struct timeval ipol_timestamp;
+ pa_usec_t cached_time;
+ int cached_time_valid;
/* Callbacks */
pa_stream_notify_cb_t state_callback;
Modified: trunk/src/polyp/stream.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/stream.c?rev=1029&root=polypaudio&r1=1028&r2=1029&view=diff
==============================================================================
--- trunk/src/polyp/stream.c (original)
+++ trunk/src/polyp/stream.c Mon Jun 19 14:37:43 2006
@@ -38,7 +38,7 @@
#include "internal.h"
-#define LATENCY_IPOL_INTERVAL_USEC (10000L)
+#define LATENCY_IPOL_INTERVAL_USEC (100000L)
pa_stream *pa_stream_new(pa_context *c, const char *name, const pa_sample_spec *ss, const pa_channel_map *map) {
pa_stream *s;
@@ -102,9 +102,7 @@
s->corked = 0;
- s->ipol_usec_valid = 0;
- s->ipol_timestamp.tv_sec = 0;
- s->ipol_timestamp.tv_usec = 0;
+ s->cached_time_valid = 0;
s->auto_timing_update_event = NULL;
s->auto_timing_update_requested = 0;
@@ -367,7 +365,7 @@
if ((s->direction == PA_STREAM_PLAYBACK && r) ||
(s->direction == PA_STREAM_RECORD && w))
- s->ipol_usec_valid = 0;
+ s->cached_time_valid = 0;
request_auto_timing_update(s, 1);
}
@@ -855,8 +853,7 @@
i->read_index -= pa_memblockq_get_length(o->stream->record_memblockq);
}
- o->stream->ipol_timestamp = now;
- o->stream->ipol_usec_valid = 0;
+ o->stream->cached_time_valid = 0;
}
o->stream->auto_timing_update_requested = 0;
@@ -1203,8 +1200,9 @@
PA_CHECK_VALIDITY(s->context, s->direction != PA_STREAM_PLAYBACK || !s->timing_info.read_index_corrupt, PA_ERR_NODATA);
PA_CHECK_VALIDITY(s->context, s->direction != PA_STREAM_RECORD || !s->timing_info.write_index_corrupt, PA_ERR_NODATA);
- if (s->flags & PA_STREAM_INTERPOLATE_TIMING && s->ipol_usec_valid)
- usec = s->ipol_usec;
+ if (s->cached_time_valid)
+ /* We alredy calculated the time value for this timing info, so let's reuse it */
+ usec = s->cached_time;
else {
if (s->direction == PA_STREAM_PLAYBACK) {
/* The last byte that was written into the output device
@@ -1247,10 +1245,8 @@
}
}
- if (s->flags & PA_STREAM_INTERPOLATE_TIMING) {
- s->ipol_usec = usec;
- s->ipol_usec_valid = 1;
- }
+ s->cached_time = usec;
+ s->cached_time_valid = 1;
}
/* Interpolate if requested */
@@ -1260,9 +1256,7 @@
* current */
if (!s->corked) {
struct timeval now;
-
- usec += pa_timeval_diff(pa_gettimeofday(&now), &s->ipol_timestamp);
- s->ipol_timestamp = now;
+ usec += pa_timeval_diff(pa_gettimeofday(&now), &s->timing_info.timestamp);
}
}
More information about the pulseaudio-commits
mailing list