Ulrich Eckhardt [Sat, 28 May 2016 09:15:49 +0000 (11:15 +0200)]
memblockq-test: Utility function to validate queue invariants
In particular, the relations between base, minreq, tlength, length,
missing, maxlength follow certain rules. On change, these invariants can
be violated, which requires additional code to restore them. Setting one
value can thus cause a cascade of changes. This utility function can
assert those invariants after changing something.
Ulrich Eckhardt [Thu, 19 May 2016 19:32:22 +0000 (21:32 +0200)]
memblockq-test: Utility function to alloc chunks
This eases creating a chunk from a string for writing tests.
Pierre Ossman [Sun, 26 Jun 2016 21:39:11 +0000 (23:39 +0200)]
tests: add test to verify correct minreq behaviour
Fixed up by Ulrich Eckhardt <ulrich.eckhardt@base-42.de>.
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Pierre Ossman [Thu, 19 May 2016 13:26:08 +0000 (15:26 +0200)]
memblockq: move minreq handling in to memblockq
Having it handled in the callers proved to be a poor fit as it
became difficult to handle a shrinking minreq sanely. It could end
up in a state where the request was never sent downstream to the
client.
Tanu Kaskinen [Wed, 20 Jul 2016 20:39:59 +0000 (23:39 +0300)]
launch: explain why .service depends on .socket
The reason for depending on the socket unit is rather unobvious, so
let's add a comment to help people reading the service unit file. Felipe
Sateler explained the rationale well in the commit message of
7cb524a77b89, so I just copied the same text into the comment.
Felipe Sateler [Wed, 20 Jul 2016 13:57:13 +0000 (09:57 -0400)]
launch: make pulseaudio.service properly order and require the socket
This commit fixes two problems:
1. Because there are no implicit dependencies between sockets and services,
the socket, as set up by systemd will race with the socket, as set up
by the pulseaudio daemon. This can cause the pulseaudio.socket unit to
fail (even though the pulseaudio service started just fine), which can
confuse users.
2. While it is possible to use the service without the socket, it is not
clear why it would be desirable. And a user installing pulseaudio and
doing `systemctl --user start pulseaudio` will not get the socket
started, which might be confusing and problematic if the server is to
be restarted later on, as the client autospawn feature might kick in.
Arun Raghavan [Thu, 14 Jul 2016 02:38:35 +0000 (11:38 +0900)]
daemon: Tone down system mode snarkiness
We do support system mode for the cases where it makes sense, so it's
really not sensible to be unconditionally snarky at our users for doing
it.
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Georg Chini [Sun, 5 Jun 2016 19:05:11 +0000 (21:05 +0200)]
loopback: Stop tracking max_request and min_memblockq_length
They are not needed any longer because the regulation is now based on the
difference between current and configured latency.
Georg Chini [Sun, 5 Jun 2016 19:05:10 +0000 (21:05 +0200)]
loopback: Adjust rate based on latency difference
Replace the current latency controller with a modified P-controller. For
better readability separate the controller function. For small latency
differences, the controller forms a classical P-controller while it saturates
at 1% deviation from the base rate for large latency differences.
Georg Chini [Sun, 5 Jun 2016 19:05:09 +0000 (21:05 +0200)]
loopback: Restart timer after 1/3 second
After switching source or sink, call adjust_rates after a third of a second
instead of waiting one full adjust time. This will ensure that latency regulation
starts as soon as possible.
Georg Chini [Sun, 5 Jun 2016 19:05:08 +0000 (21:05 +0200)]
loopback: Move timer restart and snapshots to timer callback
Restaring the timer and obtaining the latency snapshots belong to the timer callback.
To maintain an adjust time as near as possible to the configured value, the timer is
now restarted immediately at the beginning of the timer callback.
Georg Chini [Sun, 5 Jun 2016 19:05:07 +0000 (21:05 +0200)]
loopback: Change memblockq length
The size of the memblockq must be increased to allow for long latencies
at high sample rates.
Georg Chini [Sun, 5 Jun 2016 19:05:06 +0000 (21:05 +0200)]
loopback: Improve latency estimation
To improve the overall latency estimation, the delay between the two snapshots
is taken into account. To minimize the snapshot delay, the order of the snapshots
is reverted. Additionally the latency at the base rate is calculated. It will be
used later as the input to the latency controller.
Georg Chini [Sun, 5 Jun 2016 19:05:05 +0000 (21:05 +0200)]
loopback: Improve latency estimation in snapshots
The delay and render memblockq are using the source and sink sample specs,
so using pa_bytes_to_usec() will produce better estimates of the delays than
using pa_resmpler_result(). Because the delays are considered to be part of
the sink or source latency, they are added to them. source_output_buffer
becomes obsolete.
Georg Chini [Sun, 5 Jun 2016 19:05:04 +0000 (21:05 +0200)]
loopback: Save time stamps during latency snapshots
Saving the time stamps is necessary to account for the delay between the two
latency snapshots. Time stamps will be used in later patches.
Ulrich Eckhardt [Wed, 6 Jul 2016 18:00:54 +0000 (20:00 +0200)]
modargs: Document behaviour on missing arguments
The behaviour is to leave the value unchanged. The idea is to init the value
with a default before the call and not treat a missing value as error. That
way, only parsing errors or validating errors actually return error codes.
Ahmed S. Darwish [Sat, 2 Jul 2016 22:08:06 +0000 (00:08 +0200)]
protocol-native: DRY: Remove pdispatch callbacks declarations
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Tanu Kaskinen [Fri, 23 Oct 2015 10:37:11 +0000 (13:37 +0300)]
alsa: set availability for (some) unavailable profiles
The alsa card hasn't so far set any availability for profiles. That
caused an issue with some HDMI hardware: the sound card has two HDMI
outputs, but only the second of them is actually usable. The
unavailable port is marked as unavailable and the available port is
marked as available, but this information isn't propagated to the
profile availability. Without profile availability information, the
initial profile policy picks the unavailable one, since it has a
higher priority value.
This patch adds simple logic for marking some profiles unavailable:
if the profile only contains unavailable ports, the profile is
unavailable too. This can be improved in the future so that if a
profile contains sinks or sources that only contain unavailable ports,
the profile should be marked as unavailable. Implementing that
requires adding more information about the sinks and sources to
pa_card_profile, however.
BugLink: https://bugzilla.yoctoproject.org/show_bug.cgi?id=8448
Tanu Kaskinen [Fri, 23 Oct 2015 10:50:35 +0000 (13:50 +0300)]
card: remove pa_card_new_data.active_profile
It's not being used any more.
Tanu Kaskinen [Fri, 23 Oct 2015 09:59:53 +0000 (12:59 +0300)]
card: move profile selection after pa_card_new()
I want module-alsa-card to set the availability of unavailable
profiles before the initial card profile gets selected, so that the
selection logic can use correct availability information.
module-alsa-card initializes the jack state after calling
pa_card_new(), however, and the profile selection happens in
pa_card_new(). This patch solves that by moving parts of pa_card_new()
to pa_card_choose_initial_profile() and pa_card_put().
pa_card_choose_initial_profile() applies the profile selection policy,
so module-alsa-card can first call pa_card_new(), then initialize the
jack state, and then call pa_card_choose_initial_profile(). After that
module-alsa-card can still override the profile selection policy, in
case module-alsa-card was loaded with the "profile" argument. Finally,
pa_card_put() finalizes the card creation.
An alternative solution would have been to move the jack
initialization to happen before pa_card_new() and use pa_card_new_data
instead of pa_card in the jack initialization code, but I disliked
that idea (I want to get rid of the "new data" pattern eventually).
The order in which the initial profile policy is applied is reversed
in this patch. Previously the first one to set it won, now the last
one to set it wins. I think this is better, because if you have N
parties that want to set the profile, we avoid checking N times
whether someone else has already set the profile.
Tanu Kaskinen [Tue, 7 Jun 2016 13:51:00 +0000 (16:51 +0300)]
card: don't allow the CARD_NEW hook to fail
There is currently no use for allowing modules to cancel card creation,
and I don't see need for that in the future either. Let's simplify
things by removing the failure handling code.
Tanu Kaskinen [Fri, 23 Oct 2015 09:36:34 +0000 (12:36 +0300)]
alsa, bluetooth: fail if user-requested profile doesn't exist
If we can't fulfill the user request fully, I think we shouldn't
fulfill it at all, to make it clear that the requested operation
didn't succeed.
Ahmed S. Darwish [Thu, 16 Jun 2016 08:27:37 +0000 (10:27 +0200)]
pstream: Add rationale for pa_cmsg_ancil_data_close_fds()
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Arun Raghavan [Tue, 3 May 2016 12:56:51 +0000 (18:26 +0530)]
modargs: Add a mechanism to append modargs
This allows us to parse an extra set of modargs to tack on to an
existing set. Duplicates in the second set are ignored, since this fits
our use best. In the future, this could be extended to support different
merge modes (ignore dupes vs. replace with dupes), but I've left this
out since there isn't a clear need and it would be dead code for now.
Arun Raghavan [Tue, 3 May 2016 12:52:09 +0000 (18:22 +0530)]
alsa: Use pa_device_port->impl_free() for freeing port data
This allows us to clean up ucm port data associated with a port during
port clean up, instead of having to track this separately using a
dynarray.
Arun Raghavan [Tue, 3 May 2016 12:52:08 +0000 (18:22 +0530)]
device-port: Add mechanism to free implementation data
This will be needed if the implementation data stores pointers to
additional data that needs to be freed as well.
Chris Billington [Sat, 23 Jan 2016 01:31:34 +0000 (12:31 +1100)]
sink, source, device-port: renames to distinguish latency offsets
Renamed all variables pertaining to latency offsets of sinks and sources,
calling them "port_latency_offset" or similar instead. All of these variables
refer to latency offsets inherited from ports, rather than being unique to
the sinks or sources themselves.
This change is to pave the way for additional functionality for setting
latency offsets on sources and sinks independenly from the value they inherit
from their port. In order to implement them we first need this rename so that
the two latency offsets can be stored individually and summed when reporting
the total latency of the source or sink.
The renames made are:
pa_sink_set_latency_offset() -> pa_sink_set_port_latency_offset()
pa_source_set_latency_offset() -> pa_source_set_port_latency_offset()
sink->latency_offset -> sink->port_latency_offset
sink->thread_info.latency_offset -> sink->thread_info.port_latency_offset
source->latency_offset -> source->port_latency_offset
source->thread_info.latency_offset -> source->thread_info.port_latency_offset
PA_SINK_MESSAGE_SET_LATENCY_OFFSET -> PA_SINK_MESSAGE_SET_PORT_LATENCY_OFFSET
PA_SOURCE_MESSAGE_SET_LATENCY_OFFSET -> PA_SOURCE_MESSAGE_SET_PORT_LATENCY_OFFSET
Tanu Kaskinen [Thu, 2 Jun 2016 13:00:51 +0000 (16:00 +0300)]
webrtc: improve comment about mic geometry
The first mic channel position is not relevant for the target
direction definition.
Chris Billington [Sat, 23 Jan 2016 01:31:33 +0000 (12:31 +1100)]
source: Fixed bug: pa_source_set_port() did not update the latency_offset.
Unlike pa_sink_set_port(), which calls pa_sink_set_latency_offset() to update
the latency offset of the sink to match that of its newly set port,
pa_source_set_port() did not do so. This patch adds the appropriate call to
pa_source_set_latency_offset() in pa_source_set_port() to fix this.
Arun Raghavan [Wed, 1 Jun 2016 11:48:39 +0000 (17:18 +0530)]
json: Drop refcounting of json objects
We don't actually use the refcounting bits.
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Arun Raghavan [Wed, 1 Jun 2016 11:48:38 +0000 (17:18 +0530)]
json: Add some more negative test cases
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Arun Raghavan [Wed, 1 Jun 2016 11:48:37 +0000 (17:18 +0530)]
json: Add a positive test for nested objects
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Arun Raghavan [Wed, 1 Jun 2016 11:48:36 +0000 (17:18 +0530)]
json: Error out for objects and arrays that are nested too deep
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Arun Raghavan [Wed, 1 Jun 2016 11:48:35 +0000 (17:18 +0530)]
json: Handle error cases while parsing numbers
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Arun Raghavan [Wed, 1 Jun 2016 11:48:34 +0000 (17:18 +0530)]
json: Add overflow checks for integer and float parsing
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Arun Raghavan [Wed, 1 Jun 2016 11:48:33 +0000 (17:18 +0530)]
json: Correctly handle bad strings with missing closing quotes
Also add a test for this case.
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Arun Raghavan [Wed, 1 Jun 2016 11:48:32 +0000 (17:18 +0530)]
format: Drop dependency on json-c
json-c has a symbol clash (json_object_get_type) with json-glib (which
at least a number of our GNOME clients use). This patch moves to our own
JSON parser so that we can avoid this kind of situation altogether.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=95135
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Arun Raghavan [Wed, 1 Jun 2016 11:48:31 +0000 (17:18 +0530)]
pulse: Add a JSON-parsing library
Adding this to be able to drop dependency on json-c.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=95135
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
John Paul Adrian Glaubitz [Mon, 16 May 2016 18:53:13 +0000 (20:53 +0200)]
pulsecore: Fix incorrect architecture mapping on sparc64.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=95432
Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Juho Hämäläinen [Fri, 13 May 2016 14:39:41 +0000 (17:39 +0300)]
pulsecore: Don't allow unreferencing linked object.
Sink(-input) and source(-output) called unlink function when reference
count dropped to zero. This would result in unlink hooks being called
with an object having a reference count of zero, and this is not a
situation we want modules to have to deal with. It is better to just
remove the redundant unlinking code from sink(-input) and
source(-output) and assert on reference count in unlink functions as well.
It is expected that in well behaving code the owner of an object will
always unlink the object before unreferencing.
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Aidan Gauland [Wed, 25 May 2016 10:26:42 +0000 (22:26 +1200)]
qpaeq: Don't set font-size on widgets
Setting the font-size CSS property on a widget overrides the system
font-size, and since qpaeq provides no mechanism for setting the
application's font-size, we should not do this.
This commit also removes the font-size property from commented-out calls to
setStyleSheet() so that if these are ever reinstated, this behaviour is
not reintroduced.
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
KimJeongYeon [Thu, 19 May 2016 02:35:44 +0000 (11:35 +0900)]
ladspa-sink: avoid to configure invalid format
LADSPA allows float format only, but module-ladspa-sink possibly
could be loaded with ***any*** 'format' parameter. Therefore noisy
sound heard. This patch avoids to be configured as invalid format.
Signed-off-by: KimJeongYeon <jeongyeon.kim@samsung.com>
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Ulrich Eckhardt [Mon, 16 May 2016 17:51:05 +0000 (19:51 +0200)]
core-util: Improve pa_replace() behaviour
- Assert that the search string isn't empty.
- Add test.
- Improve documentation.
Ulrich Eckhardt [Mon, 16 May 2016 17:51:04 +0000 (19:51 +0200)]
core-util-test: Add tests
Ulrich Eckhardt [Mon, 16 May 2016 17:51:03 +0000 (19:51 +0200)]
core-util-test: Add boilerplate
Tanu Kaskinen [Wed, 25 May 2016 11:13:42 +0000 (14:13 +0300)]
pstream: fix revoke callback setting
While investigating bug 95352, I noticed that
pa_pstream_set_revoke_callback() and pa_pstream_set_release_callback()
were identical - both set the release callback.
pa_pstream_set_revoke_callback() was obviously broken - it was setting
the wrong callback.
The only place where set_revoke_callback() is called is in
protocol-native.c. The code there looks like this:
pa_pstream_set_revoke_callback(c->pstream, pstream_revoke_callback, c);
pa_pstream_set_release_callback(c->pstream, pstream_release_callback, c);
Since set_release_callback() is called last, the release callback gets
set correctly. The only problem is that the revoke callback stays
unset. What are the consequences of that? The code that calls the
revoke callback looks like this:
if (p->revoke_callback)
p->revoke_callback(p, block_id, p->revoke_callback_userdata);
else
pa_pstream_send_revoke(p, block_id);
So the intended callback is replaced with a pa_pstream_send_revoke()
call. What does the intended callback, that doesn't get called, do?
if (!(q = pa_thread_mq_get()))
pa_pstream_send_revoke(p, block_id);
else
pa_asyncmsgq_post(q->outq, PA_MSGOBJECT(userdata), CONNECTION_MESSAGE_REVOKE, PA_UINT_TO_PTR(block_id), 0, NULL, NULL);
So the native protocol's revoke callback is anyway going to call
pa_pstream_send_revoke() when called from the main thread. If the
revoking is done from an IO thread, an asynchronous message is sent to
the main thread instead, and the message handler will then call
pa_pstream_send_revoke().
In conclusion, the only effect of this bug was that
pa_pstream_send_revoke() was sometimes being called from an IO thread
when it should have been called from the main thread. I don't know if
this caused the crash in bug 95352. Probably not.
Alexander E. Patrakov [Sat, 21 May 2016 21:03:21 +0000 (02:03 +0500)]
alsa: reread configuration when opening new devices
If a card has been hot-plugged after pulseaudio start, alsa-lib still has
old configuration in memory, which doesn't have PCM definitions for the
new card. Thus, this error appears, and the device doesn't work:
I: [pulseaudio] (alsa-lib)confmisc.c: Unable to find definition 'cards.USB-Audio.pcm.front.0:CARD=0'
I: [pulseaudio] (alsa-lib)conf.c: function snd_func_refer returned error: No such file or directory
I: [pulseaudio] (alsa-lib)conf.c: Evaluate error: No such file or directory
I: [pulseaudio] (alsa-lib)pcm.c: Unknown PCM front:0
I: [pulseaudio] alsa-util.c: Error opening PCM device front:0: No such file or directory
The snd_config_update_free_global() function makes alsa-lib forget any
cached configuration and reparse all PCM definitions from scratch next
time it is told to open anything.
The trick has been copied from Phonon.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=54029
Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Arun Raghavan [Mon, 9 May 2016 02:17:19 +0000 (07:47 +0530)]
i18n: Add module-allow-passthrough to POTFILES.in
Arun Raghavan [Sat, 7 May 2016 08:12:34 +0000 (13:42 +0530)]
allow-passthrough: Use pa_module_hook_connect()
Signed-off-by: Arun Raghavan <git@arunraghavan.net>
Guillaume Desmottes [Fri, 18 Mar 2016 14:28:12 +0000 (15:28 +0100)]
allow-passthrough: Add module to allow passthrough streams always go through
For various use-cases a passthrough stream should have priority over all
other streams and get exclusive access to the sink regardless of whether
any other streams are playing.
An example use-case is ensuring Kodi can successfully start video
playback (with passthrough) even if an external notification sound
happened to be playing at the same time.
Signed-off-by: Arun Raghavan <git@arunraghavan.net>
Arun Raghavan [Mon, 25 Apr 2016 12:42:39 +0000 (18:12 +0530)]
client, protocol-native: Use macros for protocol version/flag access
This makes it easier to read and cleaner in general.
Arun Raghavan [Wed, 22 Jun 2016 06:52:04 +0000 (12:22 +0530)]
Update NEWS for 9.0
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Arun Raghavan [Tue, 21 Jun 2016 11:49:39 +0000 (17:19 +0530)]
sink-input,source-output: Fix crasher while setting property
We were missing a case where a property is first set, and then cleared
by setting a NULL value.
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Ahmed S. Darwish [Fri, 17 Jun 2016 19:56:41 +0000 (21:56 +0200)]
pstream: Fix use of uninitialized value: ancillary fd cleanup flag
As reported by valrgrind
==30002== Conditional jump or move depends on uninitialised value(s)
==30002== at 0x5CB883C: pa_cmsg_ancil_data_close_fds (pstream.c:193)
==30002== by 0x5CBB161: do_write (pstream.c:759)
==30002== by 0x5CB8B51: do_pstream_read_write (pstream.c:233)
==30002== by 0x5CB8EE8: io_callback (pstream.c:279)
...
The pa_cmsg_ancil_data structure has two main guards:
'creds_valid', which implies that it holds credentials
information, and 'nfd', which implies it holds file descriptors.
When code paths create a credentials ancillary data structure,
they just set the 'nfd' guard to zero. Typically, the rest of
pa_cmsg_ancil_data fields related to fds are _all_ left
_uninitialized_.
pa_cmsg_ancil_data_close_fds() has broken the above contract:
it accesses the new 'close_fds_on_cleanup' flag, which is related
to file descriptors, without checking the 'nfd == 0' guard first.
Fix this inconsistency.
Reported-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Ahmed S. Darwish [Fri, 17 Jun 2016 19:54:54 +0000 (21:54 +0200)]
shm: Fix use of uninitialized value: segment's shared-memory type
As shown by valgrind
==10615== Conditional jump or move depends on uninitialised value(s)
==10615== at 0x5CC0483: shm_marker_size (shm.c:97)
==10615== by 0x5CC1685: shm_attach (shm.c:381)
==10615== by 0x5CC1990: pa_shm_cleanup (shm.c:453)
==10615== by 0x5CC068E: sharedmem_create (shm.c:150)
...
Solution is to fix the shm_marker_size() signature itself: At
certain code paths like shm_attach(), we don't want to initialize
_any_ field in the passed SHM segment descriptor except after
making sure all error exit conditions have been passed.
Reported-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Arun Raghavan [Sun, 29 May 2016 05:04:36 +0000 (10:34 +0530)]
dbus: Deal with double-counting module-dbus-protocol
We ended up dealing with it once in module init, and once more in the
new module callback. Avoiding it in the second case by name seems to be
the cleanest solution (else, we need to store the module index somewhere
in pa_dbusiface_core, which seems about as bad).
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Tanu Kaskinen [Sat, 28 May 2016 15:54:04 +0000 (18:54 +0300)]
dbus: fix crash on LoadModule()
Commit
ae415b07a07c9fe70714d01c91980edb25d966de ("dbus: Use hooks for
module new and removed events") changed the new module monitoring from
the asynchronous subscription system. Previously handle_load_module()
created the new pa_dbusiface_module object before we got
a notification of the loading of the module, but now we get the
notification already within the pa_module_load() call. That resulted
in a crash, because the module_new_cb() created the
pa_dbusiface_module object before pa_module_load() returned, and then
handle_load_module() would create another pa_dbusiface_module object
for the same module.
This patch removes the pa_dbusiface_module_new() call from
handle_load_module(). module_new_cb() is now responsible for all
pa_dbusiface_module object creations, except the ones that are created
during the initialization of module-dbus-protocol.
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Barun Kumar Singh [Fri, 13 May 2016 10:44:31 +0000 (16:14 +0530)]
resampler: Fix leaking lfe filter on init failure
Fix memory leak in pa_resampler_new() in resampler.c, Deallocating
memory of r->lfe_filter in case of fail.
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Alexander E. Patrakov [Sat, 21 May 2016 17:37:08 +0000 (22:37 +0500)]
Disable LFE remixing by default
The current LFE crossover filter removes low frequencies from the main
channels and puts them into the LFE channel with the wrong amplitude.
It is not known for sure what is the correct relative amplitude (acoustic
measurements are required with real hardware), and changing that might
introduce a new bug, "it clips the LFE channel".
So just disable the feature by default until a better understanding
emerges how it should work. This, essentially, returns the defaults
to their state as of PulseAudio 6.0.
Some more observations:
- Most of available active analog speakers on the market do the
necessary crossover filtering already, and HDMI receivers can be
configured to do that, too, so a crossover filter in PulseAudio is
harmful in these use cases.
- The "laptop with a builtin subwoofer" use case requires manual
configuration anyway because the default crossover frequency (120 Hz) is
wrong for laptop speakers.
- Finally, Windows 10 with a built-in USB audio driver does not synthesize
the LFE channel given a 5.1 card and a stereo audio stream by default.
Hides: https://bugs.freedesktop.org/show_bug.cgi?id=95021
Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Piotr Drąg [Mon, 16 May 2016 11:52:34 +0000 (13:52 +0200)]
i18n: Update Polish translation
Sachin Kumar Chauhan [Fri, 13 May 2016 08:46:16 +0000 (14:16 +0530)]
resampler: Fix a memory leak in pa_resampler_ffmpeg_init()
ffmpeg_data was not freed properly before return due to error.
It is now freed properly.
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=95347
Signed-off-by: Sachin Kumar Chauhan <sachin.kc@samsung.com>
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Arun Raghavan [Thu, 12 May 2016 10:22:10 +0000 (15:52 +0530)]
build-sys: Bump sonames for release
Bumping libpulse' version since PA_RATE_MAX was changed.
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Arun Raghavan [Wed, 11 May 2016 03:50:07 +0000 (09:20 +0530)]
module-filter-apply: Fix stale m-d-m property name in comment
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Arun Raghavan [Mon, 9 May 2016 09:39:57 +0000 (15:09 +0530)]
alsa: Reread and upate jack status when a card is unsuspended
This is needed so we don't keep stale jack availability information
while the card is suspended.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=93259
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Tanu Kaskinen [Wed, 20 Apr 2016 12:35:13 +0000 (15:35 +0300)]
alsa: ignore jack events when the user is inactive
See the big comment in the code for more details.
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=93259
Sachin Kumar Chauhan [Tue, 10 May 2016 06:10:03 +0000 (11:40 +0530)]
module-filter-apply: Fix a memory leak
Dynamic memory allocated to 'module_name' and 'fltr' was being leaked.
Its now freed properly before return.
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=95293
Signed-off-by: Sachin Kumar Chauhan <sachin.kc@samsung.com>
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Arun Raghavan [Fri, 6 May 2016 06:26:00 +0000 (11:56 +0530)]
module-device-manager: Refine logic to ignore filtered streams
Rather than entirely ignore streams for which we have automatically
loaded a filter, this makes module-device-manager only avoid rerouting
such streams within their existing filter hierarchy.
If, for example, m-d-m decided to move a stream which is currently
routed to speakers/mic which we requested echo cancellation for, to a
USB headset, the previous logic would disallow such a move even though
it was legitimate.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=93443
Signed-off-by: Arun Raghavan <git@arunraghavan.net>
Arun Raghavan [Mon, 25 Apr 2016 12:44:04 +0000 (18:14 +0530)]
module-filter-apply: Don't implement policy in module-device-manager
This adds an ignore mechanism to module-device-manager and uses that
from within module-filter-apply, rather than having m-d-m have knowledge
of anything related to m-f-a.
Signed-off-by: Arun Raghavan <git@arunraghavan.net>
Arun Raghavan [Mon, 25 Apr 2016 11:21:53 +0000 (16:51 +0530)]
module-filter-apply: Remove some dead code
We never actually pass restore=true, so might as well remove any code
that deals with that case.
Signed-off-by: Arun Raghavan <git@arunraghavan.net>
Deepak Srivastava [Fri, 6 May 2016 04:44:46 +0000 (10:14 +0530)]
pulsecore: Fixed possible memory leak
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=95291
Signed-off-by: Deepak Srivastava <srivastava.d@samsung.com>
Signed-off-by: Arun Raghavan <git@arunraghavan.net>
Tanu Kaskinen [Fri, 4 Mar 2016 13:23:32 +0000 (15:23 +0200)]
switch-on-port-available: prefer ports that have been selected by the user
Let's assume that there are two output ports, and they are on
different profiles:
* Integrated speakers (priority: 10000, available)
* HDMI (priority: 5900, not available)
Then the user plugs in an HDMI monitor with speakers. Since the HDMI
priority is lower than the speaker priority, we don't route to HDMI by
default. However, the user manually switches the profile to use the
HDMI output.
Then the user plugs out the monitor, so we switch back to speakers.
When the monitor is plugged back in, the user needs to manually switch
the audio output again. That should be improved: if the user preferred
to the HDMI output over the speakers, we should remember that and
automatically switch to HDMI whenever it becomes available.
The lack of automatic switching is even worse when the monitor goes to
a sleep mode after some period of inactivity. The monitor audio may
become unavailable, and PulseAudio can't distinguish that from the
case where the monitor is physically unplugged. Even worse, the
monitor may become unavailable for a short while when adjusting the
display parameters (for example, media center software may adjust the
display parameters to match the media that is being played back). In
these cases we clearly should switch automatically back to HDMI when
it becomes available again.
This patch fixes the problem by setting pa_card.preferred_input_port
and pa_card.preferred_output_port when the user changes the card
profile or a port, and switching to the preferred port when it becomes
available.
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=93946
Tanu Kaskinen [Fri, 4 Mar 2016 13:23:31 +0000 (15:23 +0200)]
card-restore: restore preferred ports
Tanu Kaskinen [Fri, 4 Mar 2016 13:23:30 +0000 (15:23 +0200)]
card: add preferred_{input, output}_port
I will modify module-switch-on-port-available so that it will keep
track of which input and output port the user prefers on the card,
based on the user's profile and port switches. The preference needs
to be saved on disk, for which I will use module-card-restore.
To facilitate communication between the two modules, this patch adds
preferred_input_port and preferred_output_port fields to pa_card, and
a hook for monitoring the variable changes. It would be nice if the
two modules would communicate directly with each other, but
implementing that would be somewhat complicated, so I chose this time
for adding the functionality to the core. In theory some other routing
module might want to manage the new variables instead of
module-switch-on-port-available, but admittedly that's not very likely
to happen...
Tanu Kaskinen [Fri, 4 Mar 2016 13:23:29 +0000 (15:23 +0200)]
switch-on-port-available: avoid repetitive pointer deferencing
Trivial refactoring.
Tanu Kaskinen [Fri, 4 Mar 2016 13:23:28 +0000 (15:23 +0200)]
switch-on-port-available: fix inverted if condition
I'm sure the original intention was to switch the port if the target
port is available on the currently active profile.
Tanu Kaskinen [Fri, 4 Mar 2016 13:23:27 +0000 (15:23 +0200)]
switch-on-port-available: unify input/output switching policy
I don't think there's any reason why the same logic that has
previously added to output profile switching shouldn't be used with
input too.
Jeremy Huddleston Sequoia [Tue, 16 Jun 2015 09:32:01 +0000 (02:32 -0700)]
build-sys: Fix check for CoreServices.h
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@macports.org>
Signed-off-by: Arun Raghavan <git@arunraghavan.net>
Juho Hämäläinen [Tue, 26 Apr 2016 13:11:44 +0000 (16:11 +0300)]
stream-restore: With dbus-proto fix segfault if e->device is NULL.
If first part of test is false and e->device is NULL pa_streq will
segfault. Fix by using pa_safe_streq, which checks strings for NULL
before doing strcmp.
Arun Raghavan [Fri, 29 Apr 2016 12:05:28 +0000 (17:35 +0530)]
Revert "format: Make pa_format_info_valid() stricter for PCM"
This reverts commit
12a202c510dcacbd2b85fcc1170484eb16fef491.
This is needed for now to avoid a clash in clients using json-glib. The
commit added a call to json_object_get_type() in client code that didn't
exist before, and this breaks some apps like Rhythmbox and Totem. This
will be fixed in the future by possibly dropping json-c as a dep.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=95135
Ahmed S. Darwish [Fri, 15 Apr 2016 21:07:36 +0000 (23:07 +0200)]
core: Support memfd transport; bump protocol version
Now that all layers in the stack support memfd blocks, add memfd
support for the daemon's global core mempool. Also introduce
"enable-memfd=" daemon argument and configuration option.
For now, memfd support is an opt-in feature to be activated only
when daemon's enable-memfd= is set to yes.
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Ahmed S. Darwish [Fri, 15 Apr 2016 21:06:02 +0000 (23:06 +0200)]
client audio: Support memfd transport
Now that all layers in the stack support memfd blocks, add memfd
pools support for client context and audio playback data.
Use such memfd pools by default only if the server signals memfd
support in its connection negotiations.
Also add ability for clients to force-disable memfd transport
through the `enable-memfd=' client configuration option.
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Ahmed S. Darwish [Fri, 22 Apr 2016 19:51:27 +0000 (21:51 +0200)]
detect: Don't deprecate module-detect on non-Linux systems
The advertised alternative, module-udev-detect, is Linux-specific.
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=94339
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Ahmed S. Darwish [Sun, 13 Mar 2016 22:02:09 +0000 (00:02 +0200)]
stream: Document pa_stream_write() size and offset requirements
Both must be in multiples of the stream's sample spec frame size.
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Tanu Kaskinen [Fri, 18 Mar 2016 14:22:00 +0000 (16:22 +0200)]
filter-apply: simplify proplist updating
pa_sink_input_set_property() takes care of logging, so the logging
code is redundant.
Tanu Kaskinen [Thu, 10 Mar 2016 17:43:01 +0000 (19:43 +0200)]
loopback: refactor proplist updating
This saves some proplist allocations and a couple of code lines. Also,
logging is better, because the set_property() functions work with
string values, while the update_proplist() functions assume opaque
binary data, and therefore can't log the property values.
Tanu Kaskinen [Sun, 13 Mar 2016 11:57:31 +0000 (13:57 +0200)]
sink-input, source-output: remove set_name()
pa_sink_input_set_property() does everything pa_sink_input_set_name()
does.
Tanu Kaskinen [Fri, 11 Mar 2016 10:02:22 +0000 (12:02 +0200)]
sink-input, source-output: rework property setting
pa_sink_input_update_proplist() is inconvenient in many cases, because
it requires allocating a new proplist, even if the goal is to just set
one property. pa_sink_input_update_properties also can't properly log
property changes, because it has to assume that all values are
arbitrary binary data.
This patch adds pa_sink_input_set_property() for setting a string
value for a single property, and pa_sink_input_set_property_arbitrary()
for setting a binary value for a single property.
pa_sink_input_update_properties() is reimplemented as a wrapper around
pa_sink_input_set_property_arbitrary() to centralize logging and
sending change notifications.
(The above mentions only sink input functions for brevity, but the
same changes are implemented for source outputs too.)
Tanu Kaskinen [Mon, 7 Mar 2016 11:18:29 +0000 (13:18 +0200)]
device-manager, filter-apply: don't reroute streams that have a filter
device-manager reroutes all streams whenever a new device appears.
When filter-apply has loaded a filter for some stream, the filter
device may not be what device-manager considers the best device for
the stream, which means that when an unrelated device appears,
device-manager may break the filtering that filter-apply had set up.
This patch changes filter-apply so that it saves the filter device
name to the stream proplist when it sets up a filter. device-manager
can then check the proplist when it does rerouting, and skip the
rerouting for streams that have a filter applied to them.
The proplist isn't cleaned up when the stream moves away from the
filter device, so before doing any decisions based on the
filter_device property, it should be checked that the stream is
currently routed to the filter device. It seemed simpler to do it this
way compared to setting up stream move monitoring in filter-apply and
removing the property when the stream moves away from the filter
device.
Tanu Kaskinen [Sun, 13 Mar 2016 12:06:02 +0000 (14:06 +0200)]
don't move streams to devices that are going away
Before a device is unlinked, the unlink hook is fired, and it's
possible that a routing module tries to move streams to the unlinked
device in that hook, because it doesn't know that the device is being
unlinked. Of course, the unlinking is obvious when the code is in an
unlink hook callback, but it's possible that some other module does
something in the unlink hook that in turn triggers some other hook,
and it's this second hook where the routing module may get confused.
This patch adds an "unlink_requested" flag that is set before the
unlink hook is fired, and moving streams to a device with that flag
set is prevented.
This patch is motivated by seeing module-device-manager moving a
stream to a sink that was being unlinked. It was a complex case where
an alsa card was changing its profile, while an echo-cancel sink was
connected to the old alsa sink. module-always-sink loaded a null sink
in the middle of the profile change, and after a stream had been
rescued to the null sink, module-device-manager decided to move it
back to the old alsa sink that was being unlinked. That move made no
sense, so I came up with this patch.
Tanu Kaskinen [Thu, 10 Mar 2016 17:18:48 +0000 (19:18 +0200)]
echo-cancel: rework move handling
When autoloaded, module-echo-cancel doesn't support moving the sink
input and source output that it creates, but the move prevention was
implemented by manually requesting module unloading in the middle of
the stream move procedure, rather than by just setting the DONT_MOVE
flags. This patch removes the module unloading code from the moving()
callbacks and adds the DONT_MOVE flags. In addition to saving some
code, this also prevents problems related to trying to move streams
connected to the echo cancel sink or source while the echo cancel sink
or source is in the middle of a move too (a crash will happen in such
situation, as demonstrated in
https://bugs.freedesktop.org/show_bug.cgi?id=93443).
Ahmed S. Darwish [Fri, 22 Apr 2016 19:48:26 +0000 (21:48 +0200)]
protocol-native: Disable srbchannel for setups without SCM_CREDENTIALS
srbchannel needs fd passing. Otherwise we get the following error
for systems without SCM_CREDENTIALS support:
Code should not be reached at pulsecore/pstream-util.c:95,
function pa_pstream_send_tagstruct_with_fds(). Aborting.
[[ The root cause is that we define HAVE_CREDS only if
SCM_CREDENTIALS is defined, but SCM_CREDENTIALS is a Linux-specific
symbol. Thus HAVE_CREDS is always disabled on Solaris.
And since pulse couples the non-portable creds passing support
with the portable fd passing one, through _35_ places where
HAVE_CREDS is used, a real fix needs a PA redesign -- assuming that
latency on Solaris is something people care about. ]]
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=94339
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Ahmed S. Darwish [Sun, 13 Mar 2016 22:00:03 +0000 (00:00 +0200)]
build-sys: Set C language standard to gnu11
Per glibc feature_test_macros(7), setting compiler flags to
-std=c11 (or any c* variant like c99) enforces strict ANSI
mode.
Enforcing strict ANSI makes all declarations under _GNU_SOURCE
unavailable. This leads to build warnings in the form of:
warning: implicit declaration of function ‘syscall’
Thus replace -std=c11 with -std=gnu11
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Sangchul Lee [Tue, 29 Mar 2016 17:21:40 +0000 (02:21 +0900)]
stream-interaction: Fix crash in case of invalid argument for volume
In case of invalid argument for volume, the crash occurs in pa_stream_interaction_done().
pa_xnew() is replaced with pa_xnew0() to fix it.
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
Sangchul Lee [Wed, 13 Apr 2016 01:48:44 +0000 (10:48 +0900)]
role-ducking: Add support for ducking group
Now, trigger_roles, ducking_roles and volume can be divided into several groups by slash.
That means each group can be affected by its own volume policy.
If we need to apply ducking volume level differently that is triggered from
each trigger role(s), this feature would be useful for this purpose.
For example, let's assume that tts should take music and video's volume down to 40%
whereas voice_recognition should take those and tts's volume down to 20%.
In this case, the configuration can be written as below.
trigger_roles=tts/voice_recognition ducking_roles=music,video/music,video,tts volume=40%/20%
If one of ducking role is affected by more than two trigger roles simultaneously,
volume of the ducking role will be applied by method of multiplication.
And it works in the same way as before without any slash.
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
Nazar Mokrynskyi [Thu, 24 Mar 2016 13:59:23 +0000 (15:59 +0200)]
alsa-mixer: Support for Creative SoundBlaster Omni Surround 5.1 USB sound card with latest firmware
`Mic` is now detected as `Mic-In/Mic Array` (there are 2 microphones physically, nice to se this being understood).
`Line` is now detected as `Line In`.
Removed all output modes except officially supported stereo, 5.1 and stereo S/PDIF.
Also microphone/line in now might be used simultaneously with either output mode, yay!
Muhammet Kara [Sat, 16 Apr 2016 22:08:36 +0000 (01:08 +0300)]
i18n: Updated Turkish translation
Tanu Kaskinen [Tue, 12 Apr 2016 15:56:01 +0000 (18:56 +0300)]
build-sys: build gtk-test only when glib is enabled
gtk-test pulls in libpulse-mainloop-glib as a dependency, and compiling
glib-mainloop.c fails if glib support is disabled.
Milo Casagrande [Mon, 4 Apr 2016 09:27:20 +0000 (11:27 +0200)]
i18n: Update Italian translation
Signed-off-by: Milo Casagrande <milo@milo.name>
Arun Raghavan [Mon, 29 Feb 2016 08:58:58 +0000 (14:28 +0530)]
rtp: Do all receive side rate calculations in sink-input domain
The code was mixing sink and sink input domain rate updates, and that
only works if the rate of the RTP stream is the same as the rate of the
sink. This changes all the calcuations to be on the sink-input rate,
since that's the rate we are trying to guess (and resample for).
YunQiang Su [Sat, 2 Apr 2016 15:01:26 +0000 (18:01 +0300)]
i18n: update Simplified Chinese translation