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
e08598e7
Commit
e08598e7
authored
Apr 26, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/alsa: don't submit silence if PCM is not yet running
See code comment. Closes #260
parent
d301a79d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
1 deletion
+30
-1
AlsaOutputPlugin.cxx
src/output/plugins/AlsaOutputPlugin.cxx
+30
-1
No files found.
src/output/plugins/AlsaOutputPlugin.cxx
View file @
e08598e7
...
...
@@ -922,10 +922,39 @@ try {
CopyRingToPeriodBuffer
();
if
(
period_buffer
.
IsEmpty
())
if
(
period_buffer
.
IsEmpty
())
{
if
(
snd_pcm_state
(
pcm
)
==
SND_PCM_STATE_PREPARED
)
{
/* at SND_PCM_STATE_PREPARED (not yet switched
to SND_PCM_STATE_RUNNING), we have no
pressure to fill the ALSA buffer, because
no xrun can possibly occur; and if no data
is available right now, we can easily wait
until some is available; so we just stop
monitoring the ALSA file descriptor, and
let it be reactivated by Play()/Activate()
whenever more data arrives */
{
const
std
::
lock_guard
<
Mutex
>
lock
(
mutex
);
active
=
false
;
}
/* avoid race condition: see if data has
arrived meanwhile before disabling the
event (but after clearing the "active"
flag) */
if
(
!
CopyRingToPeriodBuffer
())
{
MultiSocketMonitor
::
Reset
();
defer_invalidate_sockets
.
Cancel
();
}
return
;
}
/* insert some silence if the buffer has not enough
data yet, to avoid ALSA xrun */
period_buffer
.
FillWithSilence
(
silence
,
out_frame_size
);
}
auto
frames_written
=
WriteFromPeriodBuffer
();
if
(
frames_written
<
0
)
{
...
...
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