Commit graph

3815 commits

Author SHA1 Message Date
Wim Taymans
730c85e5b0 metadata: fix order of type/value 2020-04-27 12:54:14 +02:00
Wim Taymans
90e1eb1b22 jack: add more metadata keys 2020-04-27 12:22:32 +02:00
Wim Taymans
93211549a4 log: add option to disable line numbers 2020-04-27 11:18:49 +02:00
Wim Taymans
b69bdc1eff context: improve graph states
Keep the first active node as the fallback node. We use this node
as the target when no oher active nodes exist.

Only assign the target node to active nodes.

When we assign an unassigned node, simply update the active followers
of the target, the state of the nodes and target itself will then
be taken care of later.

When registering nodes, only active nodes can influence the state of the
graph.

Update some comments
2020-04-27 11:16:14 +02:00
Wim Taymans
7f271ef982 system: don't use _GNU_SOURCE in public header
Use a forward declaration instead for itimerspec.

Fixes #230
2020-04-24 13:11:32 +02:00
Wim Taymans
03027153e2 system: define _GNU_SOURCE for itimerspec
Fixes #230
2020-04-24 12:54:08 +02:00
Wim Taymans
d024229166 node: improve debug 2020-04-24 11:51:42 +02:00
Wim Taymans
667c08ecc4 context: improve graph recalc
Add reason to why we recalculate the graph for debugging purposes
Only recalculate graph when something relevant changed.
Block recalc from being called recursively.
2020-04-24 11:27:00 +02:00
Wim Taymans
39c2d5b963 gst: remove internal queue
Remove the extra queue and use the queue from pw_stream.
Fix some locks and the bufferpool handling to make audio playback
work.
2020-04-23 15:56:12 +02:00
Wim Taymans
7b13ba202b node: also IDLE when not active
Inactive nodes can be set to IDLE
2020-04-23 13:22:38 +02:00
Wim Taymans
972b843851 node: don't suspend when already suspended 2020-04-23 13:10:02 +02:00
Wim Taymans
5d12929153 gst: use the pw_stream queue
There is no need to keep a separate queue in the source, simply use
the one from pw_stream.
2020-04-23 13:01:03 +02:00
Wim Taymans
26fa35a0e7 gst: always use the clock time
Also use the clock time when the stream is not yet started.
2020-04-23 12:38:05 +02:00
Wim Taymans
4cb2d58e89 factory: do more version checks
So that we don't accidentally load an old plugin.
2020-04-22 18:10:26 +02:00
Wim Taymans
539be881ba plugin: increment version and avoid inspecting old versions
There are incompatible version 0 plugins around (the compat ones)
that crash spa-inspect. Increment the version number to avoid this.
2020-04-22 17:52:54 +02:00
Wim Taymans
2c76ec5193 context: simplify state changes
Keep track of when a link is prepared, this is when the link has
successfully negotiated a format and buffers.

Only follow prepared links when collecting nodes in the graph.

Set the state of the driver and its nodes based on how many active
nodes the driver has. We don't have to do state changes on the nodes
from the link anymore then and we can get rid of the counters.

Only set the io on the mixer ports when prepared because we might
need a special mixer element based on the format.

Remove passive links for now.

This fixes many cases where the graph would stall when linking/unlinking
ports in various combinations.

Fixes #221
2020-04-22 17:09:42 +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
8ab67c5fa0 mem: implement remove_id
Rename (the non-exported symbol) _unref_id -> _remove_id and make it
remove the id from the map of known ids. This way, the server can send
the remove_mem and reuse the id for new memory before all references
are gone. Fixes "invalid mem id X, expected Y" errors.
2020-04-22 11:30:53 +02:00
Wim Taymans
d68e7ed58a tools: handle connection error 2020-04-22 11:28:32 +02:00
Wim Taymans
2e06d0819b jack: only do transport when there is a driver 2020-04-21 16:15:45 +02:00
Wim Taymans
b17ff6e2ad core: send an error when receiving invalid mem
And also print the client error when we get it.
2020-04-21 15:57:38 +02:00
Wim Taymans
ee5c3349a0 client-node: don't try to clear port when destroyed
When the client destroyed a port, don't try to clear the
buffers because the client should have done that already.
2020-04-21 15:54:51 +02:00
Wim Taymans
90054f5f3e jack: clear buffers when freeing the mixer 2020-04-21 15:53:43 +02:00
Wim Taymans
48036f7d13 improve debug 2020-04-21 15:51:55 +02:00
Wim Taymans
539296069d jack: implement more metadata API
Rework the metadata implementation without pw_properties to make
it easier to delete all subjects and implement the metadata API.
Remove metadata from all objects when they are destroyed.
2020-04-20 15:19:06 +02:00
Wim Taymans
16ca53e592 jack: implement get_property 2020-04-20 11:51:20 +02:00
Wim Taymans
0b68d65ebf metadata: trigger emission of properties
When the resource does add_listener, send a message to the proxy
to trigger an emission of properties.
Block the client until all properties have been notified, track
this with a ping event to the implementation.
2020-04-20 11:51:20 +02:00
Gleb Popov
209a5e101c Add Cirrus CI config file for FreeBSD. 2020-04-19 15:34:59 +04: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
e73431d541 resample: use right define to compile sse functions
See #220
2020-04-14 20:29:27 +02:00
Wim Taymans
b09caaadc0 midifile: make it possible to specify output file 2020-04-14 20:12:23 +02:00
Wim Taymans
84b048507b midifile: remove impossible case. 2020-04-14 20:11:51 +02:00
Wim Taymans
d1beeeade0 loop: handle file fd with eventfd
epoll return EPERM for file fds like stdin/stdout because they are
always ready for IO. use an idle source to handle these cases.
2020-04-14 18:05:45 +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
1d0ce27005 stream: remove useless size on input streams
Setting the size on input stream buffers based on the elapsed
ticks does not give a meaningfull value for the queue size so
just leave it to the user to set the size field.
2020-04-14 15:42:25 +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
Michael Tretter
fd00d16361 gst: add properties for limits of negotiated buffers
By default, the pipewiresrc tries to negotiate 16 buffers. This value is
hard coded in the pipewiresrc. If the buffers are large, this could lead
to an undesirably high memory usage. Applications that know about the
buffer size and that fewer buffers are sufficient should be able to
configure the limits for the number of buffers that are negotiated.

Therefore, add the min-buffers and max-buffers properties to the
pipewiresrc to enable applications to configure limits for the number of
negotiated buffers.
2020-04-13 07:42:35 +00: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
c446dfb1d6 resample: improve debug 2020-04-12 20:46:59 +02:00
Wim Taymans
bfefd76055 stream: only call process when we have a dequeued buffer 2020-04-12 20:46:14 +02:00
Wim Taymans
2bb2e50eef audioadapter: stop when the follower needs data 2020-04-12 20:44:56 +02:00
Wim Taymans
c1f3593ef0 audioadapter: small cleanup 2020-04-12 20:44:19 +02:00
Wim Taymans
b18dacde9a spa: improve draining
Make a new DRAINED status.
Place the DRAINED status on an input IO when a stream is out of
buffers and draining.
All nodes that don't have HAVE_DATA on the input io need to copy
it to the output io and return the status. This makes sure the
DRAINED is forwarded and nodes return DRAINED from _process()
DRAINED on the resampler flushes out the last queued samples and then
forwards the DRAINED in the next iteration.
Emit a new drained signal from the context when a node returns
DRAINED. Use this to trigger the drained signal in the stream.
2020-04-07 17:58:43 +02:00
Wim Taymans
029f431418 alsa: implement drain function
Implement a drain function that blocks and waits for the drain to
complete.
2020-04-07 17:48:28 +02:00
Wim Taymans
70f5abfe35 alsa: report error from server when we can 2020-04-07 17:38:39 +02:00
Wim Taymans
fdb5911e86 resample: use a 0 sized buffer to drain 2020-04-06 18:01:38 +02:00