Commit graph

8392 commits

Author SHA1 Message Date
Arun Raghavan
74c9549a42 stream-interaction: Fix a memory leak
CID: 1352053
2016-08-10 22:23:02 +05:30
Arun Raghavan
fd2c630e33 shm: Wrap memfd-specific code in relevant ifdef
Doesn't really affect logic, but Coverity reports this as dead-code, and
I figure it makes sense to be consistent about our use of HAVE_MEMFD.

CID: 1352045
2016-08-10 22:18:13 +05:30
Arun Raghavan
d0428f47f4 source-output: Fix copy-pasto
CID: 1352047
2016-08-10 22:18:13 +05:30
Arun Raghavan
2599a35721 sink-input,source-output: Fix a leak during property change logging
CID: 1352052
2016-08-10 22:16:50 +05:30
Peter Meerwald
f9985e1cbd build: Check version of check library, require >= 0.9.10
tests/core-util-test.c uses ck_assert_int_lt() which was introduced
in check 0.9.10

make this dependency (with --enable-tests) explicit in configure.ac

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
2016-08-10 17:05:01 +03:00
Peter Meerwald
04feab17e3 tests: Include signal.h in core-util-test.c
on oldish Ubuntu 12.04:
tests/core-util-test.c: In function ‘main’:
tests/core-util-test.c:269:66: error: ‘SIGABRT’ undeclared (first use in this function)
     tcase_add_test_raise_signal(tc, modargs_test_replace_fail_1, SIGABRT);

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
2016-08-10 16:52:50 +03:00
Dušan Kazik Kazik
e4fa17ddff i18n: Update Polish translation 2016-07-28 12:21:38 +05:30
Pali Rohár
bde2ff8794 bluetooth: Add support for automatic switch between hsp and a2dp profiles
With this patch module-bluetooth-policy automatically switch from a2dp profile
to hsp profile if some VOIP application with media.role=phone wants to start
recording audio.

By default a2dp profile is used for listening music, but for VOIP calls is
needed profile with microphone support (hsp). So this patch will switch to
hsp profile if some application want to use microphone (and specify it in
media.role as "phone). After recording is stopped profile is switched back
to a2dp. So this patch allows to use bluetooth microphone for VOIP applications
with media.role=phone automatically without need of user interaction.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
2016-07-22 16:30:25 +05:30
Pierre Ossman
74251f0786 memblockq: remove internal "missing" state variable
It was a very confusing state variable that required a lot of
fiddling. It was also redundant in that it can be computed from
the other variables, removing any risk of it getting out of sync.
In the same spirit, make sure "requested" also always contains a
sane value, even though it may not be used by every caller.
2016-07-22 16:30:25 +05:30
Romain Naour
a7231692e9 build-sys: C++11 is only required for WebRTC support
Make C++11 support optional and explicitly check for gnu++11.

Stop the build only if no C++11 support has been found and WebRTC
support has been requested.

Fixes:
http://autobuild.buildroot.net/results/d89/d897a94a8b6a52eba03d04c24536f554a7643000

Signed-off-by: Romain Naour <romain.naour@gmail.com>
2016-07-22 16:30:11 +05:30
Arun Raghavan
80c732e4c1 memblockq-test: Rename test to something more relevant
We now have a separate test for _pop_missing().
2016-07-22 15:49:59 +05:30
Ulrich Eckhardt
fec2a3dd05 memblockq-test: Add a test for missing data behaviour
This involves in particular pa_memblockq_missing() and
pa_memblockq_pop_missing(). The test demonstrates that the latter
doesn't work as expected. It should report whenever queue level is
drained below target level. Instead, it reports any case that the queue
level is drained, even when it is still above target level.
2016-07-22 15:49:59 +05:30
Ulrich Eckhardt
ad52f9a6ba memblockq-test: Add test changing the parameters of a queue
When changing e.g. the maximum length, the target length may may have to
be adjusted, too.
2016-07-22 15:18:27 +05:30
Ulrich Eckhardt
8299afdc9a memblockq-test: Add a test that checks initial properties
Make sure that e.g. the initial size is zero and the initially missing
bytes are exactly the target length etc.
2016-07-22 15:18:27 +05:30
Ulrich Eckhardt
a295cb87cf memblockq-test: Some refactoring
- Set the loglevel once in the main entry code instead of in each test function.
 - Check pool allocation succeeded.
 - Reduce code by using utility function to allocate chunks.
 - Improve coverage by using utility function to validate queue invariants.
2016-07-22 15:18:27 +05:30
Ulrich Eckhardt
37b0ce0333 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.
2016-07-22 15:18:27 +05:30
Ulrich Eckhardt
ac72e85f0a memblockq-test: Utility function to alloc chunks
This eases creating a chunk from a string for writing tests.
2016-07-22 15:18:27 +05:30
Pierre Ossman
06b84bfd05 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>
2016-07-22 14:44:35 +05:30
Pierre Ossman
eeec52caa0 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.
2016-07-22 14:44:35 +05:30
Tanu Kaskinen
edff1b2204 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
7cb524a77b, so I just copied the same text into the comment.
2016-07-20 23:39:59 +03:00
Felipe Sateler
7cb524a77b 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.
2016-07-20 23:35:03 +03:00
Arun Raghavan
4cd89aa30d 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>
2016-07-14 18:42:26 +03:00
Georg Chini
dfa4f42480 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.
2016-07-14 01:14:03 +03:00
Georg Chini
c03633766c 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.
2016-07-14 01:13:53 +03:00
Georg Chini
4a11742652 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.
2016-07-14 01:13:43 +03:00
Georg Chini
919cc2f3f9 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.
2016-07-14 01:13:32 +03:00
Georg Chini
b494bd62dd loopback: Change memblockq length
The size of the memblockq must be increased to allow for long latencies
at high sample rates.
2016-07-14 01:13:19 +03:00
Georg Chini
8c39a5c16c 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.
2016-07-14 01:11:50 +03:00
Georg Chini
2d7a5cda43 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.
2016-07-14 01:11:36 +03:00
Georg Chini
86e54c8c13 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.
2016-07-14 01:05:49 +03:00
Ulrich Eckhardt
7c280b6037 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.
2016-07-06 21:47:39 +03:00
Ahmed S. Darwish
82d0314a05 protocol-native: DRY: Remove pdispatch callbacks declarations
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
2016-07-04 21:08:36 +03:00
Tanu Kaskinen
a222a07920 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
2016-06-28 16:55:42 +03:00
Tanu Kaskinen
0045f552aa card: remove pa_card_new_data.active_profile
It's not being used any more.
2016-06-28 16:55:42 +03:00
Tanu Kaskinen
7b62601401 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.
2016-06-28 16:55:42 +03:00
Tanu Kaskinen
18d44b9759 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.
2016-06-28 16:55:42 +03:00
Tanu Kaskinen
59e76ca949 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.
2016-06-28 16:55:42 +03:00
Ahmed S. Darwish
87f437d0dd pstream: Add rationale for pa_cmsg_ancil_data_close_fds()
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
2016-06-22 21:04:47 +05:30
Arun Raghavan
06fbdcaa3e 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.
2016-06-22 21:04:47 +05:30
Arun Raghavan
b793f68f2e 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.
2016-06-22 21:04:47 +05:30
Arun Raghavan
9e10c1caa3 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.
2016-06-22 21:04:47 +05:30
Chris Billington
694662d936 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
2016-06-22 21:04:47 +05:30
Tanu Kaskinen
99c3bc69d5 webrtc: improve comment about mic geometry
The first mic channel position is not relevant for the target
direction definition.
2016-06-22 21:04:47 +05:30
Chris Billington
d2d3d0e141 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.
2016-06-22 21:04:47 +05:30
Arun Raghavan
e3148f9ac2 json: Drop refcounting of json objects
We don't actually use the refcounting bits.

Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-22 21:04:47 +05:30
Arun Raghavan
8f45d83bdb json: Add some more negative test cases
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-22 21:04:47 +05:30
Arun Raghavan
1879beab87 json: Add a positive test for nested objects
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-22 21:04:47 +05:30
Arun Raghavan
0c1dbf5c79 json: Error out for objects and arrays that are nested too deep
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-22 21:04:47 +05:30
Arun Raghavan
5b1bd84902 json: Handle error cases while parsing numbers
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-22 21:04:47 +05:30
Arun Raghavan
777a5091f6 json: Add overflow checks for integer and float parsing
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-22 21:04:47 +05:30