Commit graph

7401 commits

Author SHA1 Message Date
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
Tanu Kaskinen
ce304d6208 Pass the profile object instead of the profile name to pa_card_set_profile()
When setting attribute foo, or in this case the card profile, in my
opinion the thing passed to the set_foo() function should be of the
type of foo, not a string identifier that can be used to search for
the actual foo in set_foo().

This is mostly a question of taste, but there's at least some small
benefit from passing the actual object: often the profile object is
already available when calling pa_card_set_profile(), so passing the
card name would cause unnecessary searching when pa_card_set_profile()
needs to look up the profile from the hashmap.
2013-11-29 07:25:13 +02:00
Tanu Kaskinen
bee86af3cc ucm: Add a FIXME comment about bad error handling 2013-11-29 07:21:37 +02:00
Tanu Kaskinen
d1fd31d50f idxset: Allow deep copying with pa_idxset_copy() 2013-11-29 07:14:39 +02:00
Tanu Kaskinen
5c860fe06d sink, source: Add a TODO comment about removing get_formats() 2013-11-29 07:12:16 +02:00
Scott Reeves
5ddb486a8c protocol-native: Remove written differently but functionally redundant check. 2013-11-29 06:56:10 +02:00
Tanu Kaskinen
1997f43644 source-output: Log the format negotiation result
This makes the source output code match the sink input code.
2013-11-22 19:23:48 +02:00
João Paulo Rechi Vita
b705e38a79 bluetooth: Fix crash in pa_bluetooth_discovery_get_device_by_address()
We need to check if the device information is valid first, so we don't
pass invalid strings to pa_streq().
2013-11-22 18:40:07 +02:00
João Paulo Rechi Vita
d8fb09b567 bluetooth: Check adapter address to set device_info_valid
If the adapter object has no address information the device information
should be marked as invalid.
2013-11-22 18:39:36 +02:00
Stefan Sperling
d8e2b3a78c Fix undefined behaviour in pulseaudio --start.
Don't call pthread_join() to join a thread from a different
process than the thread was created in. Doing so can lead to
undefined behaviour.

On OpenBSD, the symptom was a pulseaudio process with a single
thread waiting forever for other threads to join. Since that
process also held the autospawn lock, starting new pulseaudio
processes with --start kept failing. The problem was analyzed
with help from Philip Guenther.

This patch adds a pa_thread_free_nojoin() function which can
be used to free resources for a thread without a join, as
suggested by Tanu Kaskinen.

See https://bugs.freedesktop.org/show_bug.cgi?id=71738
2013-11-22 17:31:11 +02:00
Colin Guthrie
303cff04eb sink/source: When picking the initial ports, prefer ones that are not unavailable.
This does for sinks/source ports what f434087e42 did for card profiles.
2013-11-22 11:38:38 +02:00
Colin Guthrie
84af39f289 card: Ensure we still pick a profile even if it's unavailable.
f434087e42 introduced the potential to not select a card profile if
all the profiles were marked as unavailable.

While this is very unlikely, it's a theoretical posibility, so if the
initial choice of a profile fails, try harder.
2013-11-22 11:30:33 +02:00