Commit graph

8756 commits

Author SHA1 Message Date
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
Tanu Kaskinen
7f201b1fd4 alsa, solaris, oss: remove unnecessary error handling when suspending
Suspending never fails.
2018-02-23 13:33:03 +02:00
Tanu Kaskinen
d6e39b5e89 sink: don't sync monitor suspend state when unlinking
When the sink is unlinked, there's no need to update the monitor suspend
state. In fact, trying to do that causes an assertion failure, because
pa_source_sync_suspend() wasn't written to handle the case where the
sink is unlinked.
2018-02-22 10:55:44 +02:00
Tanu Kaskinen
6ed37aeef2 pass pa_suspend_cause_t to set_state() 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-02-22 09:13:40 +02:00
Tanu Kaskinen
3da0de5418 sink, source: redo state changing code
This adds a pa_suspend_cause_t parameter to the sink/source_set_state()
functions, and moves part of the work that pa_sink/source_suspend() does
to sink/source_set_state(). The reason for this code shuffling is that I
plan to make all suspend cause changes available to modules through the
state change callbacks. This is the first step towards that.

Additionally, pa_source_sync_suspend() is changed to also update the
suspend cause of the monitor source when the suspend cause of the
monitored sink changes. That probably doesn't have much effect on
anything, but I think it makes sense to mirror the sink suspend cause in
the monitor source.

pa_source_sync_suspend() has also a bug fix: previously it was probably
possible that a sink might get suspended while in the passthrough mode.
When the sink then resumed (while still in the passthrough mode),
pa_source_sync_suspend() would resume also the monitor source, even
though the monitor source should be kept suspended when the sink is in
the passthrough mode. Now the monitor source won't be resumed in this
situation.
2018-02-22 09:09:25 +02:00
Mr. M
bbab12ab34 i18n: update the Lithuanian translation 2018-02-15 10:29:48 +02:00
Tanu Kaskinen
72fa468a45 alsa-mixer: autodetect the ELD device
This removes the need to hardcode the ELD device index in the path
configuration. The hardcoded values don't work with the Intel HDMI LPE
driver.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=100488
2018-02-13 21:33:52 +02:00
Tanu Kaskinen
67f11ff301 alsa-mixer: autodetect the HDMI jack PCM device
This removes the need to hardcode the PCM device index in the HDMI jack
names. The hardcoded values don't work with the Intel HDMI LPE driver.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=100488
2018-02-13 21:33:17 +02:00
Tanu Kaskinen
09ff3fca2f alsa-mixer: add hw_device_index to pa_alsa_mapping
We have so far assumed that HDMI always uses device indexes 3, 7, 8, 9,
10, 11, 12 and 13. These values are hardcoded in the path configuration.
The Intel HDMI LPE driver, however, uses different device numbering
scheme. Since the indexes aren't always the same, we need to query the
hw device index from ALSA.

Later patches will use the queried index for HDMI jack detection and ELD
information reading.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=100488
2018-02-13 21:32:12 +02:00
Georg Chini
838d95dab7 filter-apply: Ignore monitor source of filter in find_paired_master()
When module-filter-apply tries to find a matching source-output for
a given sink-input and a stream within the same group exists on the
monitor source of the filter, module-filter apply falsely assumes
that the source belongs to another instance of the filter and tries
to access source->output_from_master->source, which leads to a
segmentation fault.

This patch fixes the issue by ignoring the stream if the source is
the monitor source of the filter.
2018-02-10 20:39:27 +01:00
Tanu Kaskinen
dfb0460fb4 memfd-wrappers: only define memfd_create() if not already defined
glibc 2.27 is to be released soon, and it will provide memfd_create().
If glibc provides the function, we must not define it ourselves,
otherwise building fails due to conflict between the two implementations
of the same function.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=104733
2018-01-31 08:21:32 +02:00
Vivek Dasmohapatra
6d7e057b37 daemon: don't re-exec if the linker supports the -z,now option
Usually PulseAudio is built with a linker that supports the -z,now
option, and that option should have the same effect (i.e. the dynamic
linker resolves all symbols when the program is started) as re-execing
with the LD_BIND_NOW environment variable set, so usually the re-execing
is redundant.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=104789
2018-01-26 04:05:38 +02:00
Felipe Sateler
f250341b80 build-sys: don't install esdcompat tool if building without esound support 2018-01-24 04:09:21 +02:00
Tanu Kaskinen
df79abe754 bluetooth: don't send unsolicted replies to the endpoint Release() call
It was reported that PulseAudio causes error messages in syslog from
dbus-daemon:

Jan 14 04:51:32 gentoo dbus-daemon[2492]: [system] Rejected send message, 2 matched rules; type="error", sender=":1.15" (uid=1000 pid=2864 comm="/usr/bin/pulseaudio --start --log-target=syslog ") interface="(unset)" member="(unset)" error name="org.bluez.MediaEndpoint1.Error.NotImplemented" requested_reply="0" destination=":1.1" (uid=0 pid=2670 comm="/usr/libexec/bluetooth/bluetoothd ")

The default policy on the system bus is to not let any method call
replies through if they have not been requested, and apparently
bluetoothd doesn't want replies to the Release() call.

This also changes the reply type from error to normal reply. The "not
implemented" error didn't make sense to me. We don't do any cleanup in
the Release() handler, probably because there's nothing to do. If there
is some cleanup that we should do, then it's a serious bug not to do it.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=104646
2018-01-21 00:17:17 +02:00
Samo Pogačnik
2563cd65bc pipe-sink: use existing fifo
Allow usage of an already existing fifo (named pipe) within the
pipe-sink module. Also, the used fifo is going to be removed upon
module unload only if the fifo is created by the same module.
2018-01-18 16:18:25 +01:00
Tanu Kaskinen
fb8f978676 alsa-mixer: add another hardware ID for Traktor Audio 6
This is based on a patch by Rolo <rolo@wildfish.com> that replaced the
old ID with the new one. I deemed it better to leave the old ID in use
(I can't verify if the old ID was correct or not).

The original commit message:

    Every time I reinstall or update Ubuntu I have to make this change
    to get it to recognise my Native Instruments Traktor Audio 6
    external soundcard.

    Each time I remember the change by hunting down this forum post in
    German,
    https://forum.ubuntuusers.de/topic/traktor-audio-6-erkannt-aber-nicht-anwaehlbar/3/#post-8759808
    (I don't speak German).

    I'm not sure if the ID is just incorrect or if perhaps the hardware
    identifies itself differently on slightly different models, so
    perhaps we need to duplicate the line - I'm well outside of my
    comfort zone here and I know barely anything about how hardware
    works on Linux but figured if it helps me it would help others so I
    should put it forward.

    Thanks!
2018-01-11 19:32:29 +02:00
Samo Pogačnik
50fedf8f72 pipe-sink: new option "use_system_clock_for_timing"
Using this option, even the simplest tools like "cat" can properly
dump raw audio from the pipe.
2018-01-04 15:39:18 +02:00