Skip to content

Commit c039974

Browse files
committed
Set buffer size multiplier
1 parent 24edae8 commit c039974

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

virtio-snd.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -808,10 +808,12 @@ static void virtio_snd_read_pcm_prepare(const virtio_snd_pcm_hdr_t *query,
808808
uint32_t cnfa_period_frames = cnfa_period_bytes / VSND_CNFA_FRAME_SZ;
809809
fprintf(stderr, "period_bytes %" PRIu32 " period_frames %" PRIu32 "\n",
810810
cnfa_period_bytes, cnfa_period_frames);
811+
/* Get the number of multiplier */
812+
uint32_t mul = props->pp.buffer_bytes / props->pp.period_bytes;
811813

812814
INIT_LIST_HEAD(&props->buf_queue_head);
813815
props->intermediate =
814-
(void *) malloc(sizeof(*props->intermediate) * cnfa_period_bytes);
816+
(void *) malloc(sizeof(*props->intermediate) * cnfa_period_bytes * mul);
815817
PaStreamParameters params = {
816818
.device = Pa_GetDefaultOutputDevice(),
817819
.channelCount = props->pp.channels,
@@ -826,7 +828,6 @@ static void virtio_snd_read_pcm_prepare(const virtio_snd_pcm_hdr_t *query,
826828
&params, rate, cnfa_period_frames, paClipOff,
827829
virtio_snd_tx_stream_cb, &props->v);
828830
else if (dir == VIRTIO_SND_D_INPUT) {
829-
fprintf(stderr, "pcm_prepare input\n");
830831
err = Pa_OpenStream(&props->pa_stream, &params, NULL /* no output */,
831832
rate, cnfa_period_frames, paClipOff,
832833
virtio_snd_rx_stream_cb, &props->v);

0 commit comments

Comments
 (0)