Skip to content

Commit 8cb96f9

Browse files
committed
Fix modulation
1 parent 96f6d54 commit 8cb96f9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

virtio-snd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ static void __virtio_snd_frame_dequeue(void *out,
623623

624624
/* Copy the frame to output stream */
625625
uint32_t size = props->ring.cons.size;
626-
uint32_t idx = cons_head & mask;
626+
uint32_t idx = cons_head % size;
627627
fprintf(stderr,
628628
"cons_head %" PRIu32 " cons_next %" PRIu32 " mask %" PRIu32
629629
" idx %" PRIu32 "\n",
@@ -810,7 +810,7 @@ static void __virtio_snd_frame_enqueue(void *payload,
810810

811811
/* Write payload to ring buffer. */
812812
uint32_t size = props->ring.prod.size;
813-
uint32_t idx = prod_head & mask;
813+
uint32_t idx = prod_head % size;
814814
fprintf(stderr,
815815
"prod_head %" PRIu32 " prod_next %" PRIu32 " mask %" PRIu32
816816
" idx %" PRIu32 "\n",

0 commit comments

Comments
 (0)