summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* replace sink/source SET_STATE handlers with callbacksTanu Kaskinen2018-03-1625-633/+849
| | | | | | | | | | | | | | | | | | | | | | | 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.
* oss: don't fail resume if trigger() failsTanu Kaskinen2018-03-161-32/+27
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* sink, source: rename set_state() to set_state_in_main_thread()Tanu Kaskinen2018-03-1617-54/+56
| | | | | 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.
* bluetooth: fix resume error handlingTanu Kaskinen2018-03-072-26/+14
| | | | | | | 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.
* null-sink, pipe-sink: some state variable cleanupsTanu Kaskinen2018-02-232-5/+5
| | | | | | | | | | 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.
* alsa: add a couple of FIXME commentsTanu Kaskinen2018-02-232-0/+6
| | | | | | | 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.
* alsa, solaris, oss: remove unnecessary error handling when suspendingTanu Kaskinen2018-02-234-36/+16
| | | | Suspending never fails.
* sink: don't sync monitor suspend state when unlinkingTanu Kaskinen2018-02-221-1/+1
| | | | | | | 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.
* pass pa_suspend_cause_t to set_state() callbacksTanu Kaskinen2018-02-2217-27/+58
| | | | | | | | 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.
* sink, source: redo state changing codeTanu Kaskinen2018-02-222-103/+150
| | | | | | | | | | | | | | | | | | | | | | 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.
* alsa-mixer: autodetect the ELD deviceTanu Kaskinen2018-02-1311-12/+41
| | | | | | | | 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
* alsa-mixer: autodetect the HDMI jack PCM deviceTanu Kaskinen2018-02-1313-16/+73
| | | | | | | 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
* alsa-mixer: add hw_device_index to pa_alsa_mappingTanu Kaskinen2018-02-132-0/+30
| | | | | | | | | | | | | 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
* filter-apply: Ignore monitor source of filter in find_paired_master()Georg Chini2018-02-101-0/+6
| | | | | | | | | | | | 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.
* memfd-wrappers: only define memfd_create() if not already definedTanu Kaskinen2018-01-311-3/+4
| | | | | | | | | 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
* daemon: don't re-exec if the linker supports the -z,now optionVivek Dasmohapatra2018-01-261-1/+1
| | | | | | | | | | 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
* build-sys: don't install esdcompat tool if building without esound supportFelipe Sateler2018-01-241-1/+5
|
* bluetooth: don't send unsolicted replies to the endpoint Release() callTanu Kaskinen2018-01-211-3/+18
| | | | | | | | | | | | | | | | | | 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
* pipe-sink: use existing fifoSamo Pogačnik2018-01-181-4/+11
| | | | | | 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.
* alsa-mixer: add another hardware ID for Traktor Audio 6Tanu Kaskinen2018-01-111-0/+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!
* pipe-sink: new option "use_system_clock_for_timing"Samo Pogačnik2018-01-041-12/+221
| | | | | Using this option, even the simplest tools like "cat" can properly dump raw audio from the pipe.
* switch-on-port-available: remove unused return valuesTanu Kaskinen2018-01-041-9/+6
|
* build-sys: fix PA_MODULE_NAME for module-default-device-restoreTanu Kaskinen2018-01-031-1/+1
|
* sink, source: improve suspend cause loggingTanu Kaskinen2018-01-035-15/+80
| | | | | | | | Previously the suspend cause was logged as a hexadecimal number, now it's logged as a human-friendly string. Also, the command line interface handled only a subset of causes when printing them, now all suspend causes are printed.
* sink, source: improve state change loggingTanu Kaskinen2018-01-035-36/+34
| | | | | Now the old and new state is logged every time when the sink or source state changes.
* alsa: fix infinite loop with Intel HDMI LPETanu Kaskinen2018-01-034-0/+58
| | | | | | | | | | | | | | The Intel HDMI LPE driver works in a peculiar way when the HDMI cable is not plugged in: any written audio is immediately discarded and underrun is reported. That resulted in an infinite loop, because PulseAudio tried to keep the buffer filled, which was futile since the written audio was immediately consumed/discarded. This patch adds special handling for the LPE driver: if the active port of the sink is unavailable, the sink suspends itself. A new suspend cause is added: PA_SUSPEND_UNAVAILABLE. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=100488
* build-sys: Stop using symdef headers for modulesArun Raghavan2017-12-1289-410/+124
| | | | | | This removes the symdef header generation m4 magic in favour of a simpler macro method, allowing us to skip one unnecessary build step while moving to meson, and removing an 11 year old todo!
* map-file: add pa_encoding_from_stringTanu Kaskinen2017-12-121-0/+1
| | | | | | | | The function is declared in pulse/format.h and it has Doxygen documentation, which tells me that the intention was to make the function available to clients. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=103806
* qpaeq: port to PyQt5Andrius Štikonas2017-12-121-34/+34
|
* filter-apply: Eliminate nested and redundant hook eventsKimJeongYeon2017-12-091-0/+10
| | | | | | | | | In proces(), the do_move() function calls pa_{sink_input,source_output}_set_property(). This triggers a call to {sink_input,source_output}_proplist_cb() which called process() a second time. This patch avoids the duplicate and nested call to process() by checking if PA_PROP_FILTER_APPLY_MOVING is set in {sink_input,source_output}_proplist_cb().
* ladspa-sink: add module argument to set sink input propertiesRoliga2017-12-081-0/+9
| | | | | | | This patch adds a sink_input_properties argument to module-ladspa-sink, which can be helpful for customizing the appearance of the sink input in various volume control applications, or to differentiate between multiple instances of the module.
* augment-properties: fix a memory leakTanu Kaskinen2017-12-081-4/+9
| | | | | | | If the desktop file is not found, fn was not being freed after the last loop iteration. CID: 1462477
* core-util, cpu-x86: use __get_cpuid() instead of homegrown assemblyTanu Kaskinen2017-12-073-47/+37
| | | | | | | | | | | | | | | The get_cpuid() function in cpu-x86.c was buggy on x86-64. When building without optimizations, the homegrown assembly code overwrote the beginning of the function argument list on the stack. That happened to work fine on regular x86-64, but caused crashing with the x32 ABI. At least GCC and clang provide cpuid.h, which has the __get_cpuid() function that can be used instead of the homegrown assembly. The PA_REG_* constants can be removed as well, because they're not used any more. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=103656
* client-conf: Add a default value for disable-memfdArun Raghavan2017-12-041-0/+1
| | | | This got missed while adding the client option.
* sink, source: Don't finish move if unlink happens after pa_*_move_all_start()Georg Chini2017-12-032-4/+8
| | | | | | | | | | | | When a sink input was unlinked between the calls to pa_sink_move_all_start() and pa_sink_move_all_finish(), pa_sink_move_all_finish() tried to finish the move of the already unlinked sink input, which lead to an assertion in pa_sink_input_finish_move(). The same applies for the source side. This patch fixes the problem by checking the state of the sink input or source output in pa_*_move_all_finish(). Bug report: https://bugs.freedesktop.org/show_bug.cgi?id=103752
* switch-on-connect: add option to ignore virtual sinks/sourcesGeorg Chini2017-12-031-0/+17
| | | | | | | | | | module-switch-on-connect would switch to any new sink, even if the sink was a filter or a null-sink. This patch adds a command line option ignore_virtual to the module, which lets module-switch-on-connect ignore virtual sinks and sources. The flag is true by default because the purpose of the module is to switch to new hardware when it becomes available.
* device-manager: don't override application routing requestsTanu Kaskinen2017-12-021-2/+4
| | | | | | | | | module-device-manager doesn't change the routing of those streams that have been explicitly routed by the user, which is good. Similarly, it should leave those streams alone whose routing was decided by the application that created the stream. This patch implements that. BugLink: https://github.com/wwmm/pulseeffects/issues/99
* sink-input, source-output: add sink/source_requested_by_application flagTanu Kaskinen2017-12-0227-42/+72
| | | | | | | | | | | | | | | | | When a stream is created, and the stream creator specifies which device should be used, that can affect automatic routing policies. Specifically, module-device-manager shouldn't apply its priority list routing when a stream has been routed by the application that created the stream. A stream that was initially routed by the application may be moved for some valid reason (e.g. user requesting a move, or the original device disappearing). When the stream is moved away from its initial device, the "device requested by application" flag isn't relevant any more, so it's set to false and never reset to true again. The change in module-device-manager's routing logic will be done in the following patch.
* augment-properties: support XDG_DATA_DIRS when find desktop filesIceyer2017-11-301-25/+53
|
* sconv-s16be: declaration/implementation mismatchesConstantine Kharlamov2017-11-301-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes the following compiler errors: ./pulsecore/sconv-s16be.h:41:6: warning: type of 'pa_sconv_s24_32be_from_float32ne' does not match original declaration [-Wlto-type-mismatch] void pa_sconv_s24_32be_from_float32ne(unsigned n, const float *a, uint8_t *b); ^ pulsecore/sconv-s16le.c:413:6: note: 'pa_sconv_s24_32be_from_float32ne' was previously declared here void pa_sconv_s24_32le_from_float32ne(unsigned n, const float *a, uint32_t *b) { ^ pulsecore/sconv-s16le.c:413:6: note: code may be misoptimized unless -fno-strict-aliasing is used ./pulsecore/sconv-s16be.h:40:6: warning: type of 'pa_sconv_s24_32be_to_float32ne' does not match original declaration [-Wlto-type-mismatch] void pa_sconv_s24_32be_to_float32ne(unsigned n, const uint8_t *a, float *b); ^ pulsecore/sconv-s16le.c:388:6: note: 'pa_sconv_s24_32be_to_float32ne' was previously declared here void pa_sconv_s24_32le_to_float32ne(unsigned n, const uint32_t *a, float *b) { ^ pulsecore/sconv-s16le.c:388:6: note: code may be misoptimized unless -fno-strict-aliasing is used ./pulsecore/sconv-s16be.h:56:6: warning: type of 'pa_sconv_s24_32be_from_s16ne' does not match original declaration [-Wlto-type-mismatch] void pa_sconv_s24_32be_from_s16ne(unsigned n, const int16_t *a, uint8_t *b); ^ pulsecore/sconv-s16le.c:365:6: note: 'pa_sconv_s24_32be_from_s16ne' was previously declared here void pa_sconv_s24_32le_from_s16ne(unsigned n, const int16_t *a, uint32_t *b) { ^ pulsecore/sconv-s16le.c:365:6: note: code may be misoptimized unless -fno-strict-aliasing is used ./pulsecore/sconv-s16be.h:55:6: warning: type of 'pa_sconv_s24_32be_to_s16ne' does not match original declaration [-Wlto-type-mismatch] void pa_sconv_s24_32be_to_s16ne(unsigned n, const uint8_t *a, int16_t *b); ^ pulsecore/sconv-s16le.c:342:6: note: 'pa_sconv_s24_32be_to_s16ne' was previously declared here void pa_sconv_s24_32le_to_s16ne(unsigned n, const uint32_t *a, int16_t *b) { ^ pulsecore/sconv-s16le.c:342:6: note: code may be misoptimized unless -fno-strict-aliasing is used Signed-off-by: Constantine Kharlamov <Hi-Angel@yandex.ru>
* merge and deduplicate some pa_buffer_attr documentationjnqnfe2017-11-302-78/+44
|
* api documentation improvementsjnqnfe2017-11-3015-143/+205
| | | | includes typo fixes, neatening, addition of more return info, and such.
* volume: slight simplification of codejnqnfe2017-11-291-9/+9
|
* volume: pa_cvolume_scale_mask: constify paramjnqnfe2017-11-292-2/+2
|
* build-sys: add the Dell dock TB16 configurationHui Wang2017-11-231-1/+2
| | | | Signed-off-by: Hui Wang <hui.wang@canonical.com>
* echo-cancel: fix a memory leakTanu Kaskinen2017-11-211-1/+4
| | | | The pa_echo_canceller_msg object was never unreffed.
* echo-cancel: ignore remaining canceller messages after the module has been ↵Tanu Kaskinen2017-11-211-0/+19
| | | | | | | | | unloaded Not ignoring the messages caused crashing due to accessing the userdata after it had been freed. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=103528
* card-restore: don't restore unavailable profilesTanu Kaskinen2017-11-211-2/+6
|
* card-restore: log the correct profile nameTanu Kaskinen2017-11-211-1/+1
|
* remap-source, virtual-source: fix max_rewind handlingTanu Kaskinen2017-11-062-0/+24
| | | | | | The filter sources should have the same max_rewind as the master source, but these modules didn't update max_rewind when the master max_rewind changed.