lkml.org 
[lkml]   [2021]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 5/9] ALSA: virtio: handling control and I/O messages for the PCM device
On Mon, 22 Feb 2021 16:34:40 +0100,
Anton Yakovlev wrote:
>
> +void virtsnd_pcm_event(struct virtio_snd *snd, struct virtio_snd_event *event)
> +{
> + struct virtio_pcm_substream *vss;
> + u32 sid = le32_to_cpu(event->data);
> +
> + if (sid >= snd->nsubstreams)
> + return;
> +
> + vss = &snd->substreams[sid];
> +
> + switch (le32_to_cpu(event->hdr.code)) {
> + case VIRTIO_SND_EVT_PCM_PERIOD_ELAPSED:
> + /* TODO: deal with shmem elapsed period */
> + break;
> + case VIRTIO_SND_EVT_PCM_XRUN:
> + spin_lock(&vss->lock);
> + if (vss->xfer_enabled)
> + vss->xfer_xrun = true;
> + spin_unlock(&vss->lock);

You can stop the stream at xrun, too.

But it often messes up with the locking, so it's no mandatory
implementation. You seem to pass the xrun state at the pointer
callback, and this should be enough for normal uses.


thanks,

Takashi

\
 
 \ /
  Last update: 2021-02-25 11:54    [W:0.040 / U:0.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site