Commit graph

7412 commits

Author SHA1 Message Date
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
Peter Meerwald
ff06e24eb5 modargs: Fix pa_modargs_get_sample_rate() if no "rate" is present in the modargs
see http://lists.freedesktop.org/archives/pulseaudio-discuss/2013-December/019471.html

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Reported-by: "poljar (Damir Jelić)" <poljarinho@gmail.com>
2013-12-13 13:41:06 +02:00
Arun Raghavan
9833bb460c alsa: Log some output if we disable tsched for BATCH devices 2013-12-06 06:00:15 -08:00
Peter Meerwald
345de08f2b core-util: Check that we actually have regexec before we use it
Thanks to Pierre Ossman for reporting the bug and providing an initial
fix on which this patch is based.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=69708
2013-12-06 13:30:27 +02:00
Lars-Peter Clausen
826c8f69d3 alsa: Disable timer-scheduling for PCMs with the BATCH flag
PCM Devices which have the BATCH flag set update the PCM pointer only with
period size granularity. Using timer based scheduling does not have any
advantage in this mode. For one devices which have that flag set usually update
the position pointer in software after getting the period interrupt. So
disabling the period interrupt is not possible for this kind of devices.
Furthermore writing to or reading from the buffer slice for the current period
is not possible since the position inside the buffer is not known. On the other
hand the tsched algorithm seems to get easily confused for this kind of
hardware, which results in garbled audio output. This typically means that timer
based scheduling needs to be manually disabled on systems with such devices.
Auto disabling tsched in this case allows these systems to run with the default
configuration.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2013-12-06 12:58:03 +02:00
Tanu Kaskinen
c00ba036dc card: Move pa_card_add_profile() implementation to a more logical place
The old place was in the middle of pa_card_new_data functions, which
made no sense.
2013-12-05 19:00:11 +02:00
Kenneth Perry
2ff195aaa4 bonjour-publish: Return ports in network byteorder
For DNS-SD (Bonjour) discovery, all ports should be set in network
byteorder instead of host byteorder. Without this, all ports on
little-endian systems (intel) are incorrect.

Documentation:
https://developer.apple.com/library/mac/documentation/networking/Reference/DNSServiceDiscovery_CRef/Reference/reference.html#//apple_ref/c/func/DNSServiceRegister
2013-12-05 11:21:51 +02:00
Peter Meerwald
3d425a3315 module-remap-source: Add resample_method argument
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2013-12-05 11:05:24 +02:00
Peter Meerwald
5f7dfd9b91 module-remap-sink: Add resample_method argument
the main intent is to make testing different sample rate resampling
implementations easier; so far there is only global control via
resample-method (command line argument and /etc/pulse/daemon.conf)

module-remap-*'s only purpose is resampling (comprising format conversion,
channel remapping, sample rate adjustment), it can easily be introduced
into any audio pipeline

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2013-12-05 11:04:19 +02:00
Peter Meerwald
f8e0b86592 module-sine: Add rate argument
useful for testing resampling

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2013-12-05 11:03:10 +02:00
Peter Meerwald
e74d4244a2 modules: Make use of new function pa_modargs_get_sample_rate()
by using pa_modargs_get_sample_rate() we avoid inconsistant validity
checking of the sample rate in various places

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-12-05 10:54:12 +02:00
Peter Meerwald
742b93d32c resampler: Clean up ffmpeg resampler buffering
buf in struct ffmpeg_data is reset() initially and freed, but never
actually used

when a new block is allocated ffmpeg_data->buf[c].length is used
(which is always 0) to compute the new block size

so, drop buf

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2013-12-05 10:46:47 +02:00