Commit graph

8772 commits

Author SHA1 Message Date
Tanu Kaskinen
ee910cf6da update NEWS 2018-07-16 17:44:26 +03:00
Tanu Kaskinen
6a6f1c6f68 update NEWS 2018-07-14 19:25:12 +03:00
Mr. M
b5188bb3e3 i18n: update the Lithuanian translation 2018-07-14 19:06:25 +03:00
Tanu Kaskinen
571ccc3318 pipe-sink, pipe-source: fix file permissions
We recently changed the umask of the daemon from 022 to 077, which broke
module-pipe-sink in the system mode, because nobody was allowed to read
from the pipe.

module-pipe-source in the system mode was probably always broken,
because the old umask of 022 should prevent anyone from writing to the
pipe.

This patch uses chmod() after the file creation to set the permissions
to 0666, which is what the fkfifo() call tried to set.

Bug link: https://bugs.freedesktop.org/show_bug.cgi?id=107070
2018-07-14 18:53:48 +03:00
Tanu Kaskinen
c7e5715075 ladspa-sink: fix search path
Having a single level macro for stringizing LADSPA_PATH doesn't work,
because the '#' preprocessor operator doesn't expand any macros in its
parameter. As a result, we used the string "LADSPA_PATH" as the search
path, and obviously no plugins were ever found.

This adds a two-level macro in macro.h and uses that to expand and
stringize LADSPA_PATH.

Bug link: https://bugs.freedesktop.org/show_bug.cgi?id=107078
2018-07-14 17:52:57 +03:00
Tanu Kaskinen
acae6df651 switch-on-port-available: ignore bluetooth cards
When the user manually switches the profile of a bluetooth headset from
"off" to "a2dp_sink", the port availability changes from "unknown" to
"yes", which triggered a recursive profile change in
module-switch-on-port-available. Such recursivity isn't (and possibly
can't) be handled well (that is, PulseAudio crashed), so let's avoid
doing bluetooth profile changes from module-switch-on-port-available
(they're useless anyway).

Bug link: https://bugs.freedesktop.org/show_bug.cgi?id=107044
2018-07-14 14:57:55 +03:00
Tanu Kaskinen
43e6ef5c7b update NEWS 2018-06-18 17:10:46 +03:00
Tanu Kaskinen
ad14bdb240 sink-input, source-output: fix uninitialized variable access
The volume_map variable was initialized only for PCM streams, but the
variable was passed to pa_cvolume_remap() also for non-PCM streams. The
volume remapping is never necessary for passthrough streams (PCM or
not), because no volume will be applied anyway, so let's skip the
pa_cvolume_remap() call for all passthrough streams.
2018-05-31 16:29:29 +03:00
Tanu Kaskinen
9e5be0899f alsa-card: fix null dereference
jack->melem can be null if the jack disappears between probing the card
and the init_jacks() call. I don't know if jacks actually ever disappear
like that (seems unlikely), but this check is in any case needed as long
as init_jacks() has proper handling for the jack disappearing case
(rather than just an assert).

There was a crash report[1] that indicated that card_suspend_changed()
called report_jack_state() with a null melem. I don't know if that was
because the jack actually disappeared, or is there some other bug too.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=104385
2018-05-30 19:56:29 +03:00
Georg Chini
1e68e9aa10 alsa-util: Use time stamp config only for alsa versions >= 1.1.0
The commit "alsa-util: Set ALSA report_delay flag in pa_alsa_safe_delay()"
broke the build on ALSA versions below 1.1.0 because the time stamp
configuration function was introduced in 1.1.0.

This patch makes the usage of snd_pcm_status_set_audio_htstamp_config()
dependent on ALSA version.
2018-05-15 07:52:19 +02:00
Tanu Kaskinen
26b41dd169 build-sys: remove module-defs.h.m4 from EXTRA_DIST
The file doesn't exist any more.
2018-05-11 14:28:14 +03:00
Tanu Kaskinen
d25387454a build-sys: fix distribution of GSettings files
dist_gsettingsdataconvert_DATA was set only if GSettings was enabled. If
the developer that generates the tarball doesn't have GSettings enabled,
pulseaudio.convert wouldn't get included in the tarball.

The schema file was not being added to the tarball even if GSettings was
enabled.
2018-05-11 14:28:14 +03:00
Tanu Kaskinen
0ee9d65467 build-sys: bump sonames
A few small internal changes in libpulse. No changes in libpulse-simple
and libpulse-mainloop-glib.
2018-05-11 13:53:31 +03:00
Georg Chini
b32705a5d4 alsa-util: Set ALSA report_delay flag in pa_alsa_safe_delay()
The current code does not call snd_pcm_status_set_audio_htstamp_config()
to configure the way timestamps are updated in ALSA. In kernel 4.14 and
above a bug in ALSA has been fixed which changes timmestamp behavior.
This leads to inconsistencies in the delay reporting because the time
stamp no longer reflects the time when the delay was updated if the
ALSA report_delay flag is not set. Therefore latencies are not calculated
correctly.

This patch uses snd_pcm_status_set_audio_htstamp_config() to set the
ALSA report_delay flag to 1 before the call to snd_pcm_status(). With
this, time stamps are updated as expected.
2018-05-11 11:11:38 +03:00
Georg Chini
3b04539d5e bluez5-device: Fix memory leak in sco_process_render()
sco_process_render does not unref the memblock when it encounters an error.

This patch fixes the issue. It also changes the return value to 1 in the case
of EAGAIN. Because the data was already rendered and cannot be re-sent, we
have to discard the block.

Because the modified EAGAIN handling prevents the log message about EAGAIN
after POLLOUT from being printed, the log message was moved to
a2dp/sco_process_render().
2018-05-09 07:29:12 +02:00
Georg Chini
192c3aaef8 bluez5-device: Rewrite of thread function, reduce send buffer size for a2dp sink
The rewrite of the thread function does not change functionality much,
most of it is only cleanup, minor bug fixing  and documentation work.

This patch also changes the send buffer size for a2dp sink to avoid lags
after temporary connection drops, following the proof-of-concept patch
posted by Dmitry Kalyanov.

Bug-Link: https://bugs.freedesktop.org/show_bug.cgi?id=58746

Additionally the patch changes the fixed latency for HSP playback from 125
to 25 ms. Tests showed that this produces better audio sync, which is
expected as HSP should have smaller latency than A2DP.
2018-05-09 07:27:58 +02:00
David Hewitt
dc65a03454 vala: Fix lengths for source/sink port arrays 2018-05-07 17:30:56 +03:00
Tanu Kaskinen
efba6e3b30 allow-passthrough: fix hook return value
-PA_ERR_NOENTITY is not a valid pa_hook_result_t value.
2018-05-07 16:53:57 +03:00
Arun Raghavan
f9f9877d18 module-allow-passthrough: Don't crash if we can't find a sink
module-allow-passthrough has a (necessary) hack to replicate the default
sink selection and format negotiation from sink-input.c. One thing that
got missed in this replication is the possibility that the sink input is
not compatible with the default sink. When this happen, we now exit
gracefully.
2018-05-06 08:04:08 +05:30
Sangchul Lee
66e8ec3453 ladspa-sink: fix incorrect error conditions
fix codes to prevent null pointer dereference of cdata variable.

Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
2018-05-04 17:30:59 +03:00
Piotr Drąg
ae843808bc i18n: update Polish translation
https://bugs.freedesktop.org/show_bug.cgi?id=106284
2018-05-01 18:13:46 +03:00
Sangchul Lee
3f6a1c3b4c alsa-sink/source: always set reconfiguration callback
Reconfiguration callback should also be set in case of avoiding resampling
option. This patch set the callback for every case because the callback
has already conditions to leave if it is not needed.
Also unnecessary codes of setting alternate sample rate to 0 are removed.

Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
2018-05-01 18:01:48 +03:00
Tanu Kaskinen
e3b68ee76f gsettings: run gsettings-data-convert from gsettings-helper
This was originally planned to be done by paprefs when it starts, but
since the schema is now fully controlled by pulseaudio, it makes sense
to run the conversion from pulseaudio instead.
2018-04-26 14:58:17 +03:00
wellington wallace
f8abe975ab vala: fix a struct field name and add missing source output volume/mute functions 2018-04-26 14:34:48 +03:00
Tanu Kaskinen
5d66b44203 build-sys: enable GSettings by default
A new paprefs release is expected soon, and it will only support
GSettings. In order to have the default configuration work with the new
paprefs version, we need to enable GSettings by default.

If both module-gconf and module-gsettings are enabled when building
PulseAudio, both modules will be part of the default configuration. That
can cause trouble, because when the GConf database is migrated to
GSettings, the old configuration in GConf is not removed, so both
module-gconf and module-gsettings will try to load modules.

Generally it's not necessary to have both modules enabled even at build
time, so let's default to having only one of them enabled.
2018-04-19 14:45:31 +03:00
Tanu Kaskinen
f97cd3449e gsettings: free group_names after use 2018-04-19 14:45:25 +03:00
Tanu Kaskinen
2977afb9b0 gsettings: free the module-group GSettings objects after use
g_settings_get_child() returns a new GSettings object that needs to be
freed when it's not used any more. This patch collects all the childern
to a GPtrArray and frees them at the end of main(). They can't be freed
earlier, because that would prevent the "changed" signals from being
delivered.
2018-04-19 14:45:19 +03:00
Tanu Kaskinen
705779eddd gsettings: remove bad signal connection
The removed g_signal_connect() call didn't make sense. The callback
expects to be called when individual module groups are changed, not when
the top level object is changed. Also, module_group_callback() expects
user_data to be non-NULL, but here it was set to NULL.
2018-04-19 14:45:13 +03:00
Tanu Kaskinen
8484b63c18 gsettings: check that children haven't been deleted before using them
According to the documentation of g_settings_list_children(), the listed
children may be removed at any time, so g_settings_get_child() may
return NULL. This is probably very unlikely to happen in practice, but
it's good to check anyway.
2018-04-19 14:45:06 +03:00
Tanu Kaskinen
f5ff5d8bf2 build-sys: remove a redundant enable_gsettings check
If HAVE_GSETTINGS is 1, then enable_gsettings must be yes, so checking
enable_gsettings isn't necessary.
2018-04-19 14:38:36 +03:00
Tanu Kaskinen
890bc108d6 gsettings: rename "module" to "module-group"
It is confusing if there's a thing named "module" which defines up to 10
modules to load. Calling the thing a "module group" instead should make
it easier to understand.
2018-04-19 14:38:29 +03:00
Tanu Kaskinen
0623b3c91e gconf, gsettings: fix config.h includes
config.h should be included by all .c files and none of the .h files.
2018-04-19 14:38:18 +03:00
Tanu Kaskinen
d7a457eaed gsettings: add the modules schema to the schema description file
Originally the idea was to provide the "modules" schema with paprefs,
but since module-gsettings refers to the "modules" schema in its code,
that would make module-gsettings depend on paprefs, which is not good.
Now all schemas are provided by module-gsettings, so the paprefs
dependency is avoided. Unfortunately this means that if paprefs is
modified to load some new modules, the schema in pulseaudio needs to be
updated as well.
2018-04-19 14:38:10 +03:00
Tanu Kaskinen
b43d47f005 default.pa: add module-gsettings
This also makes the module-gconf section conditional on HAVE_GCONF,
because if only gsettings support is built, the gconf section in the
configuration file would be redundant and confusing.
2018-04-19 14:31:18 +03:00
Tanu Kaskinen
29ed94600c .gitignore: add module-gsettings related things 2018-04-19 14:31:12 +03:00
Sylvain Baubeau
785b660d8a module-gsettings: new module to store configuration using gsettings
GConf is deprecated, and distributions are removing it. paprefs depends
on GConf, so in order to avoid paprefs getting removed as well, paprefs
has to be changed to use something else than GConf. GSettings is the
easiest alternative to migrate to, although it has the same problems
that GConf had: no support for system mode or networking.

This patch takes the non-GConf specific code from module-gconf and puts
it in stdin-util.[ch], which is then reused by module-gsettings.
module-gsettings is designed to be very similar to module-gconf.

Migration is expected to happen as follows: Distributions update
PulseAudio and paprefs at the same time, or first PulseAudio and then
paprefs. paprefs depends on module-gsettings, and module-gsettings
conflicts with module-gconf. Therefore module-gconf gets automatically
removed during the paprefs update. After the update an old PulseAudio is
likely to be running with module-gconf loaded. If the user tries to use
paprefs during this period, whatever the user does in paprefs won't have
any effect until PulseAudio is restarted (probably by a reboot or
relogin). This is not ideal, but will have to do.

When module-gsettings is loaded, it runs gsettings-data-convert
(implemented in a later patch). That will copy the settings from GConf
to GSettings. If gsettings-data-convert is not available (it's part of
GConf, so it may have already been uninstalled), then any previous
paprefs settings are lost.
2018-04-19 14:30:30 +03:00
Felipe Sateler
ba2b748d40 qpaeq: fix Qt5 mainloop use
This change was missed in the Qt4 -> Qt5 conversion.
2018-04-11 15:26:19 +03:00
Tanu Kaskinen
cae3557c52 man: unify pactl and pacmd suspend command documentation
The suspend-sink and suspend-source documentation for pacmd was quite
terse, so I copied the more complete documentation from pactl. I
couldn't resist doing some other minor edits along the way too.

Bug-link: https://bugs.freedesktop.org/show_bug.cgi?id=105907
2018-04-10 15:29:18 +03:00
Daniel Rusek
b1d74c86c2 i18n: update the Czech translation 2018-04-02 14:34:59 +03:00
Jungsup Lee
605b2bbc41 Fix memory leaks
The returned string of the dbus_message_iter_get_signature() must be
freed with dbus_free().
2018-03-23 16:27:23 +02:00
Yuri Chornoivan
8b9a8b2618 i18n: update the Ukrainian translation 2018-03-20 13:24:18 +02:00
Tanu Kaskinen
ad15e6e50e fix a call to pa_sink_suspend() from an incorrect thread
The alsa sink calls pa_sink_suspend() from the set_port() callback.
pa_sink_suspend() can only be called from the main thread, but the
set_port() callback was often called from the IO thread. That caused an
assertion to be hit in pa_sink_suspend() when switching ports.

Another issue was that pa_sink_suspend() called the set_port() callback,
and if the callback calls pa_sink_suspend() again recursively, nothing
good can be expected from that, so the thread mismatch was not the only
problem.

This patch moves the mixer syncing logic out of pa_sink/source_suspend()
to be handled internally by the alsa sink/source. This removes the
recursive pa_sink_suspend() call. This also removes the need to have the
mixer_dirty flag in pa_sink/source, so the flag and the
pa_sink/source_set_mixer_dirty() functions can be removed.

This patch also changes the threading rules of set_port(). Previously it
was called sometimes from the main thread and sometimes from the IO
thread. Now it's always called from the main thread. When deferred
volumes are used, the alsa sink and source still have to update the
mixer from the IO thread when switching ports, but the thread
synchronization is now handled internally by the alsa sink and source.
The SET_PORT messages are not needed any more and can be removed.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=104761
2018-03-20 13:05:26 +02:00
Tanu Kaskinen
ad0616d4c9 pass pa_suspend_cause_t to set_state_in_io_thread() callbacks
The suspend cause isn't yet used by any of the callbacks. The alsa sink
and source will use it to sync the mixer when the SESSION suspend cause
is removed. Currently the syncing is done in pa_sink/source_suspend(),
and I want to change that, because pa_sink/source_suspend() shouldn't
have any alsa specific code.
2018-03-20 13:00:44 +02:00
Tanu Kaskinen
b2537a8f38 replace sink/source SET_STATE handlers with callbacks
There are no behaviour changes, the code from almost all the SET_STATE
handlers is moved with minimal changes to the newly introduced
set_state_in_io_thread() callback. The only exception is module-tunnel,
which has to call pa_sink_render() after pa_sink.thread_info.state has
been updated. The set_state_in_io_thread() callback is called before
updating that variable, so moving the SET_STATE handler code to the
callback isn't possible.

The purpose of this change is to make it easier to get state change
handling right in modules. Hooking to the SET_STATE messages in modules
required care in calling pa_sink/source_process_msg() at the right time
(or not calling it at all, as was the case on resume failures), and
there were a few bugs (fixed before this patch). Now the core takes care
of ordering things correctly.

Another motivation for this change is that there was some talk about
adding a suspend_cause variable to pa_sink/source.thread_info. The
variable would be updated in the core SET_STATE handler, but that would
not work with the old design, because in case of resume failures modules
didn't call the core message handler.
2018-03-16 20:05:38 +02:00
Tanu Kaskinen
73b8a57078 oss: don't fail resume if trigger() fails
The previous code made the SET_STATE message fail if trigger() failed.
However, trigger() was called after pa_sink/source_process_msg(), which
meant that the main thread that sent the SET_STATE thought that resuming
failed, but nothing was undone in the IO thread, so in the IO thread
things seemed as if the sink/source was successfully resumed. (I don't
use OSS myself, so I don't know what kind of practical problems this
could cause).

Unless some complex undo logic is implemented, I believe it's best to
ignore all failures in trigger(). Most error cases were already ignored,
and the only one that wasn't ignored doesn't seem too serious.

I also moved trigger() to happen before pa_sink/source_process_msg(),
which made it necessary to add new state parameters to trigger(). The
reason for this move is that I want to move the SET_STATE handler code
into a separate callback, and if things are done both before and after
pa_sink/source_process_msg(), that makes things more complicated.

The previous code checked the return value of
pa_sink/source_process_msg() before calling trigger(), but that was
unnecessary, since pa_sink/source_process_msg() never fails when
processing the SET_STATE messages.
2018-03-16 20:04:34 +02:00
Tanu Kaskinen
0fad369ceb sink, source: rename set_state() to set_state_in_main_thread()
There will be a new callback named set_state_in_io_thread(). It seems
like a good idea to have a similar name for the main thread variant.
2018-03-16 19:54:59 +02:00
Tanu Kaskinen
f6fe411b32 bluetooth: fix resume error handling
When resuming a sink or source, pa_sink/source_process_msg() should be
called only if resuming is successful. pa_sink/source_process_msg()
updates thread_info.state and notifies streams about the new state, but
if resuming fails, there's no state change.
2018-03-07 13:40:23 +02:00
Andika Triwidada
64eef3cf29 i18n: update the Indonesian translation 2018-03-04 18:05:14 +02:00
Tanu Kaskinen
7f09164ed7 null-sink, pipe-sink: some state variable cleanups
pa_sink_get_state() is supposed to be used from the main thread. In this
case it doesn't really matter, because the SET_STATE handler is executed
while the main thread is waiting, but since the state is available also
in thread_info, let's use that. All other modules use thread_info.state
too, so at least this change improves consistency.

Also, we can use the PA_SINK_IS_OPENED macro to simplify the code a bit.
2018-02-23 13:36:35 +02:00
Tanu Kaskinen
2dff0d6a6a alsa: add a couple of FIXME comments
build_pollfd() isn't likely to fail, but if it does, pa_sink/source_put()
will crash on an assertion failure. I haven't seen such crash happening,
this is just something that I noticed while studying the state change
code.
2018-02-23 13:35:47 +02:00