@@ -333,7 +333,6 @@ static void virtio_snd_read_jack_info_handler(
333333 uint32_t * plen )
334334{
335335 uint32_t cnt = query -> count ;
336- printf ("jack info handler count %d\n" , cnt );
337336 for (uint32_t i = 0 ; i < cnt ; i ++ ) {
338337 info [i ].hdr .hda_fn_nid = 0 ;
339338 info [i ].features = 0 ;
@@ -359,7 +358,6 @@ static void virtio_snd_read_pcm_info_handler(
359358 uint32_t * plen )
360359{
361360 uint32_t cnt = query -> count ;
362- printf ("snd info handler count %d\n" , cnt );
363361 for (uint32_t i = 0 ; i < cnt ; i ++ ) {
364362 info [i ].hdr .hda_fn_nid = 0 ;
365363 info [i ].features = 0 ;
@@ -388,7 +386,6 @@ static void virtio_snd_read_chmap_info_handler(
388386 uint32_t * plen )
389387{
390388 uint32_t cnt = query -> count ;
391- printf ("chmap info handler count %d\n" , cnt );
392389 for (uint32_t i = 0 ; i < cnt ; i ++ ) {
393390 info [i ].hdr .hda_fn_nid = 0 ;
394391 info [i ].direction = VIRTIO_SND_D_OUTPUT ;
@@ -516,6 +513,7 @@ static void virtio_snd_read_pcm_stop(const virtio_snd_pcm_hdr_t *query,
516513static void virtio_snd_read_pcm_release (const virtio_snd_pcm_hdr_t * query ,
517514 uint32_t * plen )
518515{
516+ fprintf (stderr , "virtio_snd_read_pcm_release start\n" );
519517 const virtio_snd_pcm_hdr_t * request = query ;
520518 uint32_t stream_id = request -> stream_id ;
521519 uint32_t code = vsnd_props [stream_id ].pp .hdr .hdr .code ;
@@ -528,21 +526,28 @@ static void virtio_snd_read_pcm_release(const virtio_snd_pcm_hdr_t *query,
528526 }
529527 /* Control the callback to stop playing */
530528 /* TODO: add lock to avoid race condition */
529+ fprintf (stderr , "start guest_playing\n" );
531530 v .guest_playing = 0 ;
532531 pthread_cond_signal (& virtio_snd_ctrl_cond );
532+ fprintf (stderr , "pass guest_playing\n" );
533533
534534 vsnd_props [stream_id ].pp .hdr .hdr .code = VIRTIO_SND_R_PCM_RELEASE ;
535535 CNFAClose (vsnd_props [stream_id ].audio_host );
536+ fprintf (stderr , "pass CNFAclose\n" );
536537
537538 /* Tear down the PCM frames. */
538539 virtio_snd_pcm_frame_t * t = NULL ;
539540 struct queue_head * frame_q = & (vsnd_props [stream_id ].pcm_frames_q );
540541 virtio_snd_pcm_frame_t * frame = vsnd_props [stream_id ].pcm_frames ;
542+ int idx = 0 ;
541543 queue_for_each_entry_safe (frame , t , frame_q , q )
542544 {
543545 free (frame -> buf );
544546 queue_del (& frame -> q );
545547 free (frame );
548+
549+ fprintf (stderr , "tear down frame %d\n" , idx );
550+ idx ++ ;
546551 }
547552 assert (queue_empty (frame_q ));
548553
@@ -579,8 +584,10 @@ static void virtio_snd_cb(struct CNFADriver *dev,
579584
580585 pthread_mutex_lock (& virtio_snd_ctrl_mutex );
581586
582- while (v_ptr -> guest_playing <= 0 )
587+ while (v_ptr -> guest_playing <= 0 ) {
588+ fprintf (stderr , "wait ctrl cond\n" );
583589 pthread_cond_wait (& virtio_snd_ctrl_cond , & virtio_snd_ctrl_mutex );
590+ }
584591
585592 v_ptr -> guest_playing -- ;
586593
0 commit comments