@@ -623,11 +623,10 @@ static void __virtio_snd_frame_dequeue(short *out,
623623 virtio_snd_prop_t * props = & vsnd_props [stream_id ];
624624
625625 pthread_mutex_lock (& props -> lock .lock );
626- while (props -> lock .buf_ev_notity < 1 ) {
627- fprintf (stderr , "---wait in deque---\n" );
626+ while (props -> lock .buf_ev_notity < 1 )
628627 pthread_cond_wait (& props -> lock .readable , & props -> lock .lock );
629- }
630628
629+ /* Get the PCM frames from queue */
631630 uint32_t written_bytes = 0 ;
632631 memset (props -> intermediate , 0 , sizeof (* props -> intermediate ) * n );
633632 while (!list_empty (& props -> buf_queue_head ) && written_bytes < n ) {
@@ -638,25 +637,14 @@ static void __virtio_snd_frame_dequeue(short *out,
638637 uint32_t len =
639638 left < actual ? left : actual ; /* Naive min implementation */
640639
641- fprintf (stderr ,
642- "--- left %" PRIu32 " actual %" PRIu32 " len %" PRIu32
643- " written %" PRIu32 " node->pos %" PRIu32 " node->len %" PRIu32
644- " node->addr %p \n" ,
645- left , actual , len , written_bytes , node -> pos , node -> len ,
646- node -> addr );
647-
648640 memcpy (props -> intermediate + written_bytes , node -> addr + node -> pos ,
649641 len );
650642
651643 written_bytes += len ;
652644 node -> pos += len ;
653- if (node -> pos >= node -> len ) {
654- fprintf (stderr , "-*- pop node->addr %p\n" , node -> addr );
645+ if (node -> pos >= node -> len )
655646 list_del (& node -> q );
656- }
657647 }
658- fprintf (stderr , "*** written %" PRIu32 " out n %" PRIu32 "\n" ,
659- written_bytes , n );
660648 memcpy (out , props -> intermediate , written_bytes );
661649
662650 props -> lock .buf_ev_notity -- ;
@@ -679,14 +667,12 @@ static void virtio_snd_cb(struct CNFADriver *dev,
679667
680668 pthread_mutex_lock (& v_ptr -> ctrl_mutex );
681669 while (v_ptr -> guest_playing == 0 ) {
682- fprintf (stderr , "wait ctrl cond\n" );
683670 memset (out , 0 , sizeof (* out ) * out_buf_sz );
684671 pthread_cond_wait (& v_ptr -> ctrl_cond , & v_ptr -> ctrl_mutex );
685672 }
686673
687674 uint32_t id = v_ptr -> stream_id ;
688675 uint32_t out_buf_bytes = out_buf_sz * VSND_CNFA_FRAME_SZ ;
689- fprintf (stderr , "start to play with out_buf_sz %" PRIu32 "\n" , out_buf_sz );
690676
691677 __virtio_snd_frame_dequeue (out , out_buf_bytes , id );
692678
@@ -784,12 +770,10 @@ static void __virtio_snd_frame_enqueue(void *payload,
784770 virtio_snd_prop_t * props = & vsnd_props [stream_id ];
785771
786772 pthread_mutex_lock (& props -> lock .lock );
787- while (props -> lock .buf_ev_notity > 0 ) {
788- fprintf (stderr , "---wait for enque---\n" );
773+ while (props -> lock .buf_ev_notity > 0 )
789774 pthread_cond_wait (& props -> lock .writable , & props -> lock .lock );
790- }
791775
792- /* Add to queue */
776+ /* Add a PCM frame to queue */
793777 /* TODO: add description of the speciality of Linux Kernel VirtIO sound
794778 * driver */
795779 vsnd_buf_queue_node_t * node = malloc (sizeof (* node ));
0 commit comments