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
8a045207
Commit
8a045207
authored
Mar 10, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/wasapi: add field `paused`
Fixes bogus Delay() results at the start of playback, because Delay() thinks the output is paused.
parent
fe7c5a42
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
WasapiOutputPlugin.cxx
src/output/plugins/wasapi/WasapiOutputPlugin.cxx
+11
-1
No files found.
src/output/plugins/wasapi/WasapiOutputPlugin.cxx
View file @
8a045207
...
@@ -239,6 +239,11 @@ class WasapiOutput final : public AudioOutput {
...
@@ -239,6 +239,11 @@ class WasapiOutput final : public AudioOutput {
*/
*/
bool
is_started
;
bool
is_started
;
/**
* Only valid if the output is open.
*/
bool
paused
;
std
::
atomic_flag
not_interrupted
=
true
;
std
::
atomic_flag
not_interrupted
=
true
;
const
std
::
string
device_config
;
const
std
::
string
device_config
;
...
@@ -276,6 +281,7 @@ public:
...
@@ -276,6 +281,7 @@ public:
}
}
void
Open
(
AudioFormat
&
audio_format
)
override
{
void
Open
(
AudioFormat
&
audio_format
)
override
{
com_worker
->
Async
([
&
]()
{
DoOpen
(
audio_format
);
}).
get
();
com_worker
->
Async
([
&
]()
{
DoOpen
(
audio_format
);
}).
get
();
paused
=
false
;
}
}
void
Close
()
noexcept
override
;
void
Close
()
noexcept
override
;
std
::
chrono
::
steady_clock
::
duration
Delay
()
const
noexcept
override
;
std
::
chrono
::
steady_clock
::
duration
Delay
()
const
noexcept
override
;
...
@@ -589,6 +595,7 @@ WasapiOutput::DoOpen(AudioFormat &audio_format)
...
@@ -589,6 +595,7 @@ WasapiOutput::DoOpen(AudioFormat &audio_format)
buffer_size_in_frames
,
is_exclusive
);
buffer_size_in_frames
,
is_exclusive
);
is_started
=
false
;
is_started
=
false
;
paused
=
false
;
}
}
void
void
...
@@ -613,7 +620,7 @@ WasapiOutput::Close() noexcept
...
@@ -613,7 +620,7 @@ WasapiOutput::Close() noexcept
std
::
chrono
::
steady_clock
::
duration
std
::
chrono
::
steady_clock
::
duration
WasapiOutput
::
Delay
()
const
noexcept
WasapiOutput
::
Delay
()
const
noexcept
{
{
if
(
!
is_start
ed
)
{
if
(
paus
ed
)
{
// idle while paused
// idle while paused
return
std
::
chrono
::
seconds
(
1
);
return
std
::
chrono
::
seconds
(
1
);
}
}
...
@@ -626,6 +633,8 @@ WasapiOutput::Play(const void *chunk, size_t size)
...
@@ -626,6 +633,8 @@ WasapiOutput::Play(const void *chunk, size_t size)
{
{
assert
(
thread
);
assert
(
thread
);
paused
=
false
;
not_interrupted
.
test_and_set
();
not_interrupted
.
test_and_set
();
ConstBuffer
<
void
>
input
(
chunk
,
size
);
ConstBuffer
<
void
>
input
(
chunk
,
size
);
...
@@ -665,6 +674,7 @@ WasapiOutput::Play(const void *chunk, size_t size)
...
@@ -665,6 +674,7 @@ WasapiOutput::Play(const void *chunk, size_t size)
bool
bool
WasapiOutput
::
Pause
()
WasapiOutput
::
Pause
()
{
{
paused
=
true
;
if
(
is_started
)
{
if
(
is_started
)
{
thread
->
Pause
();
thread
->
Pause
();
is_started
=
false
;
is_started
=
false
;
...
...
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