Fix playback stop causing isochronous stream gaps: keep ghost URBs running on STOP
This commit is contained in:
parent
bca0c6e552
commit
e1b569a5dd
|
|
@ -140,19 +140,24 @@ static int tascam_playback_prepare(struct snd_pcm_substream *substream)
|
|||
{
|
||||
struct tascam_card *tascam = snd_pcm_substream_chip(substream);
|
||||
|
||||
if (!tascam->running_ghost_playback) {
|
||||
usb_kill_anchored_urbs(&tascam->playback_anchor);
|
||||
usb_kill_anchored_urbs(&tascam->feedback_anchor);
|
||||
}
|
||||
|
||||
tascam->driver_playback_pos = 0;
|
||||
tascam->playback_frames_consumed = 0;
|
||||
tascam->last_pb_period_pos = 0;
|
||||
tascam->feedback_synced = false;
|
||||
tascam->running_ghost_playback = false;
|
||||
tascam->feedback_urb_skip_count = 4;
|
||||
tascam->phase_accum = 0;
|
||||
tascam->freq_q16 = div_u64(((u64)tascam->current_rate << 16), 8000);
|
||||
|
||||
if (!tascam->running_ghost_playback) {
|
||||
tascam->running_ghost_playback = false;
|
||||
prepare_urb_descriptors(tascam);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -181,8 +186,6 @@ static int tascam_playback_trigger(struct snd_pcm_substream *substream, int cmd)
|
|||
case SNDRV_PCM_TRIGGER_SUSPEND:
|
||||
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
||||
atomic_set(&tascam->playback_active, 0);
|
||||
/* Fall back to ghost playback if capture/midi active */
|
||||
if (atomic_read(&tascam->stream_refs) > 0)
|
||||
tascam->running_ghost_playback = true;
|
||||
break;
|
||||
default:
|
||||
|
|
@ -199,8 +202,15 @@ static snd_pcm_uframes_t tascam_playback_pointer(struct snd_pcm_substream *subst
|
|||
unsigned long flags;
|
||||
u64 pos;
|
||||
|
||||
if (!atomic_read(&tascam->playback_active))
|
||||
if (!atomic_read(&tascam->playback_active)) {
|
||||
if (tascam->running_ghost_playback) {
|
||||
spin_lock_irqsave(&tascam->lock, flags);
|
||||
pos = tascam->playback_frames_consumed;
|
||||
spin_unlock_irqrestore(&tascam->lock, flags);
|
||||
return (snd_pcm_uframes_t)pos;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&tascam->lock, flags);
|
||||
pos = tascam->playback_frames_consumed;
|
||||
|
|
|
|||
Loading…
Reference in New Issue