summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2016-07-04WIP protocol-native: Don't access pa_core structures directlyHEADmasterArun Raghavan3-62/+202
First step to allowing access control. Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-07-04pulsecore: Move pa_core structure into its own headerArun Raghavan109-74/+207
The idea is to allow some parts of the code to use pa_core as an opaque structure and access required members via API, over which we can then perform some form of access control Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-28alsa: set availability for (some) unavailable profilesTanu Kaskinen1-0/+27
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-28card: remove pa_card_new_data.active_profileTanu Kaskinen2-13/+0
It's not being used any more.
2016-06-28card: move profile selection after pa_card_new()Tanu Kaskinen8-69/+143
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-28card: don't allow the CARD_NEW hook to failTanu Kaskinen1-6/+1
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-28alsa, bluetooth: fail if user-requested profile doesn't existTanu Kaskinen2-4/+14
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-22pstream: Add rationale for pa_cmsg_ancil_data_close_fds()Ahmed S. Darwish1-3/+28
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
2016-06-22modargs: Add a mechanism to append modargsArun Raghavan2-18/+38
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-22alsa: Use pa_device_port->impl_free() for freeing port dataArun Raghavan3-23/+16
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-22device-port: Add mechanism to free implementation dataArun Raghavan2-0/+6
This will be needed if the implementation data stores pointers to additional data that needs to be freed as well.
2016-06-22sink, source, device-port: renames to distinguish latency offsetsChris Billington5-40/+40
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-22webrtc: improve comment about mic geometryTanu Kaskinen1-2/+2
The first mic channel position is not relevant for the target direction definition.
2016-06-22source: Fixed bug: pa_source_set_port() did not update the latency_offset.Chris Billington1-0/+2
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-22json: Drop refcounting of json objectsArun Raghavan4-37/+33
We don't actually use the refcounting bits. Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-22json: Add some more negative test casesArun Raghavan1-0/+3
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-22json: Add a positive test for nested objectsArun Raghavan1-0/+13
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-22json: Error out for objects and arrays that are nested too deepArun Raghavan2-10/+19
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-22json: Handle error cases while parsing numbersArun Raghavan2-1/+30
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-22json: Add overflow checks for integer and float parsingArun Raghavan2-0/+21
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-22json: Correctly handle bad strings with missing closing quotesArun Raghavan2-1/+14
Also add a test for this case. Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-22format: Drop dependency on json-cArun Raghavan5-139/+187
json-c has a symbol clash (json_object_get_type) with json-glib (which at least a number of our GNOME clients use). This patch moves to our own JSON parser so that we can avoid this kind of situation altogether. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=95135 Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-22pulse: Add a JSON-parsing libraryArun Raghavan5-0/+815
Adding this to be able to drop dependency on json-c. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=95135 Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-22pulsecore: Fix incorrect architecture mapping on sparc64.John Paul Adrian Glaubitz1-1/+1
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=95432 Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-22pulsecore: Don't allow unreferencing linked object.Juho Hämäläinen4-16/+9
Sink(-input) and source(-output) called unlink function when reference count dropped to zero. This would result in unlink hooks being called with an object having a reference count of zero, and this is not a situation we want modules to have to deal with. It is better to just remove the redundant unlinking code from sink(-input) and source(-output) and assert on reference count in unlink functions as well. It is expected that in well behaving code the owner of an object will always unlink the object before unreferencing. Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-22qpaeq: Don't set font-size on widgetsAidan Gauland1-4/+4
Setting the font-size CSS property on a widget overrides the system font-size, and since qpaeq provides no mechanism for setting the application's font-size, we should not do this. This commit also removes the font-size property from commented-out calls to setStyleSheet() so that if these are ever reinstated, this behaviour is not reintroduced. Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-22ladspa-sink: avoid to configure invalid formatKimJeongYeon1-0/+5
LADSPA allows float format only, but module-ladspa-sink possibly could be loaded with ***any*** 'format' parameter. Therefore noisy sound heard. This patch avoids to be configured as invalid format. Signed-off-by: KimJeongYeon <jeongyeon.kim@samsung.com> Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-22core-util: Improve pa_replace() behaviourUlrich Eckhardt3-0/+11
- Assert that the search string isn't empty. - Add test. - Improve documentation.
2016-06-22core-util-test: Add testsUlrich Eckhardt1-0/+230
2016-06-22core-util-test: Add boilerplateUlrich Eckhardt3-0/+53
2016-06-22pstream: fix revoke callback settingTanu Kaskinen1-2/+2
While investigating bug 95352, I noticed that pa_pstream_set_revoke_callback() and pa_pstream_set_release_callback() were identical - both set the release callback. pa_pstream_set_revoke_callback() was obviously broken - it was setting the wrong callback. The only place where set_revoke_callback() is called is in protocol-native.c. The code there looks like this: pa_pstream_set_revoke_callback(c->pstream, pstream_revoke_callback, c); pa_pstream_set_release_callback(c->pstream, pstream_release_callback, c); Since set_release_callback() is called last, the release callback gets set correctly. The only problem is that the revoke callback stays unset. What are the consequences of that? The code that calls the revoke callback looks like this: if (p->revoke_callback) p->revoke_callback(p, block_id, p->revoke_callback_userdata); else pa_pstream_send_revoke(p, block_id); So the intended callback is replaced with a pa_pstream_send_revoke() call. What does the intended callback, that doesn't get called, do? if (!(q = pa_thread_mq_get())) pa_pstream_send_revoke(p, block_id); else pa_asyncmsgq_post(q->outq, PA_MSGOBJECT(userdata), CONNECTION_MESSAGE_REVOKE, PA_UINT_TO_PTR(block_id), 0, NULL, NULL); So the native protocol's revoke callback is anyway going to call pa_pstream_send_revoke() when called from the main thread. If the revoking is done from an IO thread, an asynchronous message is sent to the main thread instead, and the message handler will then call pa_pstream_send_revoke(). In conclusion, the only effect of this bug was that pa_pstream_send_revoke() was sometimes being called from an IO thread when it should have been called from the main thread. I don't know if this caused the crash in bug 95352. Probably not.
2016-06-22alsa: reread configuration when opening new devicesAlexander E. Patrakov3-0/+26
If a card has been hot-plugged after pulseaudio start, alsa-lib still has old configuration in memory, which doesn't have PCM definitions for the new card. Thus, this error appears, and the device doesn't work: I: [pulseaudio] (alsa-lib)confmisc.c: Unable to find definition 'cards.USB-Audio.pcm.front.0:CARD=0' I: [pulseaudio] (alsa-lib)conf.c: function snd_func_refer returned error: No such file or directory I: [pulseaudio] (alsa-lib)conf.c: Evaluate error: No such file or directory I: [pulseaudio] (alsa-lib)pcm.c: Unknown PCM front:0 I: [pulseaudio] alsa-util.c: Error opening PCM device front:0: No such file or directory The snd_config_update_free_global() function makes alsa-lib forget any cached configuration and reparse all PCM definitions from scratch next time it is told to open anything. The trick has been copied from Phonon. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=54029 Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
2016-06-22allow-passthrough: Use pa_module_hook_connect()Arun Raghavan1-19/+4
Signed-off-by: Arun Raghavan <git@arunraghavan.net>
2016-06-22allow-passthrough: Add module to allow passthrough streams always go throughGuillaume Desmottes2-2/+337
For various use-cases a passthrough stream should have priority over all other streams and get exclusive access to the sink regardless of whether any other streams are playing. An example use-case is ensuring Kodi can successfully start video playback (with passthrough) even if an external notification sound happened to be playing at the same time. Signed-off-by: Arun Raghavan <git@arunraghavan.net>
2016-06-22client, protocol-native: Use macros for protocol version/flag accessArun Raghavan3-12/+18
This makes it easier to read and cleaner in general.
2016-06-21sink-input,source-output: Fix crasher while setting propertyArun Raghavan2-2/+2
We were missing a case where a property is first set, and then cleared by setting a NULL value. Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-21pstream: Fix use of uninitialized value: ancillary fd cleanup flagAhmed S. Darwish1-1/+1
As reported by valrgrind ==30002== Conditional jump or move depends on uninitialised value(s) ==30002== at 0x5CB883C: pa_cmsg_ancil_data_close_fds (pstream.c:193) ==30002== by 0x5CBB161: do_write (pstream.c:759) ==30002== by 0x5CB8B51: do_pstream_read_write (pstream.c:233) ==30002== by 0x5CB8EE8: io_callback (pstream.c:279) ... The pa_cmsg_ancil_data structure has two main guards: 'creds_valid', which implies that it holds credentials information, and 'nfd', which implies it holds file descriptors. When code paths create a credentials ancillary data structure, they just set the 'nfd' guard to zero. Typically, the rest of pa_cmsg_ancil_data fields related to fds are _all_ left _uninitialized_. pa_cmsg_ancil_data_close_fds() has broken the above contract: it accesses the new 'close_fds_on_cleanup' flag, which is related to file descriptors, without checking the 'nfd == 0' guard first. Fix this inconsistency. Reported-by: Alexander E. Patrakov <patrakov@gmail.com> Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com> Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-21shm: Fix use of uninitialized value: segment's shared-memory typeAhmed S. Darwish1-7/+7
As shown by valgrind ==10615== Conditional jump or move depends on uninitialised value(s) ==10615== at 0x5CC0483: shm_marker_size (shm.c:97) ==10615== by 0x5CC1685: shm_attach (shm.c:381) ==10615== by 0x5CC1990: pa_shm_cleanup (shm.c:453) ==10615== by 0x5CC068E: sharedmem_create (shm.c:150) ... Solution is to fix the shm_marker_size() signature itself: At certain code paths like shm_attach(), we don't want to initialize _any_ field in the passed SHM segment descriptor except after making sure all error exit conditions have been passed. Reported-by: Alexander E. Patrakov <patrakov@gmail.com> Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com> Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-05-29dbus: Deal with double-counting module-dbus-protocolArun Raghavan1-0/+8
We ended up dealing with it once in module init, and once more in the new module callback. Avoiding it in the second case by name seems to be the cleanest solution (else, we need to store the module index somewhere in pa_dbusiface_core, which seems about as bad). Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-05-29dbus: fix crash on LoadModule()Tanu Kaskinen1-14/+11
Commit ae415b07a07c9fe70714d01c91980edb25d966de ("dbus: Use hooks for module new and removed events") changed the new module monitoring from the asynchronous subscription system. Previously handle_load_module() created the new pa_dbusiface_module object before we got a notification of the loading of the module, but now we get the notification already within the pa_module_load() call. That resulted in a crash, because the module_new_cb() created the pa_dbusiface_module object before pa_module_load() returned, and then handle_load_module() would create another pa_dbusiface_module object for the same module. This patch removes the pa_dbusiface_module_new() call from handle_load_module(). module_new_cb() is now responsible for all pa_dbusiface_module object creations, except the ones that are created during the initialization of module-dbus-protocol. Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-05-27resampler: Fix leaking lfe filter on init failureBarun Kumar Singh1-0/+2
Fix memory leak in pa_resampler_new() in resampler.c, Deallocating memory of r->lfe_filter in case of fail. Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-05-24Disable LFE remixing by defaultAlexander E. Patrakov3-6/+6
The current LFE crossover filter removes low frequencies from the main channels and puts them into the LFE channel with the wrong amplitude. It is not known for sure what is the correct relative amplitude (acoustic measurements are required with real hardware), and changing that might introduce a new bug, "it clips the LFE channel". So just disable the feature by default until a better understanding emerges how it should work. This, essentially, returns the defaults to their state as of PulseAudio 6.0. Some more observations: - Most of available active analog speakers on the market do the necessary crossover filtering already, and HDMI receivers can be configured to do that, too, so a crossover filter in PulseAudio is harmful in these use cases. - The "laptop with a builtin subwoofer" use case requires manual configuration anyway because the default crossover frequency (120 Hz) is wrong for laptop speakers. - Finally, Windows 10 with a built-in USB audio driver does not synthesize the LFE channel given a 5.1 card and a stereo audio stream by default. Hides: https://bugs.freedesktop.org/show_bug.cgi?id=95021 Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
2016-05-13resampler: Fix a memory leak in pa_resampler_ffmpeg_init()Sachin Kumar Chauhan1-1/+3
ffmpeg_data was not freed properly before return due to error. It is now freed properly. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=95347 Signed-off-by: Sachin Kumar Chauhan <sachin.kc@samsung.com> Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-05-11module-filter-apply: Fix stale m-d-m property name in commentArun Raghavan1-2/+2
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-05-11alsa: Reread and upate jack status when a card is unsuspendedArun Raghavan3-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>
2016-05-10alsa: ignore jack events when the user is inactiveTanu Kaskinen3-0/+35
See the big comment in the code for more details. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=93259
2016-05-10module-filter-apply: Fix a memory leakSachin Kumar Chauhan1-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>
2016-05-07module-device-manager: Refine logic to ignore filtered streamsArun Raghavan2-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>
2016-05-07module-filter-apply: Don't implement policy in module-device-managerArun Raghavan2-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>
2016-05-06module-filter-apply: Remove some dead codeArun Raghavan1-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>