Index: src/polyp/stream.c
===================================================================
--- src/polyp/stream.c	(revision 999)
+++ src/polyp/stream.c	(working copy)
@@ -1077,6 +1077,23 @@
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
 
+    /* When interpolating time, and changing to being corked, 
+     * save the current time as our position and mark the timestamp
+     * so that when we uncork, interpolation can continue. */
+    if (b && !s->corked && s->flags & PA_STREAM_INTERPOLATE_TIMING) {
+      int r;
+      pa_usec_t ts;
+      struct timeval now;
+
+      s->ipol_usec_valid = 0;
+
+      pa_gettimeofday(&now);
+      if ((r = pa_stream_get_time(s, &ts)) < 0)
+        return NULL;
+      s->ipol_usec = ts;
+      s->ipol_timestamp = now;
+    }
+
     s->corked = b;
     
     o = pa_operation_new(s->context, s, (pa_operation_cb_t) cb, userdata);
@@ -1257,12 +1274,25 @@
     if (s->flags & PA_STREAM_INTERPOLATE_TIMING) {
 
         /* We just add the time that passed since the latency info was
-         * current */
+         * measured, but not advancing further than the client input data */
         if (!s->corked) {
             struct timeval now;
+            int64_t cindex;
+            pa_usec_t cur_time;
             
             usec += pa_timeval_diff(pa_gettimeofday(&now), &s->ipol_timestamp);
-            s->ipol_timestamp = now;
+
+            if (s->direction == PA_STREAM_PLAYBACK)
+              cindex = s->timing_info.write_index;
+            else
+              cindex = s->timing_info.read_index;
+
+            if (cindex < 0)
+              cindex = 0;
+
+            cur_time = pa_bytes_to_usec(cindex, &s->sample_spec);
+            if (usec > cur_time)
+              usec = cur_time;
         }
     }
 

