diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2009-11-17 10:46:50 +0100 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2009-12-01 12:30:58 +0100 |
commit | 9151eedd9eb330d9961947f4f56a44c90a9ae320 (patch) | |
tree | 806c709605ce55948f21cb73926885851fd93ff0 | |
parent | ba44b015af92daa9535d3105bc112e3b18fbe0f6 (diff) |
add some logging, don't resume in check_status
-rw-r--r-- | src/pulse/stream.c | 46 | ||||
-rw-r--r-- | src/pulsecore/time-smoother.c | 4 |
2 files changed, 45 insertions, 5 deletions
diff --git a/src/pulse/stream.c b/src/pulse/stream.c index c05c58bae..0d62b1203 100644 --- a/src/pulse/stream.c +++ b/src/pulse/stream.c @@ -369,6 +369,7 @@ finish: 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_timing_info *i; pa_assert(s); pa_assert(!force_start || !force_stop); @@ -376,13 +377,22 @@ static void check_smoother_status(pa_stream *s, pa_bool_t aposteriori, pa_bool_t if (!s->smoother) return; +#if 0 + if (!s->timing_info_valid) { + pa_log_debug ("timing info invalid"); + return; + } +#endif + + i = &s->timing_info; + x = pa_rtclock_now(); if (s->timing_info_valid) { if (aposteriori) - x -= s->timing_info.transport_usec; + x -= i->transport_usec; else - x += s->timing_info.transport_usec; + x += i->transport_usec; } if (s->suspended || s->corked || force_stop) @@ -407,6 +417,31 @@ static void check_smoother_status(pa_stream *s, pa_bool_t aposteriori, pa_bool_t pa_smoother_resume(s->smoother, x, TRUE); } +#if 0 + else if (force_start || s->buffer_attr.prebuf == 0) + pa_smoother_resume(s->smoother, x, TRUE); +#endif +#if 0 + else if (force_start) { + 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 */ + + if (i->since_underrun > 0) + su = pa_bytes_to_usec((uint64_t) i->since_underrun, &s->sample_spec); + else + su = 0; + + if (su < i->sink_usec) + x += i->sink_usec - su; + } + pa_smoother_resume(s->smoother, x, TRUE); + } +#endif /* Please note that we have no idea if playback actually started * if prebuf is non-zero! */ @@ -499,6 +534,7 @@ void pa_command_stream_moved(pa_pdispatch *pd, uint32_t command, uint32_t tag, p s->suspended = suspended; + pa_log_debug("moved"); check_smoother_status(s, TRUE, FALSE, FALSE); request_auto_timing_update(s, TRUE); @@ -617,6 +653,7 @@ void pa_command_stream_suspended(pa_pdispatch *pd, uint32_t command, uint32_t ta s->suspended = suspended; + pa_log_debug("suspended"); check_smoother_status(s, TRUE, FALSE, FALSE); request_auto_timing_update(s, TRUE); @@ -657,6 +694,7 @@ void pa_command_stream_started(pa_pdispatch *pd, uint32_t command, uint32_t tag, if (s->state != PA_STREAM_READY) goto finish; + pa_log_debug("started"); check_smoother_status(s, TRUE, TRUE, FALSE); request_auto_timing_update(s, TRUE); @@ -849,6 +887,7 @@ static void create_stream_complete(pa_stream *s) { request_auto_timing_update(s, TRUE); } + pa_log_debug("complete"); check_smoother_status(s, TRUE, FALSE, FALSE); } @@ -1712,7 +1751,7 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command, u = x = rtnow - i->transport_usec; - pa_log_debug("now %llu, u %llu", rtnow, u); + pa_log_debug("now %llu, u %llu, %d", rtnow, u, i->playing); if (o->stream->direction == PA_STREAM_PLAYBACK && o->context->version >= 13) { pa_usec_t su; @@ -2081,6 +2120,7 @@ pa_operation* pa_stream_cork(pa_stream *s, int b, pa_stream_success_cb_t cb, voi pa_pstream_send_tagstruct(s->context->pstream, t); pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref); + pa_log_debug("cork %d", b); check_smoother_status(s, FALSE, FALSE, FALSE); /* This might cause the indexes to hang/start again, hence let's diff --git a/src/pulsecore/time-smoother.c b/src/pulsecore/time-smoother.c index 033d70560..615b24887 100644 --- a/src/pulsecore/time-smoother.c +++ b/src/pulsecore/time-smoother.c @@ -447,8 +447,8 @@ void pa_smoother_put(pa_smoother *s, pa_usec_t x, pa_usec_t y) { s->abc_valid = FALSE; #ifdef DEBUG_DATA - pa_log_debug("%p, put(%llu | %llu) = %llu (%llu)", s, (unsigned long long) (x + s->time_offset), (unsigned long long) x, (unsigned long long) y, - (unsigned long long) (x-y)); + pa_log_debug("%p, put(%llu | %llu) = %llu (%lld)", s, (unsigned long long) (x + s->time_offset), (unsigned long long) x, (unsigned long long) y, + (long long) (x-y)); #endif } |