aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/usbaudio.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2005-08-15 02:25:24 -0400
committerJaroslav Kysela <perex@suse.cz>2005-08-30 02:45:47 -0400
commit9624ea812c7afd2e403c56366cadddb9ecfb88c6 (patch)
tree6d48ed32f35a3b1ebb1fac0021e810f57a141e0d /sound/usb/usbaudio.c
parent7efd8bc800324a967a37e8a425433468b7f06adb (diff)
[ALSA] usb-audio: actually schedule playback URBs at frame boundaries
USB generic driver Change prepare_playback_urb() not to stop preparing packets before a frame boundary has been reached. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/usb/usbaudio.c')
-rw-r--r--sound/usb/usbaudio.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index 2b4f916a0a9a..3f7930c0b616 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -164,6 +164,7 @@ struct snd_usb_substream {
164 unsigned int curframesize; /* current packet size in frames (for capture) */ 164 unsigned int curframesize; /* current packet size in frames (for capture) */
165 unsigned int fill_max: 1; /* fill max packet size always */ 165 unsigned int fill_max: 1; /* fill max packet size always */
166 unsigned int fmt_type; /* USB audio format type (1-3) */ 166 unsigned int fmt_type; /* USB audio format type (1-3) */
167 unsigned int packs_per_ms; /* packets per millisecond (for playback) */
167 168
168 unsigned int running: 1; /* running status */ 169 unsigned int running: 1; /* running status */
169 170
@@ -537,9 +538,13 @@ static int prepare_playback_urb(snd_usb_substream_t *subs,
537 urb->iso_frame_desc[i].length = 0; 538 urb->iso_frame_desc[i].length = 0;
538 urb->number_of_packets++; 539 urb->number_of_packets++;
539 } 540 }
541 break;
540 } 542 }
541 break;
542 } 543 }
544 /* finish at the frame boundary at/after the period boundary */
545 if (period_elapsed &&
546 (i & (subs->packs_per_ms - 1)) == subs->packs_per_ms - 1)
547 break;
543 } 548 }
544 if (subs->hwptr_done + offs > runtime->buffer_size) { 549 if (subs->hwptr_done + offs > runtime->buffer_size) {
545 /* err, the transferred area goes over buffer boundary. */ 550 /* err, the transferred area goes over buffer boundary. */
@@ -907,6 +912,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by
907 packs_per_ms = 8 >> subs->datainterval; 912 packs_per_ms = 8 >> subs->datainterval;
908 else 913 else
909 packs_per_ms = 1; 914 packs_per_ms = 1;
915 subs->packs_per_ms = packs_per_ms;
910 916
911 if (is_playback) { 917 if (is_playback) {
912 urb_packs = nrpacks; 918 urb_packs = nrpacks;