summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* build-sys: Bump sonames for releasev8.99.1Arun Raghavan2016-05-121-1/+1
| | | | | | Bumping libpulse' version since PA_RATE_MAX was changed. Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
* module-filter-apply: Fix stale m-d-m property name in commentArun Raghavan2016-05-111-2/+2
| | | | Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
* alsa: Reread and upate jack status when a card is unsuspendedArun Raghavan2016-05-113-18/+32
| | | | | | | | 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>
* alsa: ignore jack events when the user is inactiveTanu Kaskinen2016-05-103-0/+35
| | | | | | See the big comment in the code for more details. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=93259
* module-filter-apply: Fix a memory leakSachin Kumar Chauhan2016-05-101-14/+11
| | | | | | | | | | 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>
* module-device-manager: Refine logic to ignore filtered streamsArun Raghavan2016-05-072-15/+31
| | | | | | | | | | | | | | | 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>
* module-filter-apply: Don't implement policy in module-device-managerArun Raghavan2016-05-072-24/+50
| | | | | | | | 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>
* module-filter-apply: Remove some dead codeArun Raghavan2016-05-061-10/+6
| | | | | | | 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>
* pulsecore: Fixed possible memory leakDeepak Srivastava2016-05-061-1/+3
| | | | | | | 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>
* switch-on-port-available: prefer ports that have been selected by the userTanu Kaskinen2016-05-031-7/+202
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* card-restore: restore preferred portsTanu Kaskinen2016-05-031-1/+67
|
* card: add preferred_{input, output}_portTanu Kaskinen2016-05-033-0/+59
| | | | | | | | | | | | | | | | | 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...
* switch-on-port-available: avoid repetitive pointer deferencingTanu Kaskinen2016-05-031-8/+14
| | | | Trivial refactoring.
* switch-on-port-available: fix inverted if conditionTanu Kaskinen2016-05-031-1/+1
| | | | | I'm sure the original intention was to switch the port if the target port is available on the currently active profile.
* switch-on-port-available: unify input/output switching policyTanu Kaskinen2016-05-031-2/+13
| | | | | | 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.
* build-sys: Fix check for CoreServices.hJeremy Huddleston Sequoia2016-05-031-6/+2
| | | | | Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@macports.org> Signed-off-by: Arun Raghavan <git@arunraghavan.net>
* stream-restore: With dbus-proto fix segfault if e->device is NULL.Juho Hämäläinen2016-04-291-2/+2
| | | | | | 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.
* Revert "format: Make pa_format_info_valid() stricter for PCM"Arun Raghavan2016-04-291-7/+1
| | | | | | | | | | | 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
* core: Support memfd transport; bump protocol versionAhmed S. Darwish2016-04-2713-24/+122
| | | | | | | | | | | 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>
* client audio: Support memfd transportAhmed S. Darwish2016-04-277-7/+88
| | | | | | | | | | | | | 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>
* detect: Don't deprecate module-detect on non-Linux systemsAhmed S. Darwish2016-04-251-0/+3
| | | | | | | 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>
* stream: Document pa_stream_write() size and offset requirementsAhmed S. Darwish2016-04-251-2/+2
| | | | | | Both must be in multiples of the stream's sample spec frame size. Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
* filter-apply: simplify proplist updatingTanu Kaskinen2016-04-251-46/+4
| | | | | pa_sink_input_set_property() takes care of logging, so the logging code is redundant.
* loopback: refactor proplist updatingTanu Kaskinen2016-04-251-15/+13
| | | | | | | 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.
* sink-input, source-output: remove set_name()Tanu Kaskinen2016-04-255-56/+2
| | | | | pa_sink_input_set_property() does everything pa_sink_input_set_name() does.
* sink-input, source-output: rework property settingTanu Kaskinen2016-04-254-10/+228
| | | | | | | | | | | | | | | | | | 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.)
* device-manager, filter-apply: don't reroute streams that have a filterTanu Kaskinen2016-04-252-2/+71
| | | | | | | | | | | | | | | | | | | | | 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.
* don't move streams to devices that are going awayTanu Kaskinen2016-04-256-3/+27
| | | | | | | | | | | | | | | | | | | | | | 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.
* echo-cancel: rework move handlingTanu Kaskinen2016-04-251-17/+11
| | | | | | | | | | | | | | 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).
* protocol-native: Disable srbchannel for setups without SCM_CREDENTIALSAhmed S. Darwish2016-04-242-2/+7
| | | | | | | | | | | | | | | | | | | | 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>
* build-sys: Set C language standard to gnu11Ahmed S. Darwish2016-04-232-3/+3
| | | | | | | | | | | | | | | 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>
* stream-interaction: Fix crash in case of invalid argument for volumeSangchul Lee2016-04-201-1/+1
| | | | | | | 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>
* role-ducking: Add support for ducking groupSangchul Lee2016-04-202-87/+212
| | | | | | | | | | | | | | | | | | | 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>
* alsa-mixer: Support for Creative SoundBlaster Omni Surround 5.1 USB sound ↵Nazar Mokrynskyi2016-04-193-15/+10
| | | | | | | | | 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!
* i18n: Updated Turkish translationMuhammet Kara2016-04-181-365/+401
|
* build-sys: build gtk-test only when glib is enabledTanu Kaskinen2016-04-121-1/+2
| | | | | gtk-test pulls in libpulse-mainloop-glib as a dependency, and compiling glib-mainloop.c fails if glib support is disabled.
* i18n: Update Italian translationMilo Casagrande2016-04-061-296/+366
| | | | Signed-off-by: Milo Casagrande <milo@milo.name>
* rtp: Do all receive side rate calculations in sink-input domainArun Raghavan2016-04-021-8/+10
| | | | | | | 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).
* i18n: update Simplified Chinese translationYunQiang Su2016-04-021-618/+383
|
* memblock/pstream: Fix two compiler warningsDavid Henningsson2016-04-022-2/+4
| | | | | | Fix two compiler warnings recently introduced by the memfd patch set. Signed-off-by: David Henningsson <diwic@ubuntu.com>
* pstream: Support memfd blocks transportAhmed S. Darwish2016-04-0217-75/+454
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we have the necessary infrastructure to memexport and mempimport a memfd memblock, extend that support higher up in the chain with pstreams. A PA endpoint can now _transparently_ send a memfd memblock to the other end by simply calling pa_pstream_send_memblock() – provided the block's memfd pool was earlier registered with the pstream. If the pipe does not support memfd transfers, we fall back to sending the block's full data instead of just its reference. ** Further details: A single pstream connection usually transfers blocks from multiple pools including the server's srbchannel mempool, the client's audio data mempool, and the server's global core mempool. If these mempools are memfd-backed, we now require registering them with the pstream before sending any blocks they cover. This is done to minimize fd passing overhead and avoid fd leaks. Moreover, to support all these pools without hard-coding their number or nature in the Pulse communication protocol itself, a new REGISTER_MEMFD_SHMID command is introduced. That command can be sent _anytime_ during the pstream's lifetime and is used for creating on demand SHM ID to memfd mappings. Suggested-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
* pulsecore: Specially mark global mempoolsAhmed S. Darwish2016-04-0215-19/+124
| | | | | | | | | | | | | | | | | | | | | Color global mempools with a special mark. This special marking is needed for handling memfd-backed pools. To avoid fd leaks, memfd pools are registered with the connection pstream to create an ID<->memfd mapping on both PA endpoints. Such memory regions are then always referenced by their IDs and never by their fds, and so their fds can be safely closed later. Unfortunately this scheme cannot work with global pools since the registration ID<->memfd mechanism needs to happen for each newly connected client, and thus the need for a more special handling. That is, for the pool's fd to be always open :-( Almost all mempools are now created on a per-client basis. The only exception is the pa_core's mempool which is still shared between all clients of the system. Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
* memimport: Support memfd blocksAhmed S. Darwish2016-04-026-23/+113
| | | | | | | | | | | | | | | | To transfer memfd-backed blocks without passing their fd every time, thus minimizing overhead and avoiding fd leaks, a command is sent with the memfd fd as ancil data very early on. This command has an ID that uniquely identifies the memfd region. Further memfd block references are then exclusively done using this ID. This commit implements the details of such 'permanent' mappings on the receiving end, using memimport segments. Suggested-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
* pulsecore: Introduce memfd supportAhmed S. Darwish2016-04-025-65/+230
| | | | | | | | | | | | | | | | | | Memfd is a simple memory sharing mechanism, added by the systemd/kdbus developers, to share pages between processes in an anonymous, no global registry needed, no mount-point required, relatively secure, manner. This patch introduces the necessary building blocks for using memfd shared memory transfers in PulseAudio. Memfd support shall also help us in laying out the necessary (but not yet sufficient) groundwork for application sandboxing, protecting PA from its clients, and protecting clients data from each other. We plan to exclusively use memfds, instead of POSIX SHM, on the way forward. Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
* SHM: Refactor private allocationsAhmed S. Darwish2016-04-021-73/+87
| | | | | | | | | | | pa_shm_create_rw() is responsible for creating two types of memory: POSIX shared memory and regular malloc()-ed ones. A third memory type, memfds, will be added later. Thus to add this extra shared memory type in a sane manner, refactor private memory allocations into their own static methods. Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
* pulsecore: Transform pa_mempool_new() into a factory methodAhmed S. Darwish2016-04-0218-37/+97
| | | | | | | | | | Soon we're going to have three types of memory pools: POSIX shm_open() pools, memfd memfd_create() ones, and privately malloc()-ed pools. Thus introduce annotations for the memory types supported and change pa_mempool_new() into a factory method based on required memory. Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
* srbchannel: Introduce per-client SHM filesAhmed S. Darwish2016-04-023-17/+27
| | | | | | | | | | | | The PA daemon currently uses a single SHM file for all clients sending and receiving commands over the low-latency srbchannel mechanism. To avoid leaks between clients in that case, and to provide the necessary ground work later for sandboxing and memfds, create the srbchannel SHM files on a per-client basis. Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
* pulsecore: Reference count mempoolsAhmed S. Darwish2016-04-0217-20/+84
| | | | | | | | | | | | | | | | | | | In future commits, server-wide SHMs will be replaced with per-client ones that will be dynamically created and freed according to clients connections open and close. Meanwhile, current PA design does not guarantee that the per-client mempool blocks are referenced only by client-specific objects. Thus reference count the pools and let each memblock inside the pool itself, or just attached to it, increment the pool's refcount upon allocation. This way, per-client mempools will only be freed when no further component in the system holds any references to its blocks. DiscussionLink: https://goo.gl/qesVMV Suggested-by: Tanu Kaskinen <tanuk@iki.fi> Suggested-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
* pulsecore: Cache daemon shm size inside pa_coreAhmed S. Darwish2016-04-022-0/+6
| | | | | | | | | | | | The daemon `shm-size-bytes' configuration value was read, and then directly used, for creating the initial server-wide SHM files. This is fine for now, but soon, such server-wide SHMs will be replaced with per-client SHM files that will be dynamically created and deleted according to clients open and close. Thus, appropriately cache this configuration value. Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
* log: journal: Prevent duplicate values for CODE_* fieldsAhmed S. Darwish2016-03-251-0/+11
| | | | | | | | | | | | | | | | | | | | | | | sd_journal_send() implicitly add fields for the source file, function name and code line from where it's invoked. As code location fields CODE_FILE, CODE_LINE and CODE_FUNC are handled by PA's log module, we do not want the automatic values supplied by the sd_journal API. Without suppressing these, both the actual log event source and the call to sd_journal_send() will be logged: $ journalctl -b -f -o json-pretty [...] CODE_FILE : [ pulsecore/log.c, pulsecore/module.c ], CODE_LINE : [ 505, 181 ], MESSAGE : Failed to load module module-gconf CODE_FUNC : [ pa_log_levelv_meta, pa_module_load ], [...] (Commit log adapted from abrt libreport commit d1eaae97f0287f) Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>