From 40510d19054078235804601131db308e312feaec Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 12 Jan 2006 08:17:49 +0100 Subject: [PATCH] --- yaml --- r: 19550 b: refs/heads/master c: 4b2849283461a64c6d8cc6c7e72c62d7b4d91b43 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/sound/usb/usbaudio.c | 26 +++++++++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 02af1fd23b83..b368d5e65020 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 54c63cfc153c6909a5d5dbe6072e8704b091f30e +refs/heads/master: 4b2849283461a64c6d8cc6c7e72c62d7b4d91b43 diff --git a/trunk/sound/usb/usbaudio.c b/trunk/sound/usb/usbaudio.c index a1bd8040dea4..95729730bcdc 100644 --- a/trunk/sound/usb/usbaudio.c +++ b/trunk/sound/usb/usbaudio.c @@ -478,22 +478,38 @@ static int retire_playback_sync_urb_hs(struct snd_usb_substream *subs, /* * Prepare urb for streaming before playback starts. * - * We don't care about (or have) any data, so we just send a transfer delimiter. + * We don't yet have data, so we send a frame of silence. */ static int prepare_startup_playback_urb(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *urb) { - unsigned int i; + unsigned int i, offs, counts; struct snd_urb_ctx *ctx = urb->context; + int stride = runtime->frame_bits >> 3; + offs = 0; urb->dev = ctx->subs->dev; urb->number_of_packets = subs->packs_per_ms; for (i = 0; i < subs->packs_per_ms; ++i) { - urb->iso_frame_desc[i].offset = 0; - urb->iso_frame_desc[i].length = 0; + /* calculate the size of a packet */ + if (subs->fill_max) + counts = subs->maxframesize; /* fixed */ + else { + subs->phase = (subs->phase & 0xffff) + + (subs->freqm << subs->datainterval); + counts = subs->phase >> 16; + if (counts > subs->maxframesize) + counts = subs->maxframesize; + } + urb->iso_frame_desc[i].offset = offs * stride; + urb->iso_frame_desc[i].length = counts * stride; + offs += counts; } - urb->transfer_buffer_length = 0; + urb->transfer_buffer_length = offs * stride; + memset(urb->transfer_buffer, + subs->cur_audiofmt->format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0, + offs * stride); return 0; }