diff options
author | Daniel Mack <zonque@gmail.com> | 2013-04-16 12:01:37 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-04-18 04:03:23 -0400 |
commit | 8a2a74d2b7667b2719858caf9eb2b5a92460195d (patch) | |
tree | a6d257af3b353205c2b2add2c7740713da9a0c9a /sound/usb/pcm.c | |
parent | ef7a4f979bd8201324b2bcd30277c14aba889f50 (diff) |
ALSA: snd-usb: use ep->stride from urb callbacks
For normal PCM transfer, this change has no effect, as the endpoint's
stride is always frame_bits/8. For DSD DOP streams, however, which is
added later, the hardware stride differs from the software stride, and
the endpoint has the correct information in these cases.
Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/pcm.c')
-rw-r--r-- | sound/usb/pcm.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index 9916c85d8cdb..099c0fe0d1e1 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c | |||
@@ -1236,8 +1236,8 @@ static void prepare_playback_urb(struct snd_usb_substream *subs, | |||
1236 | counts = snd_usb_endpoint_next_packet_size(ep); | 1236 | counts = snd_usb_endpoint_next_packet_size(ep); |
1237 | 1237 | ||
1238 | /* set up descriptor */ | 1238 | /* set up descriptor */ |
1239 | urb->iso_frame_desc[i].offset = frames * stride; | 1239 | urb->iso_frame_desc[i].offset = frames * ep->stride; |
1240 | urb->iso_frame_desc[i].length = counts * stride; | 1240 | urb->iso_frame_desc[i].length = counts * ep->stride; |
1241 | frames += counts; | 1241 | frames += counts; |
1242 | urb->number_of_packets++; | 1242 | urb->number_of_packets++; |
1243 | subs->transfer_done += counts; | 1243 | subs->transfer_done += counts; |
@@ -1251,14 +1251,14 @@ static void prepare_playback_urb(struct snd_usb_substream *subs, | |||
1251 | frames -= subs->transfer_done; | 1251 | frames -= subs->transfer_done; |
1252 | counts -= subs->transfer_done; | 1252 | counts -= subs->transfer_done; |
1253 | urb->iso_frame_desc[i].length = | 1253 | urb->iso_frame_desc[i].length = |
1254 | counts * stride; | 1254 | counts * ep->stride; |
1255 | subs->transfer_done = 0; | 1255 | subs->transfer_done = 0; |
1256 | } | 1256 | } |
1257 | i++; | 1257 | i++; |
1258 | if (i < ctx->packets) { | 1258 | if (i < ctx->packets) { |
1259 | /* add a transfer delimiter */ | 1259 | /* add a transfer delimiter */ |
1260 | urb->iso_frame_desc[i].offset = | 1260 | urb->iso_frame_desc[i].offset = |
1261 | frames * stride; | 1261 | frames * ep->stride; |
1262 | urb->iso_frame_desc[i].length = 0; | 1262 | urb->iso_frame_desc[i].length = 0; |
1263 | urb->number_of_packets++; | 1263 | urb->number_of_packets++; |
1264 | } | 1264 | } |
@@ -1269,7 +1269,7 @@ static void prepare_playback_urb(struct snd_usb_substream *subs, | |||
1269 | !snd_usb_endpoint_implicit_feedback_sink(subs->data_endpoint)) /* finish at the period boundary */ | 1269 | !snd_usb_endpoint_implicit_feedback_sink(subs->data_endpoint)) /* finish at the period boundary */ |
1270 | break; | 1270 | break; |
1271 | } | 1271 | } |
1272 | bytes = frames * stride; | 1272 | bytes = frames * ep->stride; |
1273 | if (subs->hwptr_done + bytes > runtime->buffer_size * stride) { | 1273 | if (subs->hwptr_done + bytes > runtime->buffer_size * stride) { |
1274 | /* err, the transferred area goes over buffer boundary. */ | 1274 | /* err, the transferred area goes over buffer boundary. */ |
1275 | unsigned int bytes1 = | 1275 | unsigned int bytes1 = |
@@ -1310,8 +1310,8 @@ static void retire_playback_urb(struct snd_usb_substream *subs, | |||
1310 | { | 1310 | { |
1311 | unsigned long flags; | 1311 | unsigned long flags; |
1312 | struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; | 1312 | struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; |
1313 | int stride = runtime->frame_bits >> 3; | 1313 | struct snd_usb_endpoint *ep = subs->data_endpoint; |
1314 | int processed = urb->transfer_buffer_length / stride; | 1314 | int processed = urb->transfer_buffer_length / ep->stride; |
1315 | int est_delay; | 1315 | int est_delay; |
1316 | 1316 | ||
1317 | /* ignore the delay accounting when procssed=0 is given, i.e. | 1317 | /* ignore the delay accounting when procssed=0 is given, i.e. |