提交 306a4f3c 编写于 作者: R Robert Rosengren 提交者: Takashi Iwai

ALSA: aloop: Mark paused device as inactive

Show paused ALSA aloop device as inactive, i.e. the control
"PCM Slave Active" set as false. Notification sent upon state change.

This makes it possible for client capturing from aloop device to know if
data is expected. Without it the client expects data even if playback
is paused.
Signed-off-by: NRobert Rosengren <robert.rosengren@axis.com>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 568fa7e0
...@@ -296,6 +296,8 @@ static int loopback_trigger(struct snd_pcm_substream *substream, int cmd) ...@@ -296,6 +296,8 @@ static int loopback_trigger(struct snd_pcm_substream *substream, int cmd)
cable->pause |= stream; cable->pause |= stream;
loopback_timer_stop(dpcm); loopback_timer_stop(dpcm);
spin_unlock(&cable->lock); spin_unlock(&cable->lock);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
loopback_active_notify(dpcm);
break; break;
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_RESUME:
...@@ -304,6 +306,8 @@ static int loopback_trigger(struct snd_pcm_substream *substream, int cmd) ...@@ -304,6 +306,8 @@ static int loopback_trigger(struct snd_pcm_substream *substream, int cmd)
cable->pause &= ~stream; cable->pause &= ~stream;
loopback_timer_start(dpcm); loopback_timer_start(dpcm);
spin_unlock(&cable->lock); spin_unlock(&cable->lock);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
loopback_active_notify(dpcm);
break; break;
default: default:
return -EINVAL; return -EINVAL;
...@@ -892,9 +896,11 @@ static int loopback_active_get(struct snd_kcontrol *kcontrol, ...@@ -892,9 +896,11 @@ static int loopback_active_get(struct snd_kcontrol *kcontrol,
[kcontrol->id.subdevice][kcontrol->id.device ^ 1]; [kcontrol->id.subdevice][kcontrol->id.device ^ 1];
unsigned int val = 0; unsigned int val = 0;
if (cable != NULL) if (cable != NULL) {
val = (cable->running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) ? unsigned int running = cable->running ^ cable->pause;
1 : 0;
val = (running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) ? 1 : 0;
}
ucontrol->value.integer.value[0] = val; ucontrol->value.integer.value[0] = val;
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册