Skip to content

Commit

Permalink
Tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuda-Chen committed Jan 2, 2025
1 parent e3f3b2e commit a72aecb
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions virtio-snd.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,8 @@ static void virtio_snd_read_pcm_release(const virtio_snd_pcm_hdr_t *query,
fprintf(stderr, "virtio_snd_read_pcm_release start\n");
const virtio_snd_pcm_hdr_t *request = query;
uint32_t stream_id = request->stream_id;
uint32_t code = vsnd_props[stream_id].pp.hdr.hdr.code;
virtio_snd_prop_t *props = &vsnd_props[stream_id];
uint32_t code = props->pp.hdr.hdr.code;
if (code != VIRTIO_SND_R_PCM_PREPARE && code != VIRTIO_SND_R_PCM_STOP) {
fprintf(
stderr,
Expand All @@ -595,15 +596,15 @@ static void virtio_snd_read_pcm_release(const virtio_snd_pcm_hdr_t *query,
return;
}

vsnd_props[stream_id].pp.hdr.hdr.code = VIRTIO_SND_R_PCM_RELEASE;
props->pp.hdr.hdr.code = VIRTIO_SND_R_PCM_RELEASE;

/* Tear down the PCM frames. */
free(vsnd_props[stream_id].ring.buffer);
pthread_mutex_destroy(&vsnd_props[stream_id].ring.lock);
pthread_cond_destroy(&vsnd_props[stream_id].ring.readable);
pthread_cond_destroy(&vsnd_props[stream_id].ring.writable);
/* Tear down the PCM ring buffer. */
free(props->ring.buffer);
pthread_mutex_destroy(&props->ring.lock);
pthread_cond_destroy(&props->ring.readable);
pthread_cond_destroy(&props->ring.writable);

CNFAClose(vsnd_props[stream_id].audio_host);
CNFAClose(props->audio_host);
fprintf(stderr, "pass CNFAclose\n");

*plen = 0;
Expand Down

0 comments on commit a72aecb

Please sign in to comment.