Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 148479
b: refs/heads/master
c: ae1ec5e
h: refs/heads/master
i:
  148477: a7cd3f0
  148475: 62a3fcc
  148471: 47af932
  148463: a7100c0
  148447: 0a2c6d1
  148415: b135325
  148351: b8d7b38
  148223: 0afa282
  147967: eb257d8
  147455: cada1d8
v: v3
  • Loading branch information
Takashi Iwai committed May 5, 2009
1 parent e1239d7 commit 177b498
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4bbe1ddf89a5ba3ec30fe5980912d8bda3a3cbb2
refs/heads/master: ae1ec5e1e97f67d41e641a73380129e5905e41cc
14 changes: 13 additions & 1 deletion trunk/sound/usb/usbaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@ static int prepare_playback_urb(struct snd_usb_substream *subs,
subs->hwptr_done += offs;
if (subs->hwptr_done >= runtime->buffer_size)
subs->hwptr_done -= runtime->buffer_size;
runtime->delay += offs;
spin_unlock_irqrestore(&subs->lock, flags);
urb->transfer_buffer_length = offs * stride;
if (period_elapsed)
Expand All @@ -636,12 +637,22 @@ static int prepare_playback_urb(struct snd_usb_substream *subs,

/*
* process after playback data complete
* - nothing to do
* - decrease the delay count again
*/
static int retire_playback_urb(struct snd_usb_substream *subs,
struct snd_pcm_runtime *runtime,
struct urb *urb)
{
unsigned long flags;
int stride = runtime->frame_bits >> 3;
int processed = urb->transfer_buffer_length / stride;

spin_lock_irqsave(&subs->lock, flags);
if (processed > runtime->delay)
runtime->delay = 0;
else
runtime->delay -= processed;
spin_unlock_irqrestore(&subs->lock, flags);
return 0;
}

Expand Down Expand Up @@ -1520,6 +1531,7 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
subs->hwptr_done = 0;
subs->transfer_done = 0;
subs->phase = 0;
runtime->delay = 0;

/* clear urbs (to be sure) */
deactivate_urbs(subs, 0, 1);
Expand Down

0 comments on commit 177b498

Please sign in to comment.