@@ -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