mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-27 23:55:57 -05:00
[alsa] Avoid call to snd_pcm_prepare if already in the right state
This commit is contained in:
parent
19181007f4
commit
e23fed4ac4
@ -531,15 +531,23 @@ static void
|
|||||||
playback_start(struct alsa_session *as, uint64_t pos, uint64_t start_pos)
|
playback_start(struct alsa_session *as, uint64_t pos, uint64_t start_pos)
|
||||||
{
|
{
|
||||||
snd_output_t *output;
|
snd_output_t *output;
|
||||||
|
snd_pcm_state_t state;
|
||||||
char *debug_pcm_cfg;
|
char *debug_pcm_cfg;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
state = snd_pcm_state(hdl);
|
||||||
|
if (state != SND_PCM_STATE_PREPARED)
|
||||||
|
{
|
||||||
|
if (state == SND_PCM_STATE_RUNNING)
|
||||||
|
snd_pcm_drop(hdl);
|
||||||
|
|
||||||
ret = snd_pcm_prepare(hdl);
|
ret = snd_pcm_prepare(hdl);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_LAUDIO, "Could not prepare ALSA device '%s': %s\n", as->devname, snd_strerror(ret));
|
DPRINTF(E_LOG, L_LAUDIO, "Could not prepare ALSA device '%s' (state %d): %s\n", as->devname, state, snd_strerror(ret));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Clear prebuffer in case start somehow got called twice without a stop in between
|
// Clear prebuffer in case start somehow got called twice without a stop in between
|
||||||
prebuf_free(as);
|
prebuf_free(as);
|
||||||
|
Loading…
Reference in New Issue
Block a user