#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"
#else
char *source_name;
pa_source *source;
+ pa_mcalign *mcalign;
#endif
pa_auth_cookie *auth_cookie;
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:
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);
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