diff options
author | Lennart Poettering <lennart@poettering.net> | 2009-07-31 00:50:19 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2009-07-31 00:50:19 +0200 |
commit | c14f6c179fb3a52219f2796d20a1c6f5648aa8a1 (patch) | |
tree | 2e3b495b1a2dd36e5cc5ecda2eff1ace9926984d /src/modules | |
parent | 4f5e2b745ea357e2b5c815ff33a556505a7d1f18 (diff) |
tunnel: don't assert on misaligned reads, closes #597 and rhbz #496310
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/module-tunnel.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c index d1153829..f788f660 100644 --- a/src/modules/module-tunnel.c +++ b/src/modules/module-tunnel.c @@ -55,6 +55,7 @@ #include <pulsecore/core-error.h> #include <pulsecore/proplist-util.h> #include <pulsecore/auth-cookie.h> +#include <pulsecore/mcalign.h> #ifdef TUNNEL_SINK #include "module-tunnel-sink-symdef.h" @@ -194,6 +195,7 @@ struct userdata { #else char *source_name; pa_source *source; + pa_mcalign *mcalign; #endif pa_auth_cookie *auth_cookie; @@ -614,14 +616,23 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off return 0; } - case SOURCE_MESSAGE_POST: + case SOURCE_MESSAGE_POST: { + pa_memchunk c; - if (PA_SOURCE_IS_OPENED(u->source->thread_info.state)) - pa_source_post(u->source, chunk); + pa_mcalign_push(u->mcalign, chunk); - u->counter += (int64_t) chunk->length; + while (pa_mcalign_pop(u->mcalign, &c) >= 0) { + + if (PA_SOURCE_IS_OPENED(u->source->thread_info.state)) + pa_source_post(u->source, &c); + + pa_memblock_unref(c.memblock); + + u->counter += (int64_t) c.length; + } return 0; + } case SOURCE_MESSAGE_REMOTE_SUSPEND: @@ -1937,6 +1948,8 @@ int pa__init(pa_module*m) { pa_source_set_asyncmsgq(u->source, u->thread_mq.inq); pa_source_set_rtpoll(u->source, u->rtpoll); + + u->mcalign = pa_mcalign_new(pa_frame_size(&u->source->sample_spec)); #endif pa_xfree(dn); @@ -2030,6 +2043,11 @@ void pa__done(pa_module*m) { if (u->time_event) u->core->mainloop->time_free(u->time_event); +#ifndef TUNNEL_SINK + if (u->mcalign) + pa_mcalign_free(u->mcalign); +#endif + #ifdef TUNNEL_SINK pa_xfree(u->sink_name); #else |