We are really interested in the error code of the statements we queued
before the sync so clear any previous error first. Otherwise we might
pick up a previous random error, which never gets cleared.
See #1714
Keep a counter for the amount of times pw_init() was called and
only clear everything when pw_deinit() was called an equal amount of
times.
Also ensure that pw_init() can be called again after pw_deinit().
Fixes#2238
Library code generally shouldn't modify global state, so pw_init()
should not result to changing the C locale.
Instead, set the C locale in main() for tools and daemons.
We'll still setlocale for LC_MESSAGES, to get translated UI elements in
wireplumber. This workaround should be removed eventually...
This mode allows using a json file generated by pw-dump as input,
in order to visualize it.
Example usage:
pw-dump > dump.json
pw-dot -j dump.json -sL
This enables developers to easily visualize user dumps and at liberty switch
visualization modes (all, smart, detail, etc) without requiring the user
to do anything except for generating the initial dump.
And use this in spa_json_format_float() where we also avoid invalid
json floats.
Use json float format in some places where we serialize json floats.
Add a unit test.
See #2223
After dequeueing the buffer, the code immediately checks if it is NULL,
and never modifies the variable. Therefore there is no need to check
again when the buffer is enqueued.
Add a property to select the upmix method. PSD is enabled by default
but a new simple upmixing algorithm is available that duplicates
channels and avoids lowpass filter on the FC and disables widening.
Fixes#861
meson automatically generates a .gitignore file that ignores
everything in the build directory when it is configured.
There is no need to explicitly add build directories
to the top-level .gitignore.
Remove quantum limitation from a2dp-sink, and adjust how flushing is
done.
The "low-latency" A2DP codecs are not able to flush all data at once, so
for them flush based on a timeout, such that "excess samples" for each
quantum is bounded. We also limit excess samples for the other A2DP
codecs, based on some testing on flaky headset/adapter combinations (for
most cases, this does not appear to matter).
Leave decision of packet sizes to the codecs. Currently, we send packets
based on min_latency, but sendinf full packets might help with stutter
on some headset/adapter combinations. The slightly increased latency
hardly matters against the 100ms delays in BT headsets.
Bump codec API version.
If we get an EAGAIN, the device has started lagging in processing its
packets. We should not try to stuff the same packet in again, because
the device will just lag more. Instead, just drop current data, and hope
bitpool reduction takes care of it.
Also increase bitpool only if the socket buffer is empty.
Support setting extra properties on the sink and source with the
sink/source_properties.
Fix construction of the module arguments, the sink/source.props needs to
be inside the object..
Fixes #2201
When a particular AvahiWatch is being dispatched, it cannot
be freed because `watch_callback()` accesses it after
the callback.
Introduce a member (`dispatching`) to coordinate
the deferred freeing in that case.
The timeouts are not affected because the `AvahiTimeout`
object is not accessed after the callback is called.
We alwats want to adapt to the rate of the graph and not the
samplerate that was configured with the PortConfig.
This fixes samplerate switching again.
When we leave the last recursive enter of the loop, clear the polling
flag.
It might be possible that it was not cleared because the loop might have
been killed with pthread_kill. In any case, the _leave calls need to be
made in this case as well.
This fixes issues when jack clients stop because it triggers and assert
because the polling flag is still active when the object is cleared.
See !1171
Use `spa_loop_invoke()` to invoke a callback on the data loop
to remove an embedded `spa_source` from the data loop.
Embedded `spa_source` objects cannot be safely removed
while the loop is polling without risking potential
use-after-frees.
The core of the issue is the following: what happens if an
active source is destroyed before it could be dispatched?
For loop-managed sources (`struct source_impl`) this was addressed
by storing all destroyed sources in a list, and only freeing them
after dispatching has been finished. (0eb73f0f06)
This approach works for both strictly single-threaded
and `pw_thread_loop` loops assuming the loop is not
reentered.
However, if the loop is reentered, there can still be issues.
Assume that in one iteration sources A and B are active,
and returned from the system call, and source B is destroyed
before the loop starts dispatching. Consider what happens when
"A" is dispatched first, and it reenters the loop with timeout 0.
Imagine there are no new events, so `loop_iterate()` will immediately
return, but it will first destroy everything in the destroy list
(this is done at the end of `loop_iterate()`).
And herein lies the problem. In the previous iteration,
there exists a `spa_poll_event` object which points to source "B",
but that has just been destroyed at the end of the recursive
iteration. This will trigger a use-after-free once the previous
iteration inspects it.
Fix that by processing the destroy list right after first
processing the returned `spa_poll_event` objects, and
"detach" the source from the loop and its iterations
in `process_destroy()` before the source is destroyed.
See #2114#2147