Skip to content

Commit 2db638a

Browse files
committed
Fix wrong assignment
1 parent 4dd617c commit 2db638a

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

virtio-snd.c

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ VSND_GEN_TX_QUEUE_HANDLER(flush, 0);
600600
(virtio_snd_pcm_status_t *) (base + addr); \
601601
response->status = \
602602
bad_msg_err ? VIRTIO_SND_S_IO_ERR : VIRTIO_SND_S_OK; \
603-
response->latency_bytes = 0; \
603+
response->latency_bytes = ret_len; \
604604
*plen = sizeof(virtio_snd_pcm_status_t) + ret_len; \
605605
fprintf(stderr, "*** rx write %" PRIu32 " bytes \n", *plen); \
606606
goto early_continue; \
@@ -841,6 +841,7 @@ static void virtio_snd_read_pcm_prepare(const virtio_snd_pcm_hdr_t *query,
841841
};
842842
uint32_t dir = props->p.direction;
843843
PaError err = paNoError;
844+
fprintf(stderr, "pcm_prepare dir %" PRIu32 "\n", dir);
844845
if (dir == VIRTIO_SND_D_OUTPUT) {
845846
err = Pa_OpenStream(&props->pa_stream, NULL, /* no input */
846847
&params, rate, cnfa_period_frames, paClipOff,
@@ -859,7 +860,6 @@ static void virtio_snd_read_pcm_prepare(const virtio_snd_pcm_hdr_t *query,
859860

860861
*plen = 0;
861862

862-
fprintf(stderr, "=== pcm_prepare \n");
863863
return;
864864

865865
pa_err:
@@ -890,14 +890,12 @@ static void virtio_snd_read_pcm_start(const virtio_snd_pcm_hdr_t *query,
890890
printf("PortAudio error: %s\n", Pa_GetErrorText(err));
891891
return;
892892
}
893-
if(props->p.direction = VIRTIO_SND_D_INPUT) {
893+
if(props->p.direction == VIRTIO_SND_D_INPUT) {
894894
rx_ev_start = 1;
895895
//pthread_cond_signal(&props->lock.readable);
896896
}
897897

898898
*plen = 0;
899-
900-
fprintf(stderr, "=== pcm_start \n");
901899
}
902900

903901
static void virtio_snd_read_pcm_stop(const virtio_snd_pcm_hdr_t *query,
@@ -929,8 +927,6 @@ static void virtio_snd_read_pcm_stop(const virtio_snd_pcm_hdr_t *query,
929927
}
930928

931929
*plen = 0;
932-
933-
fprintf(stderr, "=== pcm_stop\n");
934930
}
935931

936932
static void virtio_snd_read_pcm_release(const virtio_snd_pcm_hdr_t *query,
@@ -1065,8 +1061,6 @@ static void __virtio_snd_rx_frame_dequeue(void *out,
10651061
fprintf(stderr, "((( RX deque get %" PRIu32 " bytes \n", written_bytes);
10661062

10671063
pthread_mutex_unlock(&props->lock.lock);
1068-
1069-
fprintf(stderr, "((( RX deque end\n");
10701064
}
10711065

10721066

@@ -1104,7 +1098,7 @@ static int virtio_snd_rx_stream_cb(const void *input,
11041098
(void) time_info;
11051099
(void) status_flags;
11061100

1107-
fprintf(stderr, "rx_stream_cb\n");
1101+
//fprintf(stderr, "rx_stream_cb\n");
11081102

11091103
vsnd_stream_sel_t *v_ptr = (vsnd_stream_sel_t *) user_data;
11101104
uint32_t id = v_ptr->stream_id;
@@ -1210,12 +1204,9 @@ static void __virtio_snd_frame_enqueue(void *payload,
12101204
virtio_snd_prop_t *props = &vsnd_props[stream_id];
12111205

12121206
pthread_mutex_lock(&props->lock.lock);
1213-
while (props->lock.buf_ev_notity > 0) {
1214-
fprintf(stderr, "buf_ev_notity %d", props->lock.buf_ev_notity);
1207+
while (props->lock.buf_ev_notity > 0)
12151208
pthread_cond_wait(&props->lock.writable, &props->lock.lock);
1216-
}
12171209

1218-
fprintf(stderr, "enque start\n");
12191210
/* Add a PCM frame to queue */
12201211
/* As stated in Linux Kernel mailing list [1], we keep the pointer
12211212
* points to the payload [2] so that we can always get up-to-date
@@ -1235,7 +1226,6 @@ static void __virtio_snd_frame_enqueue(void *payload,
12351226
list_push(&node->q, &props->buf_queue_head);
12361227

12371228
pthread_mutex_unlock(&props->lock.lock);
1238-
fprintf(stderr, "enque end\n");
12391229
}
12401230

12411231
// FIXME: create cirular queue behavior
@@ -1282,7 +1272,6 @@ static void __virtio_snd_rx_frame_enqueue(void *payload,
12821272
props->lock.buf_ev_notity++;
12831273
pthread_cond_signal(&props->lock.readable);
12841274
pthread_mutex_unlock(&props->lock.lock);
1285-
fprintf(stderr, "enque end\n");
12861275
fprintf(stderr, "+++ virtio_snd_rx_enqueue"
12871276
" idx %" PRIu32
12881277
" base %" PRIu32

0 commit comments

Comments
 (0)