fix bug where we silently dropped data that didn't fit into one mempool tile

git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/glitch-free@2220 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2008-04-07 16:47:27 +00:00
parent 98b0152d7c
commit c84a64cf32

View file

@ -517,24 +517,29 @@ int pa_sink_input_peek(pa_sink_input *i, size_t slength /* in sink frames */, pa
pa_assert(tchunk.length > 0); pa_assert(tchunk.length > 0);
pa_assert(tchunk.memblock); pa_assert(tchunk.memblock);
if (tchunk.length > block_size_max_sink_input) while (tchunk.length > 0) {
tchunk.length = block_size_max_sink_input; pa_memchunk wchunk;
wchunk = tchunk;
if (wchunk.length > block_size_max_sink_input)
wchunk.length = block_size_max_sink_input;
/* It might be necessary to adjust the volume here */ /* It might be necessary to adjust the volume here */
if (do_volume_adj_here && !volume_is_norm) { if (do_volume_adj_here && !volume_is_norm) {
pa_memchunk_make_writable(&tchunk, 0); pa_memchunk_make_writable(&wchunk, 0);
if (i->thread_info.muted) if (i->thread_info.muted)
pa_silence_memchunk(&tchunk, &i->thread_info.sample_spec); pa_silence_memchunk(&wchunk, &i->thread_info.sample_spec);
else else
pa_volume_memchunk(&tchunk, &i->thread_info.sample_spec, &i->thread_info.volume); pa_volume_memchunk(&wchunk, &i->thread_info.sample_spec, &i->thread_info.volume);
} }
if (!i->thread_info.resampler) if (!i->thread_info.resampler)
pa_memblockq_push_align(i->thread_info.render_memblockq, &tchunk); pa_memblockq_push_align(i->thread_info.render_memblockq, &wchunk);
else { else {
pa_memchunk rchunk; pa_memchunk rchunk;
pa_resampler_run(i->thread_info.resampler, &tchunk, &rchunk); pa_resampler_run(i->thread_info.resampler, &wchunk, &rchunk);
if (rchunk.memblock) { if (rchunk.memblock) {
pa_memblockq_push_align(i->thread_info.render_memblockq, &rchunk); pa_memblockq_push_align(i->thread_info.render_memblockq, &rchunk);
@ -542,6 +547,10 @@ int pa_sink_input_peek(pa_sink_input *i, size_t slength /* in sink frames */, pa
} }
} }
tchunk.index += wchunk.length;
tchunk.length -= wchunk.length;
}
pa_memblock_unref(tchunk.memblock); pa_memblock_unref(tchunk.memblock);
} }