]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ALSA: usb-audio: Fix bogus error messages for delay accounting
authorTakashi Iwai <tiwai@suse.de>
Thu, 6 Sep 2012 12:58:00 +0000 (14:58 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 6 Sep 2012 13:00:15 +0000 (15:00 +0200)
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

index fd5e982fc98c2af6b01f84d00450b1262b76f218..f782ce19bf5aa14be92a43df553d66b177cb9429 100644 (file)
@@ -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 */