From 6da26893e0f4507285dfcef29739bb76ce7d78df Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Tue, 7 Jul 2015 13:03:53 +0200 Subject: [PATCH] tunnel-new: allow streams to be moved Signed-off-by: Pierre Ossman --- src/modules/module-tunnel-sink-new.c | 8 +++++++- src/modules/module-tunnel-source-new.c | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/modules/module-tunnel-sink-new.c b/src/modules/module-tunnel-sink-new.c index 7f83543..e62cea1 100644 --- a/src/modules/module-tunnel-sink-new.c +++ b/src/modules/module-tunnel-sink-new.c @@ -287,6 +287,11 @@ static void stream_set_buffer_attr_cb(pa_stream *stream, int success, void *user stream_changed_buffer_attr_cb(stream, userdata); } +/* called after the server has moved our input to a different sink */ +static void stream_moved_callback(pa_stream *stream, void *userdata) { + stream_changed_buffer_attr_cb(stream, userdata); +} + static void context_state_cb(pa_context *c, void *userdata) { struct userdata *u = userdata; pa_assert(u); @@ -335,10 +340,11 @@ static void context_state_cb(pa_context *c, void *userdata) { pa_stream_set_state_callback(u->stream, stream_state_cb, userdata); pa_stream_set_buffer_attr_callback(u->stream, stream_changed_buffer_attr_cb, userdata); + pa_stream_set_moved_callback(u->stream, stream_moved_callback, userdata); if (pa_stream_connect_playback(u->stream, u->remote_sink_name, &bufferattr, - PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_DONT_MOVE | PA_STREAM_START_CORKED | PA_STREAM_AUTO_TIMING_UPDATE, + PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_START_CORKED | PA_STREAM_AUTO_TIMING_UPDATE, NULL, NULL) < 0) { pa_log_error("Could not connect stream."); diff --git a/src/modules/module-tunnel-source-new.c b/src/modules/module-tunnel-source-new.c index 0f72dbf..581dea9 100644 --- a/src/modules/module-tunnel-source-new.c +++ b/src/modules/module-tunnel-source-new.c @@ -336,7 +336,7 @@ static void context_state_cb(pa_context *c, void *userdata) { if (pa_stream_connect_record(u->stream, u->remote_source_name, &bufferattr, - PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_DONT_MOVE|PA_STREAM_AUTO_TIMING_UPDATE|PA_STREAM_START_CORKED) < 0) { + PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE | PA_STREAM_START_CORKED) < 0) { pa_log_debug("Could not create stream: %s", pa_strerror(pa_context_errno(u->context))); u->thread_mainloop_api->quit(u->thread_mainloop_api, TUNNEL_THREAD_FAILED_MAINLOOP); } -- 2.4.3