Commit graph

139 commits

Author SHA1 Message Date
Wim Taymans
64fc8dda20 stream: check for NULL context
If a stream was killed, the context is cleared. Disconnecting a killed
stream should not crash but return BADSTATE.
2020-06-08 11:58:32 +02:00
Wim Taymans
65798ca566 context: only set TERMINATED when -EPIPE
Other errors don't cause the connection to terminate.
2020-06-08 11:57:51 +02:00
Simon McVittie
e493be3844 scripts: Use special ${LIB} token for architecture-independence
On GNU/Linux systems, the literal string '${LIB}' in dynamic linker
paths expands to "lib", a biarch libQUAL directory such as "lib64", or
a Debian-style multiarch directory such as "lib/x86_64-linux-gnu".
If we're installing libraries to such a directory, and we have both
word-sizes' compatibility libraries available, then pw-pulse can
use LD_LIBRARY_PATH='/usr/${LIB}/pipewire-0.3/pulse' to make both
i386 and x86_64 programs load the correct version.

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-06-05 13:40:50 +00:00
Simon McVittie
96eb6e4df8 scripts: Don't add an empty entry to LD_LIBRARY_PATH
LD_LIBRARY_PATH="/path/to/lib:" is interpreted as equivalent to
LD_LIBRARY_PATH="/path/to/lib:.", loading libraries from the current
working directory, which could lead to malicious libraries being loaded
if the current working directory is untrusted. To avoid this, only add
the current LD_LIBRARY_PATH to the new LD_LIBRARY_PATH if it is
actually set.

This commit also single-quotes the interpolated @VARIABLES@ so that
their values can contain shell special characters (other than single
quotes).

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-06-05 13:40:50 +00:00
Wim Taymans
ee5d6b4451 pulse: add more checks 2020-06-05 12:43:26 +02:00
Martin Koch
2ae621c975 fix warning: passing argument 1 of ‘pa_proplist_iterate’ discards ‘const’ qualifier
in pipewire-pulseaudio/src/proplist.c
	for pulseaudio version < 13.0

Signed-off-by: Martin Koch <martin.koch@ese.de>
2020-06-04 18:11:52 +00:00
Wim Taymans
549431e8f3 pulse: fix leaks 2020-06-04 18:26:36 +02:00
Wim Taymans
c546167ad3 require meson 0.49 2020-05-20 15:26:35 +02:00
Wim Taymans
cab645d155 stream: we can get the index before we are ready 2020-05-12 17:50:24 +02:00
Wim Taymans
a7d8e805ac stream: do some extra checks 2020-05-11 14:16:19 +02:00
Wim Taymans
df8ad59e37 stream: fix writable size when no timing info received
Always report that we can write a buffer, even when we have
not yet received timing info. Fixes stalled spotify.

Fixes #238
2020-05-11 11:30:24 +02:00
Wim Taymans
e6ccc72feb fix compiler warnings 2020-05-08 20:40:02 +02:00
Wim Taymans
4e44da6c4b pulse: hide the pa_proplist implementation
Hide the proplist implementation.
Add some more methods to update the proplist
Make sure our integration functions only use exported symbols
so that they even work against the original pulse implementations
in case they are loaded first.

Fixes #236
2020-05-08 14:17:45 +02:00
Wim Taymans
ed2d6b2cce pulse: only find links to source or sink
Those are the only links we care about in the sink_input or
source_output info.
2020-05-03 18:49:10 +02:00
Wim Taymans
9f810d1bbc add pw-jack and pw-pulse to set the library path
pw-pulse and pw-jack set the replacement library path correctly
so that pulse and jack apps run on top of PipeWire.
2020-04-29 13:28:08 +02:00
Wim Taymans
293386c21a install replacement libraries in modules directory
Don't use a special name for the replacement libraries but install
them into the modules directory by default. Add an option to install
them into another location.

This way, we don't need to set up symlinks in development, distros can
choose to install them where they want and/or we can use symlinks or
LD_LIBRARY path to select the replacement versions.
2020-04-29 11:24:24 +02:00
Wim Taymans
9c1ac4e850 pulse: implement cork now 2020-04-28 12:18:57 +02:00
Wim Taymans
aafd1e7298 improve debug
Improve log so that debug level 3 gives a reasonably readable overview
of what is going on.
2020-04-22 12:47:18 +02:00
Wim Taymans
dfd1adf816 stream: always request one block
Don't request too many bytes in one go but one block at a time.
This slowly fills up the queue.
2020-04-15 17:21:42 +02:00
Wim Taymans
262d0ee7d2 pulse: count queued bytes 2020-04-15 17:11:49 +02:00
Wim Taymans
bf95887a02 pulse: improve timing
Make writable size more accurate by using the clock. mplayer uses this
to check if the clock is advancing.
Remove requested_bytes, we can use ready_bytes for the ready bytes
and use the queued bytes for playback.
Reset after a flush, wait for a new timing update.
2020-04-15 16:19:42 +02:00
Wim Taymans
30fac2b242 stream: improve timing
Dequeue the input buffers so that we can calculate the available
bytes to read.
2020-04-14 16:50:29 +02:00
Wim Taymans
d9a18742f4 pulse: guard against invalid fds
Some fds can't be added to epoll (stdin/stdout) and will cause an
error. Make sure we don't try to free the NULL event.
Add some more debug
2020-04-14 15:40:21 +02:00
Wim Taymans
6d24a034fb stream: improve timing
Improve the delay, make sure we don't overflow
Flush and free pending memory
Keep track of requested_bytes
2020-04-14 10:22:34 +02:00
Wim Taymans
4fd43733c2 pulse: more work on timings
The read_index should not include the delay to the device.
Keep a separate lis of memory blocks filled by the app and give
those to the stream when we can. This is because pulse can allocate
an infinite amount of buffers but we must cycle between a fixed
number. Use DYNAMIC_DATA to avoid memcpy.
Use the right requested_bytes in the write_callback. This should
be the tlength - the amount of bytes we already queued.
_get_time() should include the sink latency.
2020-04-13 19:44:12 +02:00
Wim Taymans
b01c264c5c pulse: improve timing
Keep track of written bytes and use this to calculate the latency.
2020-04-12 20:47:33 +02:00
Wim Taymans
7febf7ea25 improve debug 2020-04-06 18:01:19 +02:00
Wim Taymans
a5b0553328 Fix some -Wenum-conversion errors
Make pw_direction and spa_direction the same
Explicitly cast some enums or use the right enums
2020-04-04 20:03:08 +02:00
Wim Taymans
c8f435ec41 pulse: also disconnect when we unlink the context 2020-04-02 15:31:20 +02:00
Wim Taymans
f51ba55dae pulse: avoid emiting the NEW event too soon
Let the NEW event be emited when all params are updated.
2020-04-02 15:30:15 +02:00
Wim Taymans
4346cad322 pulse: improve debug of events 2020-04-02 15:28:24 +02:00
Wim Taymans
8fe83dcd02 pulse: make sure we never set latency num to 0 2020-03-18 11:40:25 +01:00
Wim Taymans
091b420b0b stream: don't call suspended callback when disconnecting 2020-03-06 18:57:13 +01:00
Wim Taymans
c4b2be2aad use true and false for boolean properties
So that it's easier to convert them to booleans in introspection
code later.
2020-03-03 18:17:46 +01:00
Wim Taymans
0b4d3aee46 pulse: add some return_*if_fail 2020-02-25 14:28:01 +01:00
Jan Koester
1facf8ed48 added simple api to pipewire pulseaudio wrapper 2020-02-20 13:38:59 +01:00
Wim Taymans
3f4be40f30 pulse: only define PA_LIKELY when not already defined
New pulse makes this define visible.
2020-02-12 08:55:24 +01:00
Wim Taymans
1a6848801f fix compiler warnings 2020-02-11 15:25:53 +01:00
Wim Taymans
272fd4bd9f pulse: improve pa_operation compatibility
Methods that return a pa_operation should not return NULL.

pa_context_success_cb_t should return 1 on success and 0 on failure
with the error set in the context.

When a global is not found, let the info operation return eol = -1
with the error set in the context.
2020-02-03 16:44:50 +01:00
Wim Taymans
0237296400 stream: don't set inactive on cork
We don't pause our clock ticks in the corked state which confuses
the timing code. As a workaround for now, don't set the node to
inactive when corked, this still keeps calling into the process
function and keep things moving. VLC seems to recover better.
2020-01-17 15:34:31 +01:00
Wim Taymans
ded3a2a58f append -pw and version to .so libraries
So that we can place them next to the real ones and use a symlink
to switch.
2020-01-16 12:57:25 +01:00
Wim Taymans
1f03d26e53 install the jack and pulseaudio libraries 2020-01-15 17:01:48 +01:00
Wim Taymans
043e7f24fe add some more useful defines
Add define to match all ids for nodes and params.
Add define for invalid permissions
2020-01-15 11:15:51 +01:00
Wim Taymans
3dbcc7808c pulse: don't use endpoints
Revert back to using nodes, ports and devices. Let's first get this
stable until we add endpoints in the mix.
2020-01-13 11:44:55 +01:00
Jan Koester
dfdd664160 mainloop: add SPA_EXPORT to pa_mainloop_api_once
Fixes #200
2020-01-08 15:29:37 +01:00
Wim Taymans
f391353c7f Make interface types a string
This is more in line with wayland and it allows us to create new
interfaces in modules without having to add anything to the type
enum. It also removes some lookups to map type_id to readable
name in debug.
2019-12-19 13:36:04 +01:00
Wim Taymans
698ab911c3 loop: pass spa_dict to *_loop_new
Make the thread_loop alloc its own loop by default to simplify
some core. Add extra new_full method to pass a custom pw_loop.
Make other loop implementations ready to support custom loops
if we want that later.
2019-12-13 11:34:25 +01:00
Wim Taymans
9b53c65c72 pw_endpoint_proxy -> pw_endpoint 2019-12-11 16:43:53 +01:00
Wim Taymans
beb3c69dfe pw_node_proxy -> pw_node 2019-12-11 15:26:11 +01:00
Wim Taymans
199fa47216 pw_module_proxy -> pw_module 2019-12-11 15:16:30 +01:00