* [PATCH] usb-audio: don't use empty packets at start of playback
@ 2006-01-12 8:44 Clemens Ladisch
2006-01-12 17:48 ` [stable] " Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Clemens Ladisch @ 2006-01-12 8:44 UTC (permalink / raw)
To: stable; +Cc: Takashi Iwai, alsa-devel
Some widespread USB interface chips with adaptive iso endpoints hang
after receiving a series of empty packets when they expect data. This
completely disables audio playback on those devices. To avoid this, we
have to send packets containing silence (zero samples) instead.
ALSA bug: http://bugtrack.alsa-project.org/alsa-bug/view.php?id=1585
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Index: linux-2.6.15/sound/usb/usbaudio.c
===================================================================
--- linux-2.6.15.orig/sound/usb/usbaudio.c 2006-01-06 16:11:26.000000000 +0100
+++ linux-2.6.15/sound/usb/usbaudio.c 2006-01-11 19:29:18.000000000 +0100
@@ -480,22 +480,38 @@ static int retire_playback_sync_urb_hs(s
/*
* 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(snd_usb_substream_t *subs,
snd_pcm_runtime_t *runtime,
struct urb *urb)
{
- unsigned int i;
+ unsigned int i, offs, counts;
snd_urb_ctx_t *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;
}
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [stable] [PATCH] usb-audio: don't use empty packets at start of playback
2006-01-12 8:44 [PATCH] usb-audio: don't use empty packets at start of playback Clemens Ladisch
@ 2006-01-12 17:48 ` Greg KH
2006-01-12 18:04 ` Takashi Iwai
0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2006-01-12 17:48 UTC (permalink / raw)
To: Clemens Ladisch; +Cc: stable, Takashi Iwai, alsa-devel
On Thu, Jan 12, 2006 at 09:44:29AM +0100, Clemens Ladisch wrote:
> Some widespread USB interface chips with adaptive iso endpoints hang
> after receiving a series of empty packets when they expect data. This
> completely disables audio playback on those devices. To avoid this, we
> have to send packets containing silence (zero samples) instead.
>
> ALSA bug: http://bugtrack.alsa-project.org/alsa-bug/view.php?id=1585
>
> Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Is this upstream in Linus's tree yet? The Alsa cvs tree yet?
thanks,
greg k-h
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [stable] [PATCH] usb-audio: don't use empty packets at start of playback
2006-01-12 17:48 ` [stable] " Greg KH
@ 2006-01-12 18:04 ` Takashi Iwai
2006-01-13 3:47 ` Chris Wright
0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2006-01-12 18:04 UTC (permalink / raw)
To: Greg KH; +Cc: Clemens Ladisch, stable, alsa-devel
At Thu, 12 Jan 2006 09:48:54 -0800,
Greg KH wrote:
>
> On Thu, Jan 12, 2006 at 09:44:29AM +0100, Clemens Ladisch wrote:
> > Some widespread USB interface chips with adaptive iso endpoints hang
> > after receiving a series of empty packets when they expect data. This
> > completely disables audio playback on those devices. To avoid this, we
> > have to send packets containing silence (zero samples) instead.
> >
> > ALSA bug: http://bugtrack.alsa-project.org/alsa-bug/view.php?id=1585
> >
> > Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
>
> Is this upstream in Linus's tree yet? The Alsa cvs tree yet?
Already in ALSA CVS, so will be merged at the next pull request.
thanks,
Takashi
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [stable] [PATCH] usb-audio: don't use empty packets at start of playback
2006-01-12 18:04 ` Takashi Iwai
@ 2006-01-13 3:47 ` Chris Wright
0 siblings, 0 replies; 4+ messages in thread
From: Chris Wright @ 2006-01-13 3:47 UTC (permalink / raw)
To: Takashi Iwai; +Cc: Greg KH, alsa-devel, Clemens Ladisch, stable
* Takashi Iwai (tiwai@suse.de) wrote:
> Already in ALSA CVS, so will be merged at the next pull request.
Thanks, queued to -stable.
-chris
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-01-13 3:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-12 8:44 [PATCH] usb-audio: don't use empty packets at start of playback Clemens Ladisch
2006-01-12 17:48 ` [stable] " Greg KH
2006-01-12 18:04 ` Takashi Iwai
2006-01-13 3:47 ` Chris Wright
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.