Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
The playing beginning artifact appears again.
  • Loading branch information
Cuda-Chen committed Dec 29, 2024
1 parent 8658fcf commit ba1a738
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions virtio-snd.c
Original file line number Diff line number Diff line change
Expand Up @@ -842,10 +842,10 @@ static void __virtio_snd_frame_enqueue(void *payload,
/* Write payload to ring buffer. */
uint32_t size = props->ring.prod.size;
uint32_t idx = prod_head % size;
/*fprintf(stderr,
"prod_head %" PRIu32 " prod_next %" PRIu32 " mask %" PRIu32
" idx %" PRIu32 "\n",
prod_head, prod_next, mask, idx);*/
fprintf(stderr,
"prod_head %" PRIu32 " prod_next %" PRIu32 " cons_tail %" PRIu32
" mask %" PRIu32 " idx %" PRIu32 "\n",
prod_head, prod_next, cons_tail, mask, idx);
if (idx + n < size) {
memcpy(props->ring.buffer + idx, payload, n);
} else {
Expand All @@ -858,9 +858,9 @@ static void __virtio_snd_frame_enqueue(void *payload,
props->ring.prod.tail = prod_next;

uint32_t buffer_bytes = props->pp.buffer_bytes;
if (mask + cons_tail - prod_next >= buffer_bytes) {
if (prod_next - cons_tail >= buffer_bytes) {
fprintf(stderr, "buffer ready for %" PRIu32 "\n",
mask + cons_tail - prod_next);
prod_next - cons_tail);
props->ring.buf_ev_notity++;
pthread_cond_signal(&props->ring.readable);
}
Expand Down

0 comments on commit ba1a738

Please sign in to comment.