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
bf1d77a4
Commit
bf1d77a4
authored
Oct 23, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/alsa: un-inline several methods
parent
a9344faf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
32 deletions
+40
-32
AlsaOutputPlugin.cxx
src/output/plugins/AlsaOutputPlugin.cxx
+40
-32
No files found.
src/output/plugins/AlsaOutputPlugin.cxx
View file @
bf1d77a4
...
...
@@ -344,39 +344,9 @@ private:
/**
* @return false if no data was moved
*/
bool
CopyRingToPeriodBuffer
()
noexcept
{
if
(
period_buffer
.
IsFull
())
return
false
;
size_t
nbytes
=
ring_buffer
->
pop
(
period_buffer
.
GetTail
(),
period_buffer
.
GetSpaceBytes
());
if
(
nbytes
==
0
)
return
false
;
period_buffer
.
AppendBytes
(
nbytes
);
const
std
::
lock_guard
<
Mutex
>
lock
(
mutex
);
/* notify the OutputThread that there is now
room in ring_buffer */
cond
.
notify_one
();
return
true
;
}
snd_pcm_sframes_t
WriteFromPeriodBuffer
()
noexcept
{
assert
(
period_buffer
.
IsFull
());
assert
(
period_buffer
.
GetFrames
(
out_frame_size
)
>
0
);
auto
frames_written
=
snd_pcm_writei
(
pcm
,
period_buffer
.
GetHead
(),
period_buffer
.
GetFrames
(
out_frame_size
));
if
(
frames_written
>
0
)
{
written
=
true
;
period_buffer
.
ConsumeFrames
(
frames_written
,
out_frame_size
);
}
bool
CopyRingToPeriodBuffer
()
noexcept
;
return
frames_written
;
}
snd_pcm_sframes_t
WriteFromPeriodBuffer
()
noexcept
;
void
LockCaughtError
()
noexcept
{
period_buffer
.
Clear
();
...
...
@@ -833,6 +803,44 @@ AlsaOutput::Recover(int err) noexcept
return
err
;
}
bool
AlsaOutput
::
CopyRingToPeriodBuffer
()
noexcept
{
if
(
period_buffer
.
IsFull
())
return
false
;
size_t
nbytes
=
ring_buffer
->
pop
(
period_buffer
.
GetTail
(),
period_buffer
.
GetSpaceBytes
());
if
(
nbytes
==
0
)
return
false
;
period_buffer
.
AppendBytes
(
nbytes
);
const
std
::
lock_guard
<
Mutex
>
lock
(
mutex
);
/* notify the OutputThread that there is now
room in ring_buffer */
cond
.
notify_one
();
return
true
;
}
snd_pcm_sframes_t
AlsaOutput
::
WriteFromPeriodBuffer
()
noexcept
{
assert
(
period_buffer
.
IsFull
());
assert
(
period_buffer
.
GetFrames
(
out_frame_size
)
>
0
);
auto
frames_written
=
snd_pcm_writei
(
pcm
,
period_buffer
.
GetHead
(),
period_buffer
.
GetFrames
(
out_frame_size
));
if
(
frames_written
>
0
)
{
written
=
true
;
period_buffer
.
ConsumeFrames
(
frames_written
,
out_frame_size
);
}
return
frames_written
;
}
inline
bool
AlsaOutput
::
DrainInternal
()
{
...
...
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