alsa-plugin: set buffer size correctly

Our output buffer size is always what is needed to produce one
period of samples. We use nframes from the hardware and the rest
we fill with silence.
This commit is contained in:
Wim Taymans 2021-01-18 10:03:19 +01:00
parent be9c2f9757
commit fd520c4b39

View file

@ -230,7 +230,7 @@ snd_pcm_pipewire_process(snd_pcm_pipewire_t *pw, struct pw_buffer *b,
if (pw->blocks == 1) {
if (io->stream == SND_PCM_STREAM_PLAYBACK) {
d[0].chunk->size = nframes * pw->stride;
d[0].chunk->size = want * pw->stride;
d[0].chunk->offset = 0;
}
ptr = SPA_MEMBER(d[0].data, d[0].chunk->offset, void);
@ -242,7 +242,7 @@ snd_pcm_pipewire_process(snd_pcm_pipewire_t *pw, struct pw_buffer *b,
} else {
for (channel = 0; channel < io->channels; channel++) {
if (io->stream == SND_PCM_STREAM_PLAYBACK) {
d[channel].chunk->size = nframes * pw->stride;
d[channel].chunk->size = want * pw->stride;
d[channel].chunk->offset = 0;
}
ptr = SPA_MEMBER(d[channel].data, d[channel].chunk->offset, void);