@@ -748,6 +748,7 @@ static int virtio_snd_tx_desc_handler(virtio_snd_state_t *vsnd,
748748 struct queue_head frame_q = vsnd_props [stream_id ].pcm_frames_q ;
749749 INIT_QUEUE_HEAD (& frame_q );
750750 virtio_snd_pcm_frame_t * frame = vsnd_props [stream_id ].pcm_frames ;
751+ uint32_t ret_len = 0 ;
751752 queue_for_each_entry (node , & q , q )
752753 {
753754 uint32_t addr = node -> vq_desc .addr ;
@@ -765,8 +766,8 @@ static int virtio_snd_tx_desc_handler(virtio_snd_state_t *vsnd,
765766 (virtio_snd_pcm_status_t * ) (base + addr );
766767 response -> status = VIRTIO_SND_S_OK ;
767768 response -> latency_bytes =
768- 0 ; /* TODO: show the actual latency bytes */
769- * plen = sizeof ( * response ) ; /* TODO: set the read length of buffer of
769+ 0 ; /* TODO: show the actual latency bytes */
770+ * plen = ret_len ; /* TODO: set the read length of buffer of
770771 PCM frames */
771772 fprintf (stderr , "TX response\n" );
772773 goto early_continue ;
@@ -777,6 +778,7 @@ static int virtio_snd_tx_desc_handler(virtio_snd_state_t *vsnd,
777778 frame -> buf = (void * ) malloc (sizeof (frame -> buf ) * len );
778779 memcpy (frame -> buf , buf , len );
779780 queue_push (& frame -> q , & frame_q );
781+ ret_len += len ;
780782
781783 early_continue :
782784 idx ++ ;
@@ -857,6 +859,7 @@ static void virtio_queue_notify_handler(
857859 */
858860 uint32_t len = 0 ;
859861 int result = handler (vsnd , queue , buffer_idx , & len );
862+ fprintf (stderr , "len: %" PRIu32 "\n" , len );
860863 if (result != 0 )
861864 return virtio_snd_set_fail (vsnd );
862865
0 commit comments