ALSA: usb-audio: ignore delay calculation for capture stream
authorTakashi Iwai <tiwai@suse.de>
Fri, 23 Nov 2012 13:28:42 +0000 (14:28 +0100)
committerTakashi Iwai <tiwai@suse.de>
Fri, 23 Nov 2012 14:37:32 +0000 (15:37 +0100)
It doesn't make sense to calculate the delay for capture streams in
the current implementation.  It's always zero, so we should skip the
computation in snd_usb_pcm_pointer() in the case of capture.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/pcm.c

index e919c2e40fa0d955f7ea7c0f234d4fddda378b7d..8e1d5e00c182a48f9c0d8d923eaa926ff07ac054 100644 (file)
@@ -75,7 +75,8 @@ static snd_pcm_uframes_t snd_usb_pcm_pointer(struct snd_pcm_substream *substream
                return SNDRV_PCM_POS_XRUN;
        spin_lock(&subs->lock);
        hwptr_done = subs->hwptr_done;
-       substream->runtime->delay = snd_usb_pcm_delay(subs,
+       if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+               substream->runtime->delay = snd_usb_pcm_delay(subs,
                                                substream->runtime->rate);
        spin_unlock(&subs->lock);
        return hwptr_done / (substream->runtime->frame_bits >> 3);