-void pa_command_stream_moved(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED uint32_t tag, pa_tagstruct *t, void *userdata) {
+static void check_smoother_status(pa_stream *s, pa_bool_t aposteriori, pa_bool_t force_start, pa_bool_t force_stop) {
+ pa_usec_t x;
+
+ pa_assert(s);
+ pa_assert(!force_start || !force_stop);
+
+ if (!s->smoother)
+ return;
+
+ x = pa_rtclock_usec();
+
+ if (s->timing_info_valid) {
+ if (aposteriori)
+ x -= s->timing_info.transport_usec;
+ else
+ x += s->timing_info.transport_usec;
+
+ if (s->direction == PA_STREAM_PLAYBACK)
+ /* it takes a while until the pause/resume is actually
+ * audible */
+ x += s->timing_info.sink_usec;
+ else
+ /* Data froma while back will be dropped */
+ x -= s->timing_info.source_usec;
+ }
+
+ if (s->suspended || s->corked || force_stop)
+ pa_smoother_pause(s->smoother, x);
+ else if (force_start || s->buffer_attr.prebuf == 0)
+ pa_smoother_resume(s->smoother, x);
+
+ /* Please note that we have no idea if playback actually started
+ * if prebuf is non-zero! */
+}
+
+void pa_command_stream_moved(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {