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
c2bc3704
Commit
c2bc3704
authored
Feb 15, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/pulse: move code to virtual method Drain()
Drain only if it was requested explicitly.
parent
def120ac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
11 deletions
+18
-11
PulseOutputPlugin.cxx
src/output/plugins/PulseOutputPlugin.cxx
+18
-11
No files found.
src/output/plugins/PulseOutputPlugin.cxx
View file @
c2bc3704
...
@@ -111,6 +111,7 @@ public:
...
@@ -111,6 +111,7 @@ public:
[[
nodiscard
]]
std
::
chrono
::
steady_clock
::
duration
Delay
()
const
noexcept
override
;
[[
nodiscard
]]
std
::
chrono
::
steady_clock
::
duration
Delay
()
const
noexcept
override
;
size_t
Play
(
const
void
*
chunk
,
size_t
size
)
override
;
size_t
Play
(
const
void
*
chunk
,
size_t
size
)
override
;
void
Drain
()
override
;
void
Cancel
()
noexcept
override
;
void
Cancel
()
noexcept
override
;
bool
Pause
()
override
;
bool
Pause
()
override
;
...
@@ -696,17 +697,6 @@ PulseOutput::Close() noexcept
...
@@ -696,17 +697,6 @@ PulseOutput::Close() noexcept
Pulse
::
LockGuard
lock
(
mainloop
);
Pulse
::
LockGuard
lock
(
mainloop
);
if
(
pa_stream_get_state
(
stream
)
==
PA_STREAM_READY
)
{
pa_operation
*
o
=
pa_stream_drain
(
stream
,
pulse_output_stream_success_cb
,
this
);
if
(
o
==
nullptr
)
{
LogPulseError
(
context
,
"pa_stream_drain() has failed"
);
}
else
pulse_wait_for_operation
(
mainloop
,
o
);
}
DeleteStream
();
DeleteStream
();
if
(
context
!=
nullptr
&&
if
(
context
!=
nullptr
&&
...
@@ -836,6 +826,23 @@ PulseOutput::Play(const void *chunk, size_t size)
...
@@ -836,6 +826,23 @@ PulseOutput::Play(const void *chunk, size_t size)
}
}
void
void
PulseOutput
::
Drain
()
{
Pulse
::
LockGuard
lock
(
mainloop
);
if
(
pa_stream_get_state
(
stream
)
!=
PA_STREAM_READY
)
return
;
pa_operation
*
o
=
pa_stream_drain
(
stream
,
pulse_output_stream_success_cb
,
this
);
if
(
o
==
nullptr
)
throw
MakePulseError
(
context
,
"pa_stream_drain() failed"
);
pulse_wait_for_operation
(
mainloop
,
o
);
}
void
PulseOutput
::
Cancel
()
noexcept
PulseOutput
::
Cancel
()
noexcept
{
{
assert
(
mainloop
!=
nullptr
);
assert
(
mainloop
!=
nullptr
);
...
...
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