tree 6d48ed32f35a3b1ebb1fac0021e810f57a141e0d
parent 7efd8bc800324a967a37e8a425433468b7f06adb
author Clemens Ladisch <[EMAIL PROTECTED]> Mon, 15 Aug 2005 08:25:24 +0200
committer Jaroslav Kysela <[EMAIL PROTECTED]> Tue, 30 Aug 2005 08:45:47 +0200

[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 <[EMAIL PROTECTED]>

 sound/usb/usbaudio.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
--- a/sound/usb/usbaudio.c
+++ b/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_
                                        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_s
                packs_per_ms = 8 >> subs->datainterval;
        else
                packs_per_ms = 1;
+       subs->packs_per_ms = packs_per_ms;
 
        if (is_playback) {
                urb_packs = nrpacks;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to