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,11 +787,17 @@ 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);
|
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_norm(&volume)) {
|
||||||
pa_memchunk_make_writable(result, 0);
|
if (s->thread_info.soft_muted || pa_cvolume_is_muted(&volume)) {
|
||||||
if (s->thread_info.soft_muted || pa_cvolume_is_muted(&volume))
|
pa_memblock_unref(result->memblock);
|
||||||
pa_silence_memchunk(result, &s->sample_spec);
|
pa_silence_memchunk_get(&s->core->silence_cache,
|
||||||
else
|
s->core->mempool,
|
||||||
|
result,
|
||||||
|
&s->sample_spec,
|
||||||
|
result->length);
|
||||||
|
} else {
|
||||||
|
pa_memchunk_make_writable(result, 0);
|
||||||
pa_volume_memchunk(result, &s->sample_spec, &volume);
|
pa_volume_memchunk(result, &s->sample_spec, &volume);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
@ -968,13 +974,19 @@ 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);
|
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_norm(&volume)) {
|
||||||
pa_memchunk_make_writable(result, length);
|
if (s->thread_info.soft_muted || pa_cvolume_is_muted(&volume)) {
|
||||||
if (s->thread_info.soft_muted || pa_cvolume_is_muted(&volume))
|
pa_memblock_unref(result->memblock);
|
||||||
pa_silence_memchunk(result, &s->sample_spec);
|
pa_silence_memchunk_get(&s->core->silence_cache,
|
||||||
else
|
s->core->mempool,
|
||||||
|
result,
|
||||||
|
&s->sample_spec,
|
||||||
|
result->length);
|
||||||
|
} else {
|
||||||
|
pa_memchunk_make_writable(result, length);
|
||||||
pa_volume_memchunk(result, &s->sample_spec, &volume);
|
pa_volume_memchunk(result, &s->sample_spec, &volume);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue