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
6e7f8662
Commit
6e7f8662
authored
Sep 21, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/alsa: migrate from DeferredMonitor to DeferEvent
parent
6fa403ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
14 deletions
+13
-14
AlsaInputPlugin.cxx
src/input/plugins/AlsaInputPlugin.cxx
+13
-14
No files found.
src/input/plugins/AlsaInputPlugin.cxx
View file @
6e7f8662
...
...
@@ -38,7 +38,7 @@
#include "Log.hxx"
#include "event/MultiSocketMonitor.hxx"
#include "event/Defer
redMonitor
.hxx"
#include "event/Defer
Event
.hxx"
#include <alsa/asoundlib.h>
...
...
@@ -59,7 +59,7 @@ static constexpr size_t ALSA_RESUME_AT = ALSA_MAX_BUFFERED / 2;
class
AlsaInputStream
final
:
public
AsyncInputStream
,
MultiSocketMonitor
,
DeferredMonitor
{
MultiSocketMonitor
{
/**
* The configured name of the ALSA device.
...
...
@@ -71,18 +71,21 @@ class AlsaInputStream final
ReusableArray
<
pollfd
>
pfd_buffer
;
DeferEvent
defer_invalidate_sockets
;
public
:
AlsaInputStream
(
EventLoop
&
loop
,
AlsaInputStream
(
EventLoop
&
_
loop
,
const
char
*
_uri
,
Mutex
&
_mutex
,
Cond
&
_cond
,
const
char
*
_device
,
snd_pcm_t
*
_handle
,
int
_frame_size
)
:
AsyncInputStream
(
loop
,
_uri
,
_mutex
,
_cond
,
:
AsyncInputStream
(
_
loop
,
_uri
,
_mutex
,
_cond
,
ALSA_MAX_BUFFERED
,
ALSA_RESUME_AT
),
MultiSocketMonitor
(
loop
),
DeferredMonitor
(
loop
),
MultiSocketMonitor
(
_loop
),
device
(
_device
),
capture_handle
(
_handle
),
frame_size
(
_frame_size
)
frame_size
(
_frame_size
),
defer_invalidate_sockets
(
_loop
,
BIND_THIS_METHOD
(
InvalidateSockets
))
{
assert
(
_uri
!=
nullptr
);
assert
(
_handle
!=
nullptr
);
...
...
@@ -95,13 +98,13 @@ public:
snd_pcm_start
(
capture_handle
);
DeferredMonitor
::
Schedule
();
defer_invalidate_sockets
.
Schedule
();
}
~
AlsaInputStream
()
{
BlockingCall
(
MultiSocketMonitor
::
GetEventLoop
(),
[
this
](){
MultiSocketMonitor
::
Reset
();
DeferredMonitor
::
Cancel
();
defer_invalidate_sockets
.
Cancel
();
});
snd_pcm_close
(
capture_handle
);
...
...
@@ -135,11 +138,7 @@ private:
int
Recover
(
int
err
);
void
SafeInvalidateSockets
()
{
DeferredMonitor
::
Schedule
();
}
virtual
void
RunDeferred
()
override
{
InvalidateSockets
();
defer_invalidate_sockets
.
Schedule
();
}
virtual
std
::
chrono
::
steady_clock
::
duration
PrepareSockets
()
override
;
...
...
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