linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Markus Trippelsdorf <markus@trippelsdorf.de>
Cc: Daniel Mack <zonque@gmail.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Subject: Re: snd-usb: "delay: estimated 0, actual 352"
Date: Thu, 06 Sep 2012 15:08:03 +0200	[thread overview]
Message-ID: <s5hvcfrxpsc.wl%tiwai@suse.de> (raw)
In-Reply-To: <20120906094348.GA257@x4>

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.


thanks,

Takashi

===

From: Takashi Iwai <tiwai@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@trippelsdorf.de>
Cc: <stable@vger.kernel.org> [v3.5+]
Signed-off-by: Takashi Iwai <tiwai@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
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -1140,6 +1140,12 @@ static void retire_playback_urb(struct snd_usb_substream *subs,
 	int processed = urb->transfer_buffer_length / stride;
 	int est_delay;
 
+	/* ignore the delay accounting when procssed=0 is given, i.e.
+	 * silent payloads are procssed before handling the actual data
+	 */
+	if (!processed)
+		return;
+
 	spin_lock_irqsave(&subs->lock, flags);
 	est_delay = snd_usb_pcm_delay(subs, runtime->rate);
 	/* update delay with exact number of samples played */
-- 
1.7.11.5


  reply	other threads:[~2012-09-06 13:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-04 14:40 [GIT PULL] sound fixes for 3.6-rc5 Takashi Iwai
2012-09-06  6:02 ` Markus Trippelsdorf
2012-09-06  6:33   ` Re: Daniel Mack
2012-09-06  6:45     ` Re: Markus Trippelsdorf
2012-09-06  6:48     ` Re: Takashi Iwai
2012-09-06  6:53       ` Re: Markus Trippelsdorf
2012-09-06  7:08         ` snd-usb: "delay: estimated 0, actual 352" Daniel Mack
2012-09-06  7:17           ` Markus Trippelsdorf
2012-09-06  7:35             ` Takashi Iwai
2012-09-06  8:21               ` Takashi Iwai
2012-09-06  9:43                 ` Markus Trippelsdorf
2012-09-06 13:08                   ` Takashi Iwai [this message]
2012-09-06 13:17                     ` Markus Trippelsdorf
2012-09-06 14:31                       ` Takashi Iwai
2012-09-06 14:40                         ` Daniel Mack
2014-01-08 20:43                         ` Andreas Mohr
2012-09-06 10:25               ` Daniel Mack
2012-09-06 10:30                 ` Markus Trippelsdorf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hvcfrxpsc.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markus@trippelsdorf.de \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=torvalds@linux-foundation.org \
    --cc=zonque@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).