Commit graph

2223 commits

Author SHA1 Message Date
Wim Taymans
0da406d304 media-session: make sure we don't read invalid data 2020-10-01 11:32:40 +02:00
Wim Taymans
bc35221210 context: destroy clients first
Destroy clients before trying to remove nodes. If the clients are
still connected they might try to react to the removed nodes.
2020-09-30 12:01:46 +02:00
Wim Taymans
81ca70af9b alsa-monitor: avoid crash in release
Only try to release the device when we have a proxy.

Fixes #310
2020-09-28 18:23:23 +02:00
Wim Taymans
79fbddb838 stream: handle out of buffers port
If the port was out of buffers and we can't recycle a buffer, return
-EPIPE.
2020-09-25 18:24:29 +02:00
Wim Taymans
d2d722efb3 node: add an ASYNC flag
The flag means that the process function might not complete
synchronously.

We can use this knowledge to improve the adapter. In sync mode we
can pull before scheduling the converter. In async mode we need to
schedule the follower after the converter to get the data ready for
the next iteration.

We can also improve the stream when it is operating async to schedule
a process call when a new buffer is ready to be filled.

This reduces a cycle latency from alsa and improves latency in
pulse.
2020-09-25 17:02:54 +02:00
Wim Taymans
9dc1c3b168 stream: improve the input process loop
Only try to reuse a buffer when the io area is not already in
the NEED_DATA state or else we might overwrite a previous buffer
reuse and run out of buffers.
We also always need more input.
2020-09-24 17:15:47 +02:00
Wim Taymans
61523d383a tools: add pw-reserve to reverse and monitor a device 2020-09-23 10:24:06 +02:00
Wim Taymans
f4bf7bc7e6 media-session: don't emit busy when we are acquiring 2020-09-23 10:22:22 +02:00
Wim Taymans
3f844f7b09 media-session: make the same node name as PulseAudio
Fixes #299
2020-09-22 12:59:13 +02:00
Wim Taymans
a4e079e1cb media-session: guard against invalid input
See #304
2020-09-22 12:39:39 +02:00
Wim Taymans
cf2c32f0a9 alsa: rework device reservation
Always try to first reserve the device name and then start the probing
so that we can be sure that the device is not in use.
2020-09-21 15:23:36 +02:00
Wim Taymans
2b8568e14f reserve: don't call busy/available when we are the owner
Also ignore acquired from our other devices.
2020-09-21 14:35:32 +02:00
Wim Taymans
cc470c048b reserve: improve debug 2020-09-21 14:35:08 +02:00
Arun Raghavan
2c8e2f3a36 reserve: Fix check for whether acquire succeeded or not
We only deem success if we successfully became the primary name owner.
2020-09-19 11:02:04 +00:00
Arun Raghavan
272624fe83 alsa-monitor: Don't ignore device reservation failure
We were ignoring the reservation status, which is incorrect as we might
not have succeeded in grabbing the device.
2020-09-19 11:02:04 +00:00
Arun Raghavan
2acfa0ee10 alsa-monitor: Lower our device reservation priority
For now, let's lower our priority in device reservation below that of
PulseAudio (which currently uses a priority of 0), so that it takes
priority while contending for the same device.
2020-09-19 11:02:04 +00:00
Wim Taymans
f777da9feb stream: copy the position before doing the callback
So that the callback can look at the updated queued bytes
2020-09-18 17:55:31 +02:00
Wim Taymans
8ee07c3c66 policy-node: always boost default node priority
Make sure the default node as the highest priority.
Fixes a problem with default nodes not being selected when their
priority happens to be too low (bluetooth devices)
2020-09-17 12:35:33 +02:00
Wim Taymans
e9fd38512e node: improve debug 2020-09-17 10:34:42 +02:00
Wim Taymans
51b6c2cbd7 context: handle the fallback node correctly
A passive node can still be the fallback node. It becomes non-passive
if there is a node assigned to it.
This makes the Dummy node work again in the case of jack clients
that always need to be scheduled.
2020-09-16 18:11:16 +02:00
Wim Taymans
854d019343 pipewire: improve get_prgname() 2020-09-16 12:19:33 +02:00
Wim Taymans
6e77791c8e node: Use the work queue to cancel old operations
Keep track of the last state change and cancel the previous one
if it's still busy.
2020-09-16 10:36:47 +02:00
Wim Taymans
af1cf3d87a work-queue: avoid invalid sequence numbers 2020-09-16 10:36:09 +02:00
Wim Taymans
5821f84c4b work-queue: improve debug 2020-09-16 10:21:45 +02:00
Wim Taymans
e0ce311bc0 impl-node: only complete the last pending state
If we get a complete reply from an old state change, ignore it.
2020-09-15 20:33:30 +02:00
Wim Taymans
b5517cc2fe thread-loop: add some more debug 2020-09-15 18:01:51 +02:00
Wim Taymans
eaa08e209f protocol-native: remove mainloop hook only once 2020-09-15 18:00:08 +02:00
Wim Taymans
1a2e783a6f protocol-native: keep client around while processing
When we process the messages of a client, keep the client around
because some callback might have disconnected and tried to free
us.
2020-09-15 13:54:50 +02:00
Wim Taymans
f07aa6a9fd node: only warn for slow clients
Just use debug level for other clients and warning for the ones
that are still busy.
2020-09-15 08:19:23 +02:00
Wim Taymans
30dfe16c52 media-session: destroy errored links
When a link we create is in error, destroy it.
2020-09-14 20:19:44 +02:00
Wim Taymans
f6bc9113ce gst: stop the thread loop before destroying objects
When we destroy the proxy we should either take the thread lock
or stop the thread loop because the destroy might trigger a reply
to remove the object from another thread. This can cause the
refcounting to become invalid and cause double free.

Fixes #286
2020-09-11 16:39:05 +02:00
Sanchayan Maity
f4a949dc3a examples: media-session: Conform to XDG base directory spec
Currently pipewire-media-session uses ~/.pipewire-media-session for
storing configuration. Use home directory as specified by XDG base
directory specification viz. XDG_CONFIG_HOME and fall back to using
a default of $HOME/.config as per the spec if XDG_CONFIG_HOME is not
set or empty. Also in addition, all cases are now handled the same
and always end up using "%s/.config/pipewire-media-session".

If neither XDG_CONFIG_HOME or HOME are set, fall back to the earlier
approach.

Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/271

Signed-off-by: Sanchayan Maity <sanchayan@asymptotic.io>

Fixes !298
2020-09-09 17:51:30 +02:00
Simon McVittie
a652edce0a Only assert about x86_64 struct sizes if ABI is LP64, not x32
The __x86_64__ macro identifies a CPU family, and is unfortunately not
enough to identify a concrete ABI.

The normal x86_64 ABI that is used by practical Linux distributions is
LP64 (i.e. 32-bit int, and 64-bit long and pointer), and defines
__x86_64__ and __LP64__.

x32 is a niche ILP32 ABI (i.e. 32-bit int, long and pointer) for x86_64
CPUs, which has different struct sizes due to sizeof(long) and
sizeof(void *) being smaller. It defines __x86_64__ and __ILP32__.

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-09-07 15:21:17 +00:00
Wim Taymans
1f6a0635ea data-loop: small cleanup
So that we exit the function via only one path.
2020-09-07 16:15:36 +02:00
Wim Taymans
9abcff8312 stream: Only disconnect once
When a stream is destroyed while disconnecting, don't try to disconnect
again.

Fixes #280
2020-09-07 16:06:20 +02:00
Wim Taymans
089ec424d7 impl: emit error on resource when error
When the state of the object changes to ERROR, emit an error message
on the resources as well. Also pass the error code around for this
purpose.
2020-09-03 14:21:59 +02:00
Wim Taymans
b6e78f5577 improve debug 2020-09-03 11:14:58 +02:00
Wim Taymans
dd0f4c7295 policy-node: only send PortConfig on audio nodes
0.2 version don't handle this correctly.

Possibly fixes #270
2020-09-02 14:25:11 +02:00
George Kiagiadakis
613824ab0b metadata: set bound id on the exporting resource 2020-08-31 15:57:52 +03:00
Wim Taymans
39513fb681 protocol-native: fix error reporting
Don't say that there is no runtime directory set when there is but
the server is not running.
Simplify things by first trying to connect to the user runtime directory
when set and then try the system directory. There is no need to manually
check the existance of the socket, connect wil that that and set the
appropriate error.
2020-08-21 11:15:24 +02:00
Jonas Holmberg
3e7609dcaf protocol: Add system runtime directory for clients
Add /run/pipewire to the list of runtime directories so that clients can
connect to the system service without specifying runtime directory.

If the otherwise chosen directory (e.g. the user home directory) doesn't
contain any socket but /run/pipewire does, the latter will be used.
2020-08-19 17:46:50 +00:00
Jonas Holmberg
5c52670421 systemd: Add system service and socket
Add system service and socket in addition to the user service and
socket. The system service is started as pipewire user and group and
clients need to be in the pipewire group to be able to connect.
2020-08-19 17:46:50 +00:00
Wim Taymans
825fe8ac54 stream: make time increase even when clock changed 2020-08-19 16:00:20 +02:00
Wim Taymans
1e2d5e6837 policy-node: force channel setup of target node
When we are switching to a target node, force a downmix to the
target channel layout if we can. Don't try to upmix for now and
don't try to mix when the dont-mix flag is set.
2020-08-19 11:53:07 +02:00
Wim Taymans
d878843c2b policy-node: keep the original node format 2020-08-19 11:26:51 +02:00
Wim Taymans
35534baf9d remote-node: clear up mix structures when port is removed 2020-08-19 11:23:16 +02:00
Wim Taymans
0c04481ba7 metadata: improve default sink/source
Only check defaults when subject is PW_ID_CORE
Handle NULL keys: remove the defaults
2020-08-18 17:56:05 +02:00
Wim Taymans
3174e8b69e media-session: fix spelling mistake 2020-08-17 19:30:26 +02:00
Emmanuel Gil Peyrot
14fdf07e8f Run codespell on the entire codebase
This tool detects and fixes common English spelling mistakes, with
generally very few mistakes.

Here is the command I used to generate this commit.  There were a few
changes that had to be done manually, and of course adding the ignore
file:
```shell
codespell -I .codespell-ignore -x .codespell-ignore -w
```

I didn’t add it to the CI, but this would be a good place for it.
2020-08-17 17:16:31 +00:00
Wim Taymans
688a1ab082 media-session: add module to restore stream settings 2020-08-17 17:55:20 +02:00