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
78257408
Commit
78257408
authored
Oct 20, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/pipewire: report errors from the "state_changed" callback
parent
f447b761
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
PipeWireOutputPlugin.cxx
src/output/plugins/PipeWireOutputPlugin.cxx
+15
-3
No files found.
src/output/plugins/PipeWireOutputPlugin.cxx
View file @
78257408
...
...
@@ -53,6 +53,7 @@
#include <boost/lockfree/spsc_queue.hpp>
#include <stdexcept>
#include <string>
static
constexpr
Domain
pipewire_output_domain
(
"pipewire_output"
);
...
...
@@ -65,6 +66,8 @@ class PipeWireOutput final : AudioOutput {
struct
pw_thread_loop
*
thread_loop
=
nullptr
;
struct
pw_stream
*
stream
;
std
::
string
error_message
;
std
::
byte
buffer
[
1024
];
struct
spa_pod_builder
pod_builder
;
...
...
@@ -149,8 +152,12 @@ public:
private
:
void
CheckThrowError
()
{
if
(
disconnected
)
throw
std
::
runtime_error
(
"Disconnected from PipeWire"
);
if
(
disconnected
)
{
if
(
error_message
.
empty
())
throw
std
::
runtime_error
(
"Disconnected from PipeWire"
);
else
throw
std
::
runtime_error
(
error_message
);
}
}
void
StateChanged
(
enum
pw_stream_state
state
,
...
...
@@ -426,6 +433,7 @@ ToPipeWireAudioFormat(AudioFormat &audio_format) noexcept
void
PipeWireOutput
::
Open
(
AudioFormat
&
audio_format
)
{
error_message
.
clear
();
disconnected
=
false
;
restore_volume
=
true
;
...
...
@@ -521,8 +529,12 @@ PipeWireOutput::StateChanged(enum pw_stream_state state,
const
bool
was_disconnected
=
disconnected
;
disconnected
=
state
==
PW_STREAM_STATE_ERROR
||
state
==
PW_STREAM_STATE_UNCONNECTED
;
if
(
!
was_disconnected
&&
disconnected
)
if
(
!
was_disconnected
&&
disconnected
)
{
if
(
error
!=
nullptr
)
error_message
=
error
;
pw_thread_loop_signal
(
thread_loop
,
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