Commit 28acb120 authored by Eldad Zack's avatar Eldad Zack Committed by Takashi Iwai

ALSA: usb-audio: use sender stride for implicit feedback

For implicit feedback endpoints, the number of bytes for each packet
is matched by the corresponding synchronizing endpoint.
The size is calculated by taking the actual size and dividing it by
the stride - currently by the endpoint's stride, but we should use the
synchronization source's stride.
This is evident when the number of channels differ between the
synchronization source and the implicitly fed-back endpoint, as with
M-Audio Fast Track C400 - the synchronization source (capture)
has 4 channels, while the implicit feedback mode endpoint has 6.
Signed-off-by: default avatarEldad Zack <eldad@fogrefinery.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent fde854bd
...@@ -1018,15 +1018,18 @@ void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep, ...@@ -1018,15 +1018,18 @@ void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep,
/* /*
* Iterate through the inbound packet and prepare the lengths * Iterate through the inbound packet and prepare the lengths
* for the output packet. The OUT packet we are about to send * for the output packet. The OUT packet we are about to send
* will have the same amount of payload bytes than the IN * will have the same amount of payload bytes per stride as the
* packet we just received. * IN packet we just received. Since the actual size is scaled
* by the stride, use the sender stride to calculate the length
* in case the number of channels differ between the implicitly
* fed-back endpoint and the synchronizing endpoint.
*/ */
out_packet->packets = in_ctx->packets; out_packet->packets = in_ctx->packets;
for (i = 0; i < in_ctx->packets; i++) { for (i = 0; i < in_ctx->packets; i++) {
if (urb->iso_frame_desc[i].status == 0) if (urb->iso_frame_desc[i].status == 0)
out_packet->packet_size[i] = out_packet->packet_size[i] =
urb->iso_frame_desc[i].actual_length / ep->stride; urb->iso_frame_desc[i].actual_length / sender->stride;
else else
out_packet->packet_size[i] = 0; out_packet->packet_size[i] = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment