aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorEldad Zack <eldad@fogrefinery.com>2012-11-28 17:55:34 -0500
committerTakashi Iwai <tiwai@suse.de>2012-11-29 02:42:54 -0500
commit28acb12014fb0c3e1edfdab1b1e3e266cf651550 (patch)
treeb2d6059123eeddba87acac4784078cb05c611547 /sound/usb
parentfde854bdaf603a99a80b9545c0aaca9ccd02dd31 (diff)
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: Eldad Zack <eldad@fogrefinery.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/endpoint.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index f487d26f8d40..21049b882ee6 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -1018,15 +1018,18 @@ void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep,
1018 /* 1018 /*
1019 * Iterate through the inbound packet and prepare the lengths 1019 * Iterate through the inbound packet and prepare the lengths
1020 * for the output packet. The OUT packet we are about to send 1020 * for the output packet. The OUT packet we are about to send
1021 * will have the same amount of payload bytes than the IN 1021 * will have the same amount of payload bytes per stride as the
1022 * packet we just received. 1022 * IN packet we just received. Since the actual size is scaled
1023 * by the stride, use the sender stride to calculate the length
1024 * in case the number of channels differ between the implicitly
1025 * fed-back endpoint and the synchronizing endpoint.
1023 */ 1026 */
1024 1027
1025 out_packet->packets = in_ctx->packets; 1028 out_packet->packets = in_ctx->packets;
1026 for (i = 0; i < in_ctx->packets; i++) { 1029 for (i = 0; i < in_ctx->packets; i++) {
1027 if (urb->iso_frame_desc[i].status == 0) 1030 if (urb->iso_frame_desc[i].status == 0)
1028 out_packet->packet_size[i] = 1031 out_packet->packet_size[i] =
1029 urb->iso_frame_desc[i].actual_length / ep->stride; 1032 urb->iso_frame_desc[i].actual_length / sender->stride;
1030 else 1033 else
1031 out_packet->packet_size[i] = 0; 1034 out_packet->packet_size[i] = 0;
1032 } 1035 }