diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2009-12-01 12:30:24 +0100 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2009-12-01 12:30:58 +0100 |
commit | 7dd81a5ddfb1c7e2a33e51aababa9b95d26fbfab (patch) | |
tree | 2e22f9fc612264badf4b492f04583c064ebede5c | |
parent | 9151eedd9eb330d9961947f4f56a44c90a9ae320 (diff) |
random hackingtest2
-rw-r--r-- | src/pulse/internal.h | 2 | ||||
-rw-r--r-- | src/pulse/stream.c | 31 |
2 files changed, 33 insertions, 0 deletions
diff --git a/src/pulse/internal.h b/src/pulse/internal.h index b371bfc22..1d980fc02 100644 --- a/src/pulse/internal.h +++ b/src/pulse/internal.h @@ -208,6 +208,8 @@ struct pa_stream { void *event_userdata; pa_stream_notify_cb_t buffer_attr_callback; void *buffer_attr_userdata; + + //pa_usec_t last_start; }; typedef void (*pa_operation_cb_t)(void); diff --git a/src/pulse/stream.c b/src/pulse/stream.c index 0d62b1203..20ef92fd3 100644 --- a/src/pulse/stream.c +++ b/src/pulse/stream.c @@ -389,10 +389,37 @@ static void check_smoother_status(pa_stream *s, pa_bool_t aposteriori, pa_bool_t x = pa_rtclock_now(); if (s->timing_info_valid) { + //x = s->last_start; + if (aposteriori) x -= i->transport_usec; else x += i->transport_usec; + +#if 0 + if (s->direction == PA_STREAM_PLAYBACK && s->context->version >= 13) { + pa_usec_t su; + + /* If we weren't playing then it will take some time + * until the audio will actually come out through the + * speakers. Since we follow that timing here, we need + * to try to fix this up */ + + pa_log_debug("sink_usec %llu, since underrun %lld", i->sink_usec, i->since_underrun); + + if (i->since_underrun > 0) + su = pa_bytes_to_usec((uint64_t) i->since_underrun, &s->sample_spec); + else + su = 0; + + pa_log_debug("su %llu", su); + + if (su < i->sink_usec) + x += i->sink_usec - su; + + pa_log_debug("x %llu", x); + } +#endif } if (s->suspended || s->corked || force_stop) @@ -412,6 +439,7 @@ static void check_smoother_status(pa_stream *s, pa_bool_t aposteriori, pa_bool_t * unknown transport delay add too much noise to our time * calculations. */ + pa_log_debug("not resuming yet"); return; } @@ -1776,6 +1804,9 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command, pa_log_debug("x %llu", x); } + ///* save when we estimate the start */ + //o->stream->last_start = x; + if (!i->playing) pa_smoother_pause(o->stream->smoother, x); |