Commit graph

7423 commits

Author SHA1 Message Date
Tanu Kaskinen
30a32d35c8 core-format: Add pa_format_info_to_sample_spec2()
The function will be used in pa_sink_input_new() and
pa_source_output_new(). The fallback parameters are used to merge the
data in the format info with the sink/source sample spec and channel
map, when the format info is lacking some information.
2014-01-08 21:26:39 +02:00
Tanu Kaskinen
dfa3c50700 format: Simplify pa_format_info_to_sample_spec() 2014-01-08 21:26:39 +02:00
Tanu Kaskinen
3a5a0f6652 core-format: Add pa_format_info_get_channel_map() 2014-01-08 21:26:39 +02:00
Tanu Kaskinen
066dd942aa core-format: Add pa_format_info_get_channels()
This also fixes an issue in pa_format_info_to_sample_spec(): it did
no validation for the channels value. Now the validation is taken care
of in pa_format_info_get_channels().
2014-01-08 21:26:39 +02:00
Tanu Kaskinen
85a3f560d1 core-format: Add pa_format_info_get_rate()
This also fixes an issue in pa_format_info_to_sample_spec(): it did
no validation for the rate value. Now the validation is taken care of
in pa_format_info_get_rate().
2014-01-08 21:26:39 +02:00
Tanu Kaskinen
eae16f41a4 core-format: Add pa_format_info_get_sample_format() 2014-01-08 21:26:39 +02:00
Tanu Kaskinen
d2c9b46aca Move pa_format_info_to_sample_spec_fake() to core-format
I will need to use the function from outside libpulse.

I added the channel map argument, because the function will be called
from another function that is expected to initialize the channel map.
I don't know if it's in practice necessary, but it shouldn't do any
harm either.
2014-01-08 21:26:38 +02:00
Tanu Kaskinen
27e47c72a2 volume-test: Increase the allowed number of rouding errors
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=72374
2014-01-03 14:15:31 +02:00
Laurentiu Nicola
bef191be82 module-rtp-recv: Add an argument for latency 2014-01-03 13:39:27 +02:00
Tanu Kaskinen
11e71e3990 caps: Remove the FreeBSD implementation of pa_drop_caps()
Quoting Ryan Lortie from [1]:

I assumed from my reading of the Linux code ("cap_clear()...") that it
was clearing all capabilities of the process when in fact it is only
clearing the "special to root" capabilities.

The FreeBSD version of the code indeed clears _all_ capabilities beyond
ones that the process already has (ie: cannot open any new files, create
sockets, etc.)

This has a pretty obvious adverse effect on pulseaudio's ability to do
what it needs to do -- indeed, it bombs out pretty quickly due to an
inability to read its own config file.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=72580#c11
2014-01-03 13:31:29 +02:00
poljar (Damir Jelić)
c307093cf0 alsa-mixer: Free the description key in alsa_path_free(). 2014-01-03 13:17:08 +02:00
poljar (Damir Jelić)
f7afaa2644 bluez5-util: Free the adapter_path in device_free(). 2014-01-03 13:16:07 +02:00
Alexander E. Patrakov
3535fd7a07 Documentation of known misuse of PulseAudio API
Hello.

Over time, I became aware of several instances of tempting but
semantically incorrect usage of PulseAudio API (one from my own bad
proposal of "improving" Wine, one from Parole media player and one
from Webkit-GTK). I want to document these gotchas so that other
developers don't fall for that. See the attached patch.

I have checked that the rendered HTML is correct, but need someone to
confirm the factual accuracy of the proposed changes and, possibly, to
improve the wording.

--
Alexander E. Patrakov
2014-01-03 12:53:07 +02:00
Tanu Kaskinen
4c5ec015a4 caps: Fix platform checking
The "#elif __FreeBSD__" line caused a warning, because __FreeBSD__ was
not defined.
2013-12-30 14:31:33 +02:00
Tanu Kaskinen
337ad25b17 caps: Improve log message
I don't like the expression "this Pulseaudio" (even though that's
originally written by me), just "PulseAudio" is enough. Also, on
FreeBSD there's no libcap, so let's refer only to "capabilities".
2013-12-20 21:54:22 +02:00
Ryan Lortie
1da34e99b2 Add support for FreeBSD <sys/capability.h>
cap_init() and friends are Linux-specific, so only use them if we're on
Linux.

Add support for FreeBSD capabilities if we find <sys/capability.h> to be
available there.

Add an #else (not Linux or FreeBSD) case with an #error requesting
contributions for other platforms.

This patch keeps the cap_init check in configure.ac but removes the
error if it fails.  This will ensure we link to -lcap if needed, but
won't fail for the case that capabilities are part of the core system
(as on FreeBSD).

We do however, modify the header check to ensure we fail if there is no
<sys/capability.h> at all and we are on a system where it could be
installed.  The logic here is that it is better to give the user the
chance to install it than it is to proceed silently with a disabled
security feature on a system where it could easily be supported.
--without-caps remains an option if the user wants to force it.

https://bugs.freedesktop.org/show_bug.cgi?id=72580
2013-12-20 21:48:50 +02:00
Tanu Kaskinen
5d2d9e5700 sink-input: Fix volume_factor_sink initialization
Source outputs handle volume_factor_source in a bit different way,
which is why this bug doesn't affect source outputs.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=72879
2013-12-20 16:10:53 +02:00
poljar (Damir Jelić)
d20ee7e7f2 log: Add support for the systemd journal
The journal is a component of systemd, that captures Syslog messages,
Kernel log messages, initial RAM disk and early boot messages as well
as messages written to STDOUT/STDERR of all services, indexes them and
makes this available to the user.

It can be used in parallel, or in place of a traditional syslog daemon,
such as rsyslog or syslog-ng.

The journal offers a couple of improvements over traditional logging
facilities (e.g. advanced filtering capabilities).

This patch adds support for logging directly to the journal using its
native API.
2013-12-20 13:06:04 +01:00
Peter Meerwald
a8fea5c468 modules: Add assertion in equalizer-sink
discovered by coverity

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:55:17 +01:00
Peter Meerwald
25101b299d core: Fix check for io->output_event in enable_events()
copy-pase error discovered by coverity

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:55:17 +01:00
Peter Meerwald
402da5285a core: Remove dead code in pa_mainloop_run()
while ((r = pa_mainloop_iterate(m, 1, retval)) >= 0)
        ;

     if (r == -2)
         return 1;
     else if (r < 0)
        return -1;
     else
        return 0;

the last else is never reached, discovered by coverity

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:55:17 +01:00
Peter Meerwald
67dc1a5a0b modules: Remove dead code in position-event-sounds
ma is always NULL in fail path, discovered by coverity

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:55:17 +01:00
Peter Meerwald
e8ea0b8a79 core: Use after free in pa_sink_input_new_data_set_formats() and pa_source_output_new_data_set_formats()
intention is to free old data_req->formats before assigning
new formats, discovered by coverity

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:55:17 +01:00
Peter Meerwald
4515f5d2ff tests: Fix resource leak in sigbus-test
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:55:17 +01:00
Peter Meerwald
5196453117 modules: Remove redundant code in virtual-surround-sink
https://scan7.coverity.com:8443/reports.htm#v10206/p10016/fileInstanceId=8788&defectInstanceId=3710&mergedDefectId=591297

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:55:17 +01:00
Peter Meerwald
94deb3725d core: Fix asserting command in protocol-native
https://scan7.coverity.com:8443/reports.htm#v10206/p10016/fileInstanceId=8690&defectInstanceId=3688&mergedDefectId=591259

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:55:17 +01:00
Peter Meerwald
d3cddfed5c modules: Fix uninit value in rtp-send
https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8803&defectInstanceId=3705&mergedDefectId=591292&eventIds=3705-36&eventId=3705-36

see http://silviocesare.wordpress.com/2007/10/22/setting-sin_zero-to-0-in-struct-sockaddr_in/

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:55:17 +01:00
Peter Meerwald
e11b699d45 core: Fix uninit pointer read in protocol-native
https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8690&defectInstanceId=3703&mergedDefectId=591290&eventIds=3703-7&eventId=3703-7

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:55:17 +01:00
Peter Meerwald
7fca92627b modules: Fix resource leak in card-restore
https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8728&defectInstanceId=3737&mergedDefectId=591274

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:55:17 +01:00
Peter Meerwald
9d3d732a63 modules: Fix resource leak in raop_client
https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8899&defectInstanceId=3735&mergedDefectId=591272

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:55:05 +01:00
Peter Meerwald
7978baaf81 modules: Fix resource leak in tunnel-sink-new
https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8770&defectInstanceId=3733&mergedDefectId=591270

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:54:19 +01:00
Peter Meerwald
ff9e9e05df core: Fix resource leak in core-util
https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8477&defectInstanceId=3693&mergedDefectId=591269

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:54:18 +01:00
Peter Meerwald
c2e9f1fdec modules: Fix resource leak in oss
https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8824&defectInstanceId=3731&mergedDefectId=591267

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:54:18 +01:00
Peter Meerwald
9a341c6b36 modules: Fix resource leak in alsa-ucm
https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8833&defectInstanceId=3732&mergedDefectId=591268

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:54:18 +01:00
Peter Meerwald
a4b8a9d5a2 modules: Fix resource leak in device-restore
https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8724&defectInstanceId=3728&mergedDefectId=591265

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:54:18 +01:00
Peter Meerwald
cfce437e47 modules: Fix resource leak in alsa-card
https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8851&defectInstanceId=3725&mergedDefectId=591261

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:54:18 +01:00
Peter Meerwald
bbed792cdf modules: Fix resource leak in stream-restore
https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8726&defectInstanceId=3724&mergedDefectId=591260

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:54:18 +01:00
Jan Alexander Steffens (heftig)
8fa5bdc087 thread-mq: Initialize thread_mainloop to NULL if not in use
Fixes a crash when unloading module-zeroconf-publish.

Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
2013-12-20 12:52:31 +02:00
Peter Meerwald
a247f7c581 simple: Enable pa_simple_flush() on record streams and amend documentation
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:50:23 +02:00
Peter Meerwald
586324f0fc doc: Document that pa_stream_flush() is applicable to playback and record streams
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:49:49 +02:00
Peter Meerwald
ca2ec3a8ef doc: Document that pa_simple_get_latency() can be used on record streams as well
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:49:27 +02:00
Peter Meerwald
acc5c29018 doc: Refer to seek parameter of pa_stream_write() in description of pa_stream_flush()
pa_stream_write() has no delta parameter, but a seek parameter

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:49:04 +02:00
Peter Meerwald
05a128c8f7 doc: Fix reference to pa_threaded_mainloop
Generating docs for file mainloop-api.h...
/home/pmeerw/src/pa-missing/src/pulse/mainloop-api.h:118: warning: Found unknown command `\pa_threaded_mainloop'

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-20 12:48:41 +02:00
Tanu Kaskinen
2747c96101 Add pa_channels_valid()
I think this makes the code a bit nicer to read and write. This also
reduces the chances of off-by-one errors when checking the bounds of
channel count values.
2013-12-15 11:44:35 +01:00
Tanu Kaskinen
a67318f8af Add pa_sample_rate_valid()
I think this makes the code a bit nicer to read and write. This also
reduces the chances of off-by-one errors when checking the bounds of
sample rate values.
2013-12-15 11:21:56 +01:00
Tanu Kaskinen
1cda717252 Add pa_sample_format_valid()
I think this makes the code a bit nicer to read and write. This also
reduces the chances of off-by-one errors when checking the bounds of
the sample format value.
2013-12-15 11:07:17 +01:00
Tanu Kaskinen
643eb5bae2 bluetooth: Fix profile priority comparison
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=72414
2013-12-14 09:34:21 +02:00
Ryan Lortie
6f954c7674 core-util: set_scheduler: check for RLIMIT_RTTIME
set_scheduler() assumes that if sys/resource.h was found then we will
find RLIMIT_RTTIME there, but this is a non-POSIX extension on Linux.

Change the check to ensure that RLIMIT_RTTIME is actually defined.
Linux indeed defines this as a macro, and POSIX specifies that the other
RLIMIT_ constants must be macros, so having this as an #ifdef seems
correct.
2013-12-13 14:00:14 +02:00
Ryan Lortie
1588212d5a bootstrap.sh: use /usr/bin/env to find bash
bootstrap.sh uses some non-POSIX features of bash, so we can't use
/bin/sh.  Unlike /bin/sh, bash can be installed anywhere in the path, so
we should use /usr/bin/env to find it.

This helps systems that have bash in /usr/local/bin, for example.
2013-12-13 13:57:41 +02:00
Peter Meerwald
0828701146 modargs: Do not modify alternate_rate in pa_modargs_get_alternate_sample_rate() on failure
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-13 13:43:31 +02:00