mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
module-equalizer-sink: try to limit buffering to mempool's max_block_size and disable debug output
This commit is contained in:
parent
5c82dd67d0
commit
ebaca56a75
1 changed files with 18 additions and 9 deletions
|
|
@ -556,15 +556,22 @@ static void input_buffer(struct userdata *u, pa_memchunk *in){
|
||||||
/* Called from I/O thread context */
|
/* Called from I/O thread context */
|
||||||
static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk) {
|
static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk) {
|
||||||
struct userdata *u;
|
struct userdata *u;
|
||||||
size_t fs, target_samples;
|
size_t fs, target_samples, mbs;
|
||||||
struct timeval start, end;
|
//struct timeval start, end;
|
||||||
pa_memchunk tchunk;
|
pa_memchunk tchunk;
|
||||||
pa_sink_input_assert_ref(i);
|
pa_sink_input_assert_ref(i);
|
||||||
pa_assert_se(u = i->userdata);
|
pa_assert_se(u = i->userdata);
|
||||||
pa_assert(chunk);
|
pa_assert(chunk);
|
||||||
pa_assert(u->sink);
|
pa_assert(u->sink);
|
||||||
fs = pa_frame_size(&(u->sink->sample_spec));
|
fs = pa_frame_size(&(u->sink->sample_spec));
|
||||||
|
nbytes = PA_MIN(nbytes, pa_mempool_block_size_max(u->sink->core->mempool));
|
||||||
target_samples = PA_ROUND_UP(nbytes / fs, u->R);
|
target_samples = PA_ROUND_UP(nbytes / fs, u->R);
|
||||||
|
mbs = pa_mempool_block_size_max(u->sink->core->mempool);
|
||||||
|
//pa_log_debug("vanilla mbs = %ld",mbs);
|
||||||
|
mbs = PA_ROUND_DOWN(mbs / fs, u->R);
|
||||||
|
mbs = PA_MAX(mbs, u->R);
|
||||||
|
target_samples = PA_MAX(target_samples, mbs);
|
||||||
|
//pa_log_debug("target samples: %ld", target_samples);
|
||||||
if(u->first_iteration){
|
if(u->first_iteration){
|
||||||
//allocate request_size
|
//allocate request_size
|
||||||
target_samples = PA_MAX(target_samples, u->window_size);
|
target_samples = PA_MAX(target_samples, u->window_size);
|
||||||
|
|
@ -573,15 +580,17 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk
|
||||||
target_samples += u->overlap_size;
|
target_samples += u->overlap_size;
|
||||||
}
|
}
|
||||||
alloc_input_buffers(u, target_samples);
|
alloc_input_buffers(u, target_samples);
|
||||||
|
//pa_log_debug("post target samples: %ld", target_samples);
|
||||||
chunk->memblock = NULL;
|
chunk->memblock = NULL;
|
||||||
|
|
||||||
/* Hmm, process any rewind request that might be queued up */
|
/* Hmm, process any rewind request that might be queued up */
|
||||||
pa_sink_process_rewind(u->sink, 0);
|
pa_sink_process_rewind(u->sink, 0);
|
||||||
|
|
||||||
//pa_log_debug("start output-buffered %ld, input-buffered %ld, requested %ld",buffered_samples,u->samples_gathered,samples_requested);
|
//pa_log_debug("start output-buffered %ld, input-buffered %ld, requested %ld",buffered_samples,u->samples_gathered,samples_requested);
|
||||||
pa_rtclock_get(&start);
|
//pa_rtclock_get(&start);
|
||||||
do{
|
do{
|
||||||
size_t input_remaining = target_samples - u->samples_gathered;
|
size_t input_remaining = target_samples - u->samples_gathered;
|
||||||
|
// pa_log_debug("input remaining %ld samples", input_remaining);
|
||||||
pa_assert(input_remaining > 0);
|
pa_assert(input_remaining > 0);
|
||||||
while(pa_memblockq_peek(u->input_q, &tchunk) < 0){
|
while(pa_memblockq_peek(u->input_q, &tchunk) < 0){
|
||||||
//pa_sink_render(u->sink, input_remaining * fs, &tchunk);
|
//pa_sink_render(u->sink, input_remaining * fs, &tchunk);
|
||||||
|
|
@ -596,23 +605,23 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk
|
||||||
//pa_log_debug("asked for %ld input samples, got %ld samples",input_remaining,buffer->length/fs);
|
//pa_log_debug("asked for %ld input samples, got %ld samples",input_remaining,buffer->length/fs);
|
||||||
/* copy new input */
|
/* copy new input */
|
||||||
//pa_rtclock_get(start);
|
//pa_rtclock_get(start);
|
||||||
|
// pa_log_debug("buffering %ld bytes", tchunk.length);
|
||||||
input_buffer(u, &tchunk);
|
input_buffer(u, &tchunk);
|
||||||
//pa_rtclock_get(&end);
|
//pa_rtclock_get(&end);
|
||||||
//pa_log_debug("Took %0.5f seconds to setup", pa_timeval_diff(end, start) / (double) PA_USEC_PER_SEC);
|
//pa_log_debug("Took %0.5f seconds to setup", pa_timeval_diff(end, start) / (double) PA_USEC_PER_SEC);
|
||||||
pa_memblock_unref(tchunk.memblock);
|
pa_memblock_unref(tchunk.memblock);
|
||||||
}while(u->samples_gathered < target_samples);
|
}while(u->samples_gathered < target_samples);
|
||||||
|
|
||||||
pa_rtclock_get(&end);
|
//pa_rtclock_get(&end);
|
||||||
pa_log_debug("Took %0.6f seconds to get data", (double) pa_timeval_diff(&end, &start) / PA_USEC_PER_SEC);
|
//pa_log_debug("Took %0.6f seconds to get data", (double) pa_timeval_diff(&end, &start) / PA_USEC_PER_SEC);
|
||||||
|
|
||||||
pa_assert(u->fft_size >= u->window_size);
|
pa_assert(u->fft_size >= u->window_size);
|
||||||
pa_assert(u->R < u->window_size);
|
pa_assert(u->R < u->window_size);
|
||||||
/* set the H filter */
|
//pa_rtclock_get(&start);
|
||||||
pa_rtclock_get(&start);
|
|
||||||
/* process a block */
|
/* process a block */
|
||||||
process_samples(u, chunk);
|
process_samples(u, chunk);
|
||||||
pa_rtclock_get(&end);
|
//pa_rtclock_get(&end);
|
||||||
pa_log_debug("Took %0.6f seconds to process", (double) pa_timeval_diff(&end, &start) / PA_USEC_PER_SEC);
|
//pa_log_debug("Took %0.6f seconds to process", (double) pa_timeval_diff(&end, &start) / PA_USEC_PER_SEC);
|
||||||
|
|
||||||
pa_assert(chunk->memblock);
|
pa_assert(chunk->memblock);
|
||||||
//pa_log_debug("gave %ld", chunk->length/fs);
|
//pa_log_debug("gave %ld", chunk->length/fs);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue