start with a completely filled resampler so that the first
input byte immediately gives an output sample. When then have
n_taps/2 leading (almost) 0 samples.
Also make the passthrough resampler act like the real resampler
by introducing an n_taps/2 delay.
Reorganize some things, let the clients update the segment info
in their own activation, then let the server merge it. This avoids
clients stepping on eachother. When looping through the clients,
copy the segment info when we encounter its owner.
Remove the list of segment owners to the activation. This is better
than in the activation because we can then just keep one list of
owners.
Remove the NONBLOCK flag from the eventfd so that we can do blocking
reads as well.
Just keep a reposition owner in the driver activation. This points
to the node that has the reposition info. This avoid complicated
synchronization to keep multiple nodes from stepping on eachother.
Now they can just prepare the reposition info in their activation and
set themselves as the reposition owner. The last one who succeeds
wins.
After we grab the lockfile we should remove the socket when it
exists so that we can bind again. This should solve startup
problems after a crash, which left the socket around and caused
bind failures.
When the node latency property is changed, trigger a graph recalc
to set the new quantum if needed.
Also update the driver quantum when unassigned nodes are assigned
to a driver.
For very small buffer sizes, don't try to attempt to compensate
for the rate matching because we would come dangerously close to
the read/write pointers and cause dropouts. Instead this latency
should be reported on the ports later.
This makes it easier to keep track of who is responsible for what.
Also remove the valid fields and move them to flags in the segment
info. That way, the owner can update the flags without having to
worry about concurrency.
Keep separate info for the reposition information. We need to do this
to make it possible to seek in other formats than the frame.
Clear out the owner field when the node is destroyed or removed from
the driver.
Place the requested sync and position update flag in the node
activation. This way we can use our existing loop to update the node
sync states and check if the node is ready.
Implement sync timeout, when the client can't start or seek within the
timeout, we start RUNNING anyway and hope the client catches up.
Sync is enabled when clients need time to move to a new location.
It's a bit like GStreamer preroll after a seek. Clients that need
time, increment the sync_total. Whenever a seek is done, the server
waits in the Starting state until the sync_pending is 0 (or timeout
later).
Improve atomic operations
Add an offset to apply to the clock time before we can compare to the
segment values. This way we can keep the segment start independent of the
clock values and we only need to adjust the offset when paused. It's
like the base_time in GStreamer to calculate the running time.
Move fields from the io_position to io_segment. The segment contains
the mapping between raw clock time and stream time in various
formats. We keep an array of pending segments available in the
io_position field so clients can anticipate changes.
Make looping a flag in the segment instead of a state.
Prepare for segment masters. These will be registered clients that
are responsible for updating parts of the extended segment info.
Add namespace to some defines.
Move some things around. Move the duration of the current cycle
to the clock. Also add the estimated next timeout to the clock.
Add a generic media specific counter to the clock.
Clean up the position_bar info. We can do with only a double beat
value and make the signature in floats.
Flesh out the io_position info. This has now the information needed
to convert a raw clock time into a stream time. It basically has
the same kind of features as GStreamer segments such as looping,
variable rate playback etc.. It also contains the state of the
timeline (paused/playing) and it can be used to update the position
and state from clients.
There is also extended information in the position field that
clients can update when they can.
Plugins basically only update the clock info they get (and use
the position info to check if they are slaved or not).
Before each cycle, check if there is a pending position update and
apply it.
Add flag to always assign a node to a driver. This makes sure that
even when the node is not linked to anything, it will still be
scheduled by an active driver. This is needed for JACK support.
clean_convert() removes the internally negotiated formats but
it does not set the format (or buffers) of the externally visible
ports. Therefore, don't clear the buffers_set flags.
Instead, clear the buffers_set flag when we explicitly reconfigure
the ports, when we also clear the format.
Also clear the port buffers when we set a NULL format.
Fixes#178
Makes a device with a source and sink that automatically
proxies all physical ports from jack. Jack then drives our
PipeWire pipeline from its own thread.
Getting SO_PEERSEC on distributions that do not use a LSM by default,
results always in a "protocol error", which is just annoying and not
a real problem for pipewire's operation.