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
a92aa0be
Commit
a92aa0be
authored
Jun 27, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/alsa: use IsCleared() instead of IsDrained() in DrainInternal()
Really drain all data from the period_buffer in any case.
parent
d66f5a85
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
25 deletions
+21
-25
PeriodBuffer.hxx
src/lib/alsa/PeriodBuffer.hxx
+0
-8
AlsaOutputPlugin.cxx
src/output/plugins/AlsaOutputPlugin.cxx
+21
-17
No files found.
src/lib/alsa/PeriodBuffer.hxx
View file @
a92aa0be
...
...
@@ -78,14 +78,6 @@ public:
}
/**
* Has some data already been consumed at the buffer's head in
* this period?
*/
bool
WasConsumed
()
const
noexcept
{
return
head
>
0
;
}
/**
* Has all data for the current period been drained? If not,
* then there is pending data. This ignores the partial frame
* which may have been postponed by FillWithSilence().
...
...
src/output/plugins/AlsaOutputPlugin.cxx
View file @
a92aa0be
...
...
@@ -747,26 +747,30 @@ AlsaOutput::DrainInternal()
/* drain ring_buffer */
CopyRingToPeriodBuffer
();
if
(
period_buffer
.
WasConsumed
()
&&
!
period_buffer
.
IsFull
())
/* generate some silence to finish the partial
period */
period_buffer
.
FillWithSilence
(
silence
,
out_frame_size
);
/* drain period_buffer */
if
(
!
period_buffer
.
IsDrained
())
{
auto
frames_written
=
WriteFromPeriodBuffer
();
if
(
frames_written
<
0
)
{
if
(
frames_written
==
-
EAGAIN
)
return
false
;
if
(
!
period_buffer
.
IsCleared
())
{
if
(
!
period_buffer
.
IsFull
())
/* generate some silence to finish the partial
period */
period_buffer
.
FillWithSilence
(
silence
,
out_frame_size
);
/* drain period_buffer */
if
(
!
period_buffer
.
IsDrained
())
{
auto
frames_written
=
WriteFromPeriodBuffer
();
if
(
frames_written
<
0
)
{
if
(
frames_written
==
-
EAGAIN
)
return
false
;
throw
FormatRuntimeError
(
"snd_pcm_writei() failed: %s"
,
snd_strerror
(
-
frames_written
));
}
throw
FormatRuntimeError
(
"snd_pcm_writei() failed: %s"
,
snd_strerror
(
-
frames_written
));
/* need to call CopyRingToPeriodBuffer() and
WriteFromPeriodBuffer() again in the next
iteration, so don't finish the drain just
yet */
return
false
;
}
/* need to call CopyRingToPeriodBuffer() and
WriteFromPeriodBuffer() again in the next
iteration, so don't finish the drain just yet */
return
false
;
}
if
(
!
written
)
...
...
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