Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 248170
b: refs/heads/master
c: 03c2968
h: refs/heads/master
v: v3
  • Loading branch information
Clemens Ladisch authored and Takashi Iwai committed May 11, 2011
1 parent d7a181a commit 7a55ac2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 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: 3a691b28a0ca3cf4d9010c6158318159e0275d2c
refs/heads/master: 03c29680d49662859d14d64f8673550fa3fb2ed1
26 changes: 20 additions & 6 deletions trunk/sound/firewire/isight.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ struct isight {
struct iso_packets_buffer buffer;
struct fw_iso_resources resources;
struct fw_iso_context *context;
bool pcm_active;
bool pcm_running;
bool first_packet;
int packet_index;
Expand Down Expand Up @@ -131,10 +132,12 @@ static void isight_pcm_abort(struct isight *isight)
{
unsigned long flags;

snd_pcm_stream_lock_irqsave(isight->pcm, flags);
if (snd_pcm_running(isight->pcm))
snd_pcm_stop(isight->pcm, SNDRV_PCM_STATE_XRUN);
snd_pcm_stream_unlock_irqrestore(isight->pcm, flags);
if (ACCESS_ONCE(isight->pcm_active)) {
snd_pcm_stream_lock_irqsave(isight->pcm, flags);
if (snd_pcm_running(isight->pcm))
snd_pcm_stop(isight->pcm, SNDRV_PCM_STATE_XRUN);
snd_pcm_stream_unlock_irqrestore(isight->pcm, flags);
}
}

static void isight_dropped_samples(struct isight *isight, unsigned int total)
Expand Down Expand Up @@ -295,8 +298,17 @@ static int isight_close(struct snd_pcm_substream *substream)
static int isight_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{
return snd_pcm_lib_alloc_vmalloc_buffer(substream,
params_buffer_bytes(hw_params));
struct isight *isight = substream->private_data;
int err;

err = snd_pcm_lib_alloc_vmalloc_buffer(substream,
params_buffer_bytes(hw_params));
if (err < 0)
return err;

ACCESS_ONCE(isight->pcm_active) = true;

return 0;
}

static void isight_stop_streaming(struct isight *isight)
Expand All @@ -322,6 +334,8 @@ static int isight_hw_free(struct snd_pcm_substream *substream)
{
struct isight *isight = substream->private_data;

ACCESS_ONCE(isight->pcm_active) = false;

mutex_lock(&isight->mutex);
isight_stop_streaming(isight);
mutex_unlock(&isight->mutex);
Expand Down

0 comments on commit 7a55ac2

Please sign in to comment.