Commit graph

7486 commits

Author SHA1 Message Date
Laurentiu Nicola
88abd6c49e rtp-recv: Only try adding the group membership for multicast addresses 2014-01-10 13:02:50 +02:00
Tanu Kaskinen
25b7b39367 caps: Use standard macro when checking for Linux
linux and __linux are non-standard, according to
http://sourceforge.net/p/predef/wiki/OperatingSystems/

Reported-By: Damir Jelić <poljarinho@gmail.com>
2014-01-10 12:41:00 +02:00
Peter Meerwald
56e578c310 alsa-card: Don't free the modargs in pa__init
The modargs are in both cases (a succesfull as well as a failed module
initialization) freed already in pa__done().

To avoid leaking modargs memory before they are assigned to u->modargs, the
code is reorganized to first allocate userdata, and then allocate the modargs.
Local variable ma is not needed anymore.

discussion here
http://lists.freedesktop.org/archives/pulseaudio-discuss/2013-December/019661.html

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Reported-by: poljar (Damir Jelić) <poljarinho@gmail.com>
2014-01-10 12:32:36 +02:00
Tanu Kaskinen
56e007ebfb format: Add some error logging 2014-01-08 21:32:02 +02:00
Tanu Kaskinen
fdf72d3d21 stream: Mention pa_stream_new_extended() in the high-level stream creation documentation 2014-01-08 21:32:02 +02:00
Tanu Kaskinen
a36bf31cae stream: Improve pa_stream_connect_playback() documentation 2014-01-08 21:32:02 +02:00
Tanu Kaskinen
77ebb6567f def, format: Document how to leave PCM parameters to be decided by the server 2014-01-08 21:32:02 +02:00
Tanu Kaskinen
f41650a550 sink-input, source-output: Interpret missing PCM parameters in format info as a request to decide those parameters at the server end
The "fix flags" (PA_SINK_INPUT_FIX_FORMAT etc.) don't work properly
with the pa_stream_new_extended() interface. This patch fixes it so
that the same effect can be achieved by leaving some of the PCM
parameters unspecified in format info objects. Also, when converting
a sample spec to a format info when using the old pa_stream_new()
interface, the "fix flags" are taken into account in that conversion.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=68952
2014-01-08 21:26:40 +02:00
Tanu Kaskinen
d27a650cd5 stream: Remove a volume channel validity check
The check is done for clients that use pa_stream_new() but not for
clients that use pa_stream_new_extended(). This is inconsistent. We
could check that the volume channels match the channels set in the
format info struct that is passed to pa_stream_new_extended(), but
that doesn't work if the format info doesn't contain the channel
information (that can happen if the client wants the server to choose
the channel count for the stream). And it should also be possible to
pass a mono volume for a multi-channel stream. The check could be
extended to handle all these cases, but I don't see much point in
wasting time on that. The server will anyway validate the stream
parameters, it's not particularly important to fail already when the
stream is being created at the client side.
2014-01-08 21:26:40 +02:00
Tanu Kaskinen
6cdb569b83 stream-util: Add pa_stream_get_volume_channel_map()
The new function isn't used yet, but it soon will.
2014-01-08 21:26:40 +02:00
Tanu Kaskinen
a3a795ef3d format, core-format: Constify some function parameters 2014-01-08 21:26:40 +02:00
Tanu Kaskinen
71816ecb7f sink-input, source-output: Do routing related validity checks immediately after routing
It's more logical that way.
2014-01-08 21:26:40 +02:00
Tanu Kaskinen
d78d8246b4 core-format: Add pa_format_info_from_sample_spec2()
The function will be used in pa_sink_input_new() and
pa_source_output_new() to convert the sample spec given by the client
to a format info object. The set_format, set_rate and set_channels
will be set according to the stream flags (PA_SINK_INPUT_FIX_FORMAT
etc.).
2014-01-08 21:26:39 +02:00
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