Skip to content

Commit 8c461fe

Browse files
committed
Add RX flush in pcm_release
1 parent 03929f4 commit 8c461fe

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

virtio-snd.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@ VSND_GEN_TX_QUEUE_HANDLER(flush, 0);
566566
list_for_each_entry (node, &q, q) { \
567567
uint32_t addr = node->vq_desc.addr; \
568568
uint32_t len = node->vq_desc.len; \
569+
fprintf(stderr, "*** rx_normal idx %" PRIu32 "\n", len); \
569570
if (idx == 0) { /* the first descriptor */ \
570571
const virtio_snd_pcm_xfer_t *request = \
571572
(virtio_snd_pcm_xfer_t *) (base + addr); \
@@ -629,6 +630,7 @@ VSND_GEN_TX_QUEUE_HANDLER(flush, 0);
629630
}
630631

631632
VSND_GEN_RX_QUEUE_HANDLER(normal, 1);
633+
VSND_GEN_RX_QUEUE_HANDLER(flush, 0);
632634
#endif
633635
#if 0
634636
static int virtio_snd_rx_desc_normal_handler(virtio_snd_state_t *vsnd,
@@ -950,7 +952,10 @@ static void virtio_snd_read_pcm_release(const virtio_snd_pcm_hdr_t *query,
950952
* - The device MUST NOT complete the control request while there
951953
* are pending I/O messages for the specified stream ID.
952954
*/
953-
virtio_queue_notify_handler(vsnd, 2, virtio_snd_tx_desc_flush_handler);
955+
if(props->p.direction == VIRTIO_SND_D_OUTPUT)
956+
virtio_queue_notify_handler(vsnd, 2, virtio_snd_tx_desc_flush_handler);
957+
else if(props->p.direction == VIRTIO_SND_D_INPUT)
958+
virtio_queue_notify_handler(vsnd, 3, virtio_snd_rx_desc_flush_handler);
954959

955960
*plen = 0;
956961
}

0 commit comments

Comments
 (0)