Skip to content

Commit c35c5ed

Browse files
committed
Try to fill intermediate buffer and get SEGV
1 parent 223c4f1 commit c35c5ed

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

virtio-snd.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -898,12 +898,20 @@ static int virtio_snd_rx_stream_cb(const void *input,
898898
PaStreamCallbackFlags status_flags,
899899
void *user_data)
900900
{
901+
/* suppress unused variable warning */
902+
(void) output;
903+
(void) time_info;
904+
(void) status_flags;
905+
901906
vsnd_stream_sel_t *v_ptr = (vsnd_stream_sel_t *) user_data;
902907
uint32_t id = v_ptr->stream_id;
903-
int channels = vsnd_props[id].pp.channels;
908+
virtio_snd_prop_t *props = &vsnd_props[id];
909+
int channels = props->pp.channels;
904910
uint32_t out_buf_sz = frame_cnt * channels;
905911
uint32_t out_buf_bytes = out_buf_sz * VSND_CNFA_FRAME_SZ;
912+
uint32_t period_bytes = props->pp.period_bytes;
906913
//__virtio_snd_frame_enqueue(output, out_buf_bytes, id);
914+
memcpy(props->intermediate, input, period_bytes);
907915
fprintf(stderr, "+++ virtio_snd_rx_stream_cb +++\n");
908916

909917
return paContinue;
@@ -1244,7 +1252,6 @@ static bool virtio_snd_reg_write(virtio_snd_state_t *vsnd,
12441252
case VSND_QUEUE_RX:
12451253
rx_ev_notify++;
12461254
pthread_cond_signal(&virtio_snd_rx_cond);
1247-
fprintf(stderr, "RX under construction\n");
12481255
break;
12491256
default:
12501257
fprintf(stderr, "value %d not supported\n", value);

0 commit comments

Comments
 (0)