Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
667f2097
Commit
667f2097
authored
Jan 14, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/alsa: check snd_pcm_state() in Recover()
Copy some good code from the ALSA output plugin.
parent
4ad0747c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
7 deletions
+28
-7
AlsaInputPlugin.cxx
src/input/plugins/AlsaInputPlugin.cxx
+28
-7
No files found.
src/input/plugins/AlsaInputPlugin.cxx
View file @
667f2097
...
...
@@ -231,19 +231,40 @@ AlsaInputStream::Recover(int err)
switch
(
err
)
{
case
-
EPIPE
:
LogDebug
(
alsa_input_domain
,
"Buffer Overrun"
);
// drop through
break
;
}
switch
(
snd_pcm_state
(
capture_handle
))
{
case
SND_PCM_STATE_PAUSED
:
err
=
snd_pcm_pause
(
capture_handle
,
/* disable */
0
);
break
;
case
SND_PCM_STATE_SUSPENDED
:
err
=
snd_pcm_resume
(
capture_handle
);
if
(
err
==
-
EAGAIN
)
return
0
;
/* fall-through to snd_pcm_prepare: */
#if GCC_CHECK_VERSION(7,0)
[[
fallthrough
]];
#endif
case
SND_PCM_STATE_OPEN
:
case
SND_PCM_STATE_SETUP
:
case
SND_PCM_STATE_XRUN
:
err
=
snd_pcm_prepare
(
capture_handle
);
break
;
case
SND_PCM_STATE_DISCONNECTED
:
break
;
case
-
ESTRPIPE
:
case
-
EINTR
:
err
=
snd_pcm_recover
(
capture_handle
,
err
,
1
);
case
SND_PCM_STATE_PREPARED
:
case
SND_PCM_STATE_RUNNING
:
case
SND_PCM_STATE_DRAINING
:
/* this is no error, so just keep running */
err
=
0
;
break
;
default
:
// something broken somewhere, give up
err
=
-
1
;
}
return
err
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment