From 6cb0e6184b4be8095b7ef833850dbca3e70be922 Mon Sep 17 00:00:00 2001 From: Wang Xingchao Date: Sat, 6 Jul 2013 01:23:39 -0700 Subject: [PATCH RFC] http-protocol: Add process rewind for http-protocol source_output Ths missing process rewind would cause remain stream playing out even user started to "Pause" the stream. Signed-off-by: Wang Xingchao --- src/pulsecore/protocol-http.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/pulsecore/protocol-http.c b/src/pulsecore/protocol-http.c index ced03a1..777f42d 100644 --- a/src/pulsecore/protocol-http.c +++ b/src/pulsecore/protocol-http.c @@ -229,6 +229,20 @@ static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk) pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(o), SOURCE_OUTPUT_MESSAGE_POST_DATA, NULL, 0, chunk, NULL); } +static void source_output_process_rewind_cb(pa_source_output *o, size_t nbytes) { + struct connection *c; + + pa_source_output_assert_ref(o); + pa_source_output_assert_io_context(o); + pa_assert_se(c = o->userdata); + + /* Stop sending out data for client */ + pa_memblockq_rewind(c->output_memblockq, nbytes); + + pa_log_debug("Http Source rewind (%lld) %lld", (long long) nbytes, + (long long) pa_memblockq_get_length (c->output_memblockq)); +} + /* Called from main context */ static void source_output_kill_cb(pa_source_output *o) { struct connection*c; @@ -575,6 +589,7 @@ static void handle_listen_prefix(struct connection *c, const char *source_name) } c->source_output->parent.process_msg = source_output_process_msg; + c->source_output->process_rewind = source_output_process_rewind_cb; c->source_output->push = source_output_push_cb; c->source_output->kill = source_output_kill_cb; c->source_output->get_latency = source_output_get_latency_cb; -- 1.8.1.2