Commit graph

37 commits

Author SHA1 Message Date
Wim Taymans
d560499054 stream: handle NULL context 2020-06-24 12:52:50 +02:00
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
ee5d6b4451 pulse: add more checks 2020-06-05 12:43:26 +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
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
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
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
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
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
Wim Taymans
ecc6b27cd7 rename core_proxy -> core
Rename core_proxy to core and move the introspect and interface
contents to core.h

In an effort to promote the proxy API.
2019-12-11 07:46:59 +01:00
Wim Taymans
d677aeeeca stream: remove our ref to the stream on destroy 2019-12-06 22:18:01 +01:00
Wim Taymans
8a959ea7a1 core_proxy: prepare to rename pw_remote -> pw_core_proxy
The pw_remote object is really a wrapper around the pw_core_proxy.
The events it emits are also available in the core proxy and are
generally awkward to use.

With some clever new pw_core_proxy_* methods and a pw_core_connect
to create the core_proxy, we can convert all code away from pw_remote.

This is a first step in this conversion, using the pw_remote behind
the scenes. It leaks into some places because it really needs to become
its own struct in a next step.
2019-12-06 11:48:40 +01:00
Wim Taymans
2fddfb02bd pulse: map stream index to endpoint 2019-11-29 13:34:09 +01:00
Wim Taymans
b7aa8f5c85 media-session: subscribe to params when needed
Subscribe to params and collect them.
2019-11-29 13:34:08 +01:00
Wim Taymans
8c43ebaf3e pulse: find linked endpoints
Set the stream node object-id as the node.id on the endpoint so that
the pulse api can find the linked endpoint.
2019-11-29 13:34:08 +01:00
Wim Taymans
3f3dfbc67e More session manager work
pulseaudio card is mapped to device
pulseaudio sink/source is mapped to an endpoint
prepare to map streams to card profiles
Add Route param to implement the endpoint routing later (ports)
Create an alsa endpoint for each device
Create one stream for each endpoint (Playback/Capture)

Implement create_link on the endpoint. The idea is to call
create link on the peer endpoint to complete the link. Remove
create_link on the session.

Add stream-monitor to turn pw_stream nodes into endpoints

Add a policy manager that tries to link endpoints

Use enum pw_direction for the endpoint direction. We can use the
media_class to determine if this is a pw_stream or not but it should
not really matter, you can link any output to any input.

Add autoconnect property for endpoints to make the policy connect.
2019-11-29 13:34:07 +01:00
Wim Taymans
edd011605d use endpoint in pulse 2019-11-29 13:34:07 +01:00
Wim Taymans
738603fd04 stream: Align with pw_filter
Remove some of the unused states in pw_stream. The app can know the
state by following the format and buffer events.

Make it possible to be notified of io are updates. This should make it
possible to follow the transport etc.

Make it possible to be notified of any param changes.

Rename finish_format to update_params because that is what it does.
Make this work in the same was as the filter: updating the params
removes all old params of the types and installs the new ones.

Don't get the Props and PropInfo from the node proxy, instead get them
directly from the adapter that we have locally. Update the controls
directly on the adapter instead of going to the server first.
2019-11-21 16:14:50 +01:00
Wim Taymans
8bbfe876a7 Revert "WIP use endpoint in pulse"
This reverts commit 7a4a8d78b9.
2019-11-07 11:45:16 +01:00
Wim Taymans
7a4a8d78b9 WIP use endpoint in pulse 2019-11-06 11:34:14 +01:00
Arun Raghavan
37a72b2531 Merge pipewire-pulseaudio subtree 2019-11-03 15:20:57 +01:00