From 47c3e899b12f096e0d97ac46c516e7dd81c27b96 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 15 Aug 2005 08:25:24 +0200 Subject: [PATCH] --- yaml --- r: 6533 b: refs/heads/master c: 9624ea812c7afd2e403c56366cadddb9ecfb88c6 h: refs/heads/master i: 6531: b4195fb697af56ce2c4ef2681f0ffe5440e74f7d v: v3 --- [refs] | 2 +- trunk/sound/usb/usbaudio.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 01f415e7d2f1..93d1f505ad9e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 7efd8bc800324a967a37e8a425433468b7f06adb +refs/heads/master: 9624ea812c7afd2e403c56366cadddb9ecfb88c6 diff --git a/trunk/sound/usb/usbaudio.c b/trunk/sound/usb/usbaudio.c index 2b4f916a0a9a..3f7930c0b616 100644 --- a/trunk/sound/usb/usbaudio.c +++ b/trunk/sound/usb/usbaudio.c @@ -164,6 +164,7 @@ struct snd_usb_substream { unsigned int curframesize; /* current packet size in frames (for capture) */ unsigned int fill_max: 1; /* fill max packet size always */ unsigned int fmt_type; /* USB audio format type (1-3) */ + unsigned int packs_per_ms; /* packets per millisecond (for playback) */ unsigned int running: 1; /* running status */ @@ -537,9 +538,13 @@ static int prepare_playback_urb(snd_usb_substream_t *subs, urb->iso_frame_desc[i].length = 0; urb->number_of_packets++; } + break; } - break; } + /* finish at the frame boundary at/after the period boundary */ + if (period_elapsed && + (i & (subs->packs_per_ms - 1)) == subs->packs_per_ms - 1) + break; } if (subs->hwptr_done + offs > runtime->buffer_size) { /* 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 packs_per_ms = 8 >> subs->datainterval; else packs_per_ms = 1; + subs->packs_per_ms = packs_per_ms; if (is_playback) { urb_packs = nrpacks;