[alsa-devel] [PATCH 1/5] ALSA: snd-usb: implement new endpoint streaming model
Clemens Ladisch
clemens at ladisch.de
Tue Nov 1 21:57:13 CET 2011
Daniel Mack wrote:
> +++ b/sound/usb/card.h
> +struct snd_usb_endpoint {
>
> + struct snd_usb_endpoint *sync_slave;
In theory, there could be more than one slave.
> +struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip,
> ...
> + /* select the alt setting once so the endpoints become valid */
> + snd_printk("%s() calling usb_set_interface()\n", __func__);
> + usb_set_interface(ep->chip->dev, ep->iface, ep->alt_idx);
This needs error handling.
> +void snd_usb_endpoint_activate(struct snd_usb_endpoint *ep)
> +{
> + usb_set_interface(ep->chip->dev, ep->iface, ep->alt_idx);
This too.
> +void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep,
> +{
> + for (i = 0; i < in_ctx->packets; i++) {
> + if (urb->iso_frame_desc[i].status == 0)
> + out_ctx->packet_size[i] =
> + urb->iso_frame_desc[i].actual_length / ep->stride;
> + else
> + out_ctx->packet_size[i] = 0;
When there is any error in any received packet (status != 0), we do not
know how many frames to send. Sending zero frames is certain to be
wrong and will break synchronization between the two streams.
As far as I can see, the only way to handle such errors is to stop the
stream(s) and the PCM device(s).
Regards,
Clemens
More information about the Alsa-devel
mailing list