summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2013-11-25 19:44:14 +0100
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>2014-07-17 13:01:00 +0300
commitc187441ff9cc068dbc1bbf41c7a8ef70d6199f0b (patch)
tree86fe9952a91a525edbe5aba708cc074aefed7549
parent5170df86b37438cd88c7d11361825d4a74058fd6 (diff)
tunnel-new: remove uncorking in thread_func. Now handled by state change callback.
tunnel-new handled a corked stream conditional in the thread_func to be sure the stream isn't corked. Un/Corking is now handled in the state change callback. Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
-rw-r--r--src/modules/module-tunnel-sink-new.c59
1 files changed, 27 insertions, 32 deletions
diff --git a/src/modules/module-tunnel-sink-new.c b/src/modules/module-tunnel-sink-new.c
index 75dd19fc8..c74a7c126 100644
--- a/src/modules/module-tunnel-sink-new.c
+++ b/src/modules/module-tunnel-sink-new.c
@@ -181,39 +181,34 @@ static void thread_func(void *userdata) {
if (u->connected &&
pa_stream_get_state(u->stream) == PA_STREAM_READY &&
PA_SINK_IS_LINKED(u->sink->thread_info.state)) {
- /* TODO: Cork the stream when the sink is suspended. */
-
- if (pa_stream_is_corked(u->stream)) {
- cork_stream(u, false);
- } else {
- size_t writable;
-
- writable = pa_stream_writable_size(u->stream);
- if (writable > 0) {
- pa_memchunk memchunk;
- const void *p;
-
- pa_sink_render_full(u->sink, writable, &memchunk);
-
- pa_assert(memchunk.length > 0);
-
- /* we have new data to write */
- p = pa_memblock_acquire(memchunk.memblock);
- /* TODO: Use pa_stream_begin_write() to reduce copying. */
- ret = pa_stream_write(u->stream,
- (uint8_t*) p + memchunk.index,
- memchunk.length,
- NULL, /**< A cleanup routine for the data or NULL to request an internal copy */
- 0, /** offset */
- PA_SEEK_RELATIVE);
- pa_memblock_release(memchunk.memblock);
- pa_memblock_unref(memchunk.memblock);
-
- if (ret != 0) {
- pa_log_error("Could not write data into the stream ... ret = %i", ret);
- u->thread_mainloop_api->quit(u->thread_mainloop_api, TUNNEL_THREAD_FAILED_MAINLOOP);
- }
+ size_t writable;
+
+ writable = pa_stream_writable_size(u->stream);
+ if (writable > 0) {
+ pa_memchunk memchunk;
+ const void *p;
+
+ pa_sink_render_full(u->sink, writable, &memchunk);
+
+ pa_assert(memchunk.length > 0);
+
+ /* we have new data to write */
+ p = pa_memblock_acquire(memchunk.memblock);
+ /* TODO: Use pa_stream_begin_write() to reduce copying. */
+ ret = pa_stream_write(u->stream,
+ (uint8_t*) p + memchunk.index,
+ memchunk.length,
+ NULL, /**< A cleanup routine for the data or NULL to request an internal copy */
+ 0, /** offset */
+ PA_SEEK_RELATIVE);
+ pa_memblock_release(memchunk.memblock);
+ pa_memblock_unref(memchunk.memblock);
+
+ if (ret != 0) {
+ pa_log_error("Could not write data into the stream ... ret = %i", ret);
+ u->thread_mainloop_api->quit(u->thread_mainloop_api, TUNNEL_THREAD_FAILED_MAINLOOP);
}
+
}
}
}