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
f447b761
Commit
f447b761
authored
Oct 20, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/pipewire: check pw_stream_connect() errors
parent
1f780b72
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
8 deletions
+105
-8
Error.cxx
src/lib/pipewire/Error.cxx
+34
-0
Error.hxx
src/lib/pipewire/Error.hxx
+45
-0
meson.build
src/lib/pipewire/meson.build
+14
-0
PipeWireOutputPlugin.cxx
src/output/plugins/PipeWireOutputPlugin.cxx
+12
-8
No files found.
src/lib/pipewire/Error.cxx
0 → 100644
View file @
f447b761
/*
* Copyright 2003-2021 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "Error.hxx"
#include <spa/utils/result.h>
namespace
PipeWire
{
ErrorCategory
error_category
;
std
::
string
ErrorCategory
::
message
(
int
condition
)
const
{
return
spa_strerror
(
condition
);
}
}
// namespace Avahi
src/lib/pipewire/Error.hxx
0 → 100644
View file @
f447b761
/*
* Copyright 2003-2021 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
#include <system_error>
struct
AvahiClient
;
namespace
PipeWire
{
class
ErrorCategory
final
:
public
std
::
error_category
{
public
:
const
char
*
name
()
const
noexcept
override
{
return
"pipewire"
;
}
std
::
string
message
(
int
condition
)
const
override
;
};
extern
ErrorCategory
error_category
;
inline
std
::
system_error
MakeError
(
int
error
,
const
char
*
msg
)
noexcept
{
return
std
::
system_error
(
error
,
error_category
,
msg
);
}
}
// namespace PipeWire
src/lib/pipewire/meson.build
View file @
f447b761
...
...
@@ -12,3 +12,17 @@ pipewire_dep = declare_dependency(
# disable it at the command line
compile_args: ['-Wno-pedantic'],
)
pipewire = static_library(
'pipewire',
'Error.cxx',
include_directories: inc,
dependencies: [
pipewire_dep,
],
)
pipewire_dep = declare_dependency(
link_with: pipewire,
dependencies: pipewire_dep,
)
src/output/plugins/PipeWireOutputPlugin.cxx
View file @
f447b761
...
...
@@ -18,6 +18,7 @@
*/
#include "PipeWireOutputPlugin.hxx"
#include "lib/pipewire/Error.hxx"
#include "lib/pipewire/ThreadLoop.hxx"
#include "../OutputAPI.hxx"
#include "../Error.hxx"
...
...
@@ -488,14 +489,17 @@ PipeWireOutput::Open(AudioFormat &audio_format)
params
[
0
]
=
spa_format_audio_raw_build
(
&
pod_builder
,
SPA_PARAM_EnumFormat
,
&
raw
);
pw_stream_connect
(
stream
,
PW_DIRECTION_OUTPUT
,
target_id
,
(
enum
pw_stream_flags
)(
PW_STREAM_FLAG_AUTOCONNECT
|
PW_STREAM_FLAG_INACTIVE
|
PW_STREAM_FLAG_MAP_BUFFERS
|
PW_STREAM_FLAG_RT_PROCESS
),
params
,
1
);
int
error
=
pw_stream_connect
(
stream
,
PW_DIRECTION_OUTPUT
,
target_id
,
(
enum
pw_stream_flags
)(
PW_STREAM_FLAG_AUTOCONNECT
|
PW_STREAM_FLAG_INACTIVE
|
PW_STREAM_FLAG_MAP_BUFFERS
|
PW_STREAM_FLAG_RT_PROCESS
),
params
,
1
);
if
(
error
<
0
)
throw
PipeWire
::
MakeError
(
error
,
"Failed to connect stream"
);
}
void
...
...
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