[alsa-devel] snd-usb: "delay: estimated 0, actual 352"
tiwai at suse.de
Thu Sep 6 15:08:03 CEST 2012
At Thu, 6 Sep 2012 11:43:48 +0200,
Markus Trippelsdorf wrote:
> On 2012.09.06 at 10:21 +0200, Takashi Iwai wrote:
> > At Thu, 06 Sep 2012 09:35:26 +0200,
> > Takashi Iwai wrote:
> > In short, a patch like below may fix the issue (note: completely
> > untested!)
> No it doesn't, unfortunately...
OK, I start tracking down the problem a bit more deeply now.
The issue happens when the first two URBs are passed to
retire_playback_urb(). These are URBs filled before start_endpoints()
are set, so they contain actually zero size. Even though these are
a sort of dummy packets, the driver still tries to check with the
queued delay account, and gives bogus errors.
So, essentially the messages are harmless and nothing to worry too
much, but surely it doesn't look sexy.
The patch below should fix the problem. Please give it a try.
From: Takashi Iwai <tiwai at suse.de>
Subject: [PATCH] ALSA: usb-audio: Fix bogus error messages for delay accounting
The recent fix for the missing fine delayed time adjustment gives
strange error messages at each start of the playback stream, such as
delay: estimated 0, actual 352
delay: estimated 353, actual 705
These come from the sanity check in retire_playback_urb(). Before the
stream is activated via start_endpoints(), a few silent packets have
been already sent. And at this point the delay account is still in
the state as if the new packets are just queued, so the driver gets
confused and spews the bogus error messages.
For fixing the issue, we just need to check whether the received
packet is valid, whether it's zero sized or not.
Reported-by: Markus Trippelsdorf <markus at trippelsdorf.de>
Cc: <stable at vger.kernel.org> [v3.5+]
Signed-off-by: Takashi Iwai <tiwai at suse.de>
sound/usb/pcm.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index fd5e982..f782ce1 100644
@@ -1140,6 +1140,12 @@ static void retire_playback_urb(struct snd_usb_substream *subs,
int processed = urb->transfer_buffer_length / stride;
+ /* ignore the delay accounting when procssed=0 is given, i.e.
+ * silent payloads are procssed before handling the actual data
+ if (!processed)
est_delay = snd_usb_pcm_delay(subs, runtime->rate);
/* update delay with exact number of samples played */
More information about the Alsa-devel