@@ -465,7 +465,7 @@ static void virtio_snd_read_pcm_set_params(
465465 code );
466466 return ;
467467 }
468- /* TODO : check the valiability of buffer_bytes, period_bytes, channel_min,
468+ /* FIXME : check the valiability of buffer_bytes, period_bytes, channel_min,
469469 * and channel_max */
470470 props -> pp .hdr .hdr .code = VIRTIO_SND_R_PCM_SET_PARAMS ;
471471 props -> pp .buffer_bytes = request -> buffer_bytes ;
@@ -504,10 +504,10 @@ static void virtio_snd_read_pcm_prepare(const virtio_snd_pcm_hdr_t *query,
504504 return ;
505505 }
506506
507+ props -> pp .hdr .hdr .code = VIRTIO_SND_R_PCM_PREPARE ;
507508 props -> v .guest_playing = 0 ;
508509 props -> v .stream_id = stream_id ;
509510
510- props -> pp .hdr .hdr .code = VIRTIO_SND_R_PCM_PREPARE ;
511511 uint32_t period_bytes = props -> pp .period_bytes ;
512512 uint32_t channels = props -> pp .channels ;
513513 uint32_t rate = pcm_rate_tbl [props -> pp .rate ];
@@ -619,6 +619,7 @@ static void virtio_snd_read_pcm_release(const virtio_snd_pcm_hdr_t *query,
619619 pthread_mutex_destroy (& props -> lock .lock );
620620 pthread_cond_destroy (& props -> lock .readable );
621621 pthread_cond_destroy (& props -> lock .writable );
622+
622623 /* Tear down PCM buffer queue. */
623624 vsnd_buf_queue_node_t * tmp = NULL ;
624625 vsnd_buf_queue_node_t * node ;
@@ -631,6 +632,7 @@ static void virtio_snd_read_pcm_release(const virtio_snd_pcm_hdr_t *query,
631632
632633 CNFAClose (props -> audio_host );
633634 fprintf (stderr , "pass CNFAclose\n" );
635+
634636 /* Tear down stream related locking attributes. */
635637 pthread_mutex_destroy (& props -> v .ctrl_mutex );
636638 pthread_cond_destroy (& props -> v .ctrl_cond );
@@ -639,9 +641,6 @@ static void virtio_snd_read_pcm_release(const virtio_snd_pcm_hdr_t *query,
639641 fprintf (stderr , "virtio_snd_read_pcm_release\n" );
640642}
641643
642- double omega = 0.0 ;
643- int totalframesp = 0 ;
644- int totalframesr = 0 ;
645644static void __virtio_snd_frame_dequeue (short * out ,
646645 uint32_t n ,
647646 uint32_t stream_id )
@@ -695,7 +694,10 @@ static void virtio_snd_cb(struct CNFADriver *dev,
695694 int framesp ,
696695 int framesr )
697696{
698- (void ) in ; /* reversed for future recording use */
697+ /* reversed for future recording use */
698+ (void ) in ;
699+ (void ) framesr ;
700+
699701 vsnd_stream_sel_t * v_ptr = (vsnd_stream_sel_t * ) dev -> opaque ;
700702 int channels = dev -> channelsPlay ;
701703 uint32_t out_buf_sz = framesp * channels ;
@@ -707,18 +709,12 @@ static void virtio_snd_cb(struct CNFADriver *dev,
707709 pthread_cond_wait (& v_ptr -> ctrl_cond , & v_ptr -> ctrl_mutex );
708710 }
709711
710- totalframesr += framesr ;
711- totalframesp += framesp ;
712-
713712 uint32_t id = v_ptr -> stream_id ;
714713 uint32_t out_buf_bytes = out_buf_sz * VSND_CNFA_FRAME_SZ ;
715714 fprintf (stderr , "start to play with out_buf_sz %" PRIu32 "\n" , out_buf_sz );
716715
717716 __virtio_snd_frame_dequeue (out , out_buf_bytes , id );
718717
719- fprintf (stderr , "totalframesp %d totalframesr %d\n" , totalframesp ,
720- totalframesr );
721-
722718 pthread_mutex_unlock (& v_ptr -> ctrl_mutex );
723719}
724720
0 commit comments