Skip to content

Commit ba1a738

Browse files
committed
Debug
The playing beginning artifact appears again.
1 parent 8658fcf commit ba1a738

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

virtio-snd.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -842,10 +842,10 @@ static void __virtio_snd_frame_enqueue(void *payload,
842842
/* Write payload to ring buffer. */
843843
uint32_t size = props->ring.prod.size;
844844
uint32_t idx = prod_head % size;
845-
/*fprintf(stderr,
846-
"prod_head %" PRIu32 " prod_next %" PRIu32 " mask %" PRIu32
847-
" idx %" PRIu32 "\n",
848-
prod_head, prod_next, mask, idx);*/
845+
fprintf(stderr,
846+
"prod_head %" PRIu32 " prod_next %" PRIu32 " cons_tail %" PRIu32
847+
" mask %" PRIu32 " idx %" PRIu32 "\n",
848+
prod_head, prod_next, cons_tail, mask, idx);
849849
if (idx + n < size) {
850850
memcpy(props->ring.buffer + idx, payload, n);
851851
} else {
@@ -858,9 +858,9 @@ static void __virtio_snd_frame_enqueue(void *payload,
858858
props->ring.prod.tail = prod_next;
859859

860860
uint32_t buffer_bytes = props->pp.buffer_bytes;
861-
if (mask + cons_tail - prod_next >= buffer_bytes) {
861+
if (prod_next - cons_tail >= buffer_bytes) {
862862
fprintf(stderr, "buffer ready for %" PRIu32 "\n",
863-
mask + cons_tail - prod_next);
863+
prod_next - cons_tail);
864864
props->ring.buf_ev_notity++;
865865
pthread_cond_signal(&props->ring.readable);
866866
}

0 commit comments

Comments
 (0)