On Tue, 2012-12-04 at 14:55 +0100, Peter Meerwald wrote: > --- a/src/modules/echo-cancel/module-echo-cancel.c > +++ b/src/modules/echo-cancel/module-echo-cancel.c > @@ -936,9 +940,9 @@ static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk) > u->source_skip -= to_skip; > } > > - if (rlen && u->source_skip % u->blocksize) { > - u->sink_skip += u->blocksize - (u->source_skip % u->blocksize); > - u->source_skip -= (u->source_skip % u->blocksize); > + if (rlen && u->source_skip % u->source_blocksize) { > + u->sink_skip += u->source_blocksize - (u->source_skip % u->source_blocksize); Should this be u->sink_skip += u->sink_blocksize - frames_to_sink_bytes(source_bytes_to_frames(u->source_skip % u->source_blocksize)); ? > @@ -2131,20 +2139,20 @@ int main(int argc, char* argv[]) { > } > } > > - rdata = pa_xmalloc(u.blocksize); > - pdata = pa_xmalloc(u.blocksize); > - cdata = pa_xmalloc(u.blocksize); > + rdata = pa_xmalloc(u->source_blocksize); > + pdata = pa_xmalloc(u->sink_blocksize); > + cdata = pa_xmalloc(u->source_blocksize); u is not a pointer, this code will not compile. Same goes for the rest of the changes in this file. > > if (!u.ec->params.drift_compensation) { > - while (fread(rdata, u.blocksize, 1, u.captured_file) > 0) { > - if (fread(pdata, u.blocksize, 1, u.played_file) == 0) { > + while (fread(rdata, u->source_blocksize, 1, u.captured_file) > 0) { > + if (fread(pdata, u->sink_blocksize, 1, u.played_file) == 0) { > perror("Played file ended before captured file"); > goto fail; > } > > u.ec->run(u.ec, rdata, pdata, cdata); > > - unused = fwrite(cdata, u.blocksize, 1, u.canceled_file); > + unused = fwrite(cdata, u->source_blocksize, 1, u.canceled_file); > } > } else { > while (fscanf(u.drift_file, "%c", &c) > 0) { > diff --git a/src/modules/echo-cancel/null.c b/src/modules/echo-cancel/null.c > index bcdd3a6..5f8ced2 100644 > --- a/src/modules/echo-cancel/null.c > +++ b/src/modules/echo-cancel/null.c > @@ -28,22 +28,21 @@ PA_C_DECL_END > pa_bool_t pa_null_ec_init(pa_core *c, pa_echo_canceller *ec, > pa_sample_spec *source_ss, pa_channel_map *source_map, > pa_sample_spec *sink_ss, pa_channel_map *sink_map, > - uint32_t *blocksize, const char *args) { > - unsigned framelen = 256; > + uint32_t *nframes, const char *args) { > + *nframes = 256; > > source_ss->format = PA_SAMPLE_S16NE; > *sink_ss = *source_ss; > *sink_map = *source_map; > > - *blocksize = framelen * pa_frame_size(source_ss); > - > - pa_log_debug("null AEC: framelen %u, blocksize %u, channels %d, rate %d", framelen, *blocksize, source_ss->channels, source_ss->rate); > + pa_log_debug("null AEC: nframes %u, channels %d, rate %d", *nframes, source_ss->channels, source_ss->rate); > > return TRUE; > } > > void pa_null_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *play, uint8_t *out) { > - memcpy(out, rec, 256 * 2); > + // blocksize is nframes * frame-size > + memcpy(out, rec, 256 * 2 ); Extra space added after "256 * 2". -- Tanu