Commit graph

7486 commits

Author SHA1 Message Date
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
Tanu Kaskinen
e9d760b555 bluetooth: Set device_info_valid to -1 when the device's adapter disappears
When parsing device properties, missing adapter will result in
device_info_valid being set to -1. It is then logical that if the
adapter goes missing at a later point, device_info_valid gets set to
-1 also in that situation.
2013-11-20 15:49:10 +02:00
Tanu Kaskinen
e2dea40f4a bluetooth: Remove device_remove_all()
The function did two things: set device_info_valid to -1 and called
device_free() for each device in the hashmap. Setting
device_info_valid to -1 was unnecessary. The main purpose of that was
to fire DEVICE_CONNECTION_CHANGED as a side effect, but that hook is
fired anyway in device_free(), as a side effect of removing all
transports. Calling device_free() can be delegated to pa_hashmap, when
freeing or emptying it.
2013-11-20 15:49:06 +02:00
Tanu Kaskinen
454ca62b23 bluetooth: Fire DEVICE_CONNECTION_CHANGED in set_device_info_valid()
Normally DEVICE_CONNECTION_CHANGED is fired when the first transport
becomes connected, but it may happen that the first transport becomes
connected already before the device properties have been received. In
that case the hook should be fired at the time the device properties
are received. This patch makes the hook to be fired at the right time.
2013-11-20 15:49:01 +02:00
Tanu Kaskinen
6633c1f9ff bluetooth: Don't mark device valid before it has an adapter
At this point this doesn't make any other practical difference than
making the code more logical, but in the next patch I'll fire the
DEVICE_CONNECTION_CHANGED hook in set_device_info_valid(), and at that
point it's important that the device isn't marked valid too early,
because otherwise external code would see "valid" devices that however
don't have the adapter set.
2013-11-20 15:48:56 +02:00
Tanu Kaskinen
f4f4c42fc6 bluetooth: Use a helper function for setting device_info_valid
The helper function doesn't yet bring much benefits in this form, but
I'll add more functionality later.
2013-11-20 15:48:53 +02:00
Parin Porecha
382b8294e3 protocol-native: Express XOR asserts more concisely
7 instances of the roundabout asserts were found,
All of them have been replaced with appropriate XOR asserts.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=47493
2013-11-20 09:06:47 +02:00
Tanu Kaskinen
12b7a600d8 bluetooth: Remove a redundant variable 2013-11-15 14:50:46 +02:00
Pierre Ossman
e7df7bcd76 Revert "core: Transparently handle non-blocking sockets on Windows"
This reverts commit c327850d9e as
the workaround in that commit is no longer needed after the real
bug has been fixed.

Conflicts:
	src/pulsecore/core-util.c
2013-11-15 10:53:26 +02:00
Pierre Ossman
0138a51a2c core: make sure win32 sockets remain blocking
Commit 7e344b5 hade the side effect of forcing every socket to
be non-blocking on Windows. This is because of a (documented)
side effect of WSAEventSelect(). So we need to make sure to restore
blocking behaviour afterwards for relevant sockets.
2013-11-15 10:53:19 +02:00
Alexander Couzens
abfca5cb58 tunnel-new: add cookie module argument
When connecting to a remote server your local generated authentication
cookie is used. If remote server's cookie is different from your local
one you aren't allowed to connect. You can use the cookie argument
or define a wider acl in remote server configuration for
module-native-protocol.
2013-11-15 10:16:29 +02:00
Tanu Kaskinen
49dd827373 sink-input, source-output: Don't assume that proplist has been initialized in free()
It's bad form to assume in free() that any member of the struct has
been initialized. I ran into problems with this when I reordered
things in pa_sink_input_new() and pa_source_output_new().
2013-11-14 15:17:17 +02:00
Peter Meerwald
d0fd59c34c resampler: Cleanup, index of memchunks is not used
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-11-08 16:14:43 +02:00
Peter Meerwald
b14e9c0a6c resampler: Prepare to have leftover data in different output buffers
leftover_buf points to the output buffer of a stage containing leftover
data; similar for leftover_buf_size and have_leftover

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-11-08 16:01:06 +02:00
Peter Meerwald
0109a50a2d resampler: Add fit_buf() helper funtion for buffer allocation
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-11-08 15:50:05 +02:00
Peter Meerwald
da5c215d9b resampler: Cleanup, rename xxxx_buf_samples to xxxx_buf_size
we measure the capacity of a buffer in bytes, not samples

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-11-08 10:34:56 +02:00