mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
core: Take samples from silence cache rather than write zeros
If the only stream to render from is muted take samples from the silence cache. This should shrink memory/cache bandwidth. Again the gain was not what I hoped for.
This commit is contained in:
parent
d7b8947a5e
commit
35faedb6e8
1 changed files with 22 additions and 10 deletions
|
|
@ -787,12 +787,18 @@ void pa_sink_render(pa_sink*s, size_t length, pa_memchunk *result) {
|
|||
pa_sw_cvolume_multiply(&volume, &s->thread_info.soft_volume, &info[0].volume);
|
||||
|
||||
if (s->thread_info.soft_muted || !pa_cvolume_is_norm(&volume)) {
|
||||
if (s->thread_info.soft_muted || pa_cvolume_is_muted(&volume)) {
|
||||
pa_memblock_unref(result->memblock);
|
||||
pa_silence_memchunk_get(&s->core->silence_cache,
|
||||
s->core->mempool,
|
||||
result,
|
||||
&s->sample_spec,
|
||||
result->length);
|
||||
} else {
|
||||
pa_memchunk_make_writable(result, 0);
|
||||
if (s->thread_info.soft_muted || pa_cvolume_is_muted(&volume))
|
||||
pa_silence_memchunk(result, &s->sample_spec);
|
||||
else
|
||||
pa_volume_memchunk(result, &s->sample_spec, &volume);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
void *ptr;
|
||||
result->memblock = pa_memblock_new(s->core->mempool, length);
|
||||
|
|
@ -969,12 +975,18 @@ void pa_sink_render_full(pa_sink *s, size_t length, pa_memchunk *result) {
|
|||
pa_sw_cvolume_multiply(&volume, &s->thread_info.soft_volume, &info[0].volume);
|
||||
|
||||
if (s->thread_info.soft_muted || !pa_cvolume_is_norm(&volume)) {
|
||||
if (s->thread_info.soft_muted || pa_cvolume_is_muted(&volume)) {
|
||||
pa_memblock_unref(result->memblock);
|
||||
pa_silence_memchunk_get(&s->core->silence_cache,
|
||||
s->core->mempool,
|
||||
result,
|
||||
&s->sample_spec,
|
||||
result->length);
|
||||
} else {
|
||||
pa_memchunk_make_writable(result, length);
|
||||
if (s->thread_info.soft_muted || pa_cvolume_is_muted(&volume))
|
||||
pa_silence_memchunk(result, &s->sample_spec);
|
||||
else
|
||||
pa_volume_memchunk(result, &s->sample_spec, &volume);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
void *ptr;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue