Commit graph

7462 commits

Author SHA1 Message Date
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
Peter Meerwald
53104b36e6 resampler: Handle leftover samples, use new return value
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-11-08 10:33:16 +02:00
Peter Meerwald
79b237ca02 resampler: Change interface, resampler may return the number of leftover frames
some resampler implementations (e.g. libsamplerate and ffmpeg) do not consume
the entire input buffer; the impl_resample() function now has a return value
returning the number of frames in the input buffer not processed

these frames must be saved in appropriate buffer and presented together with
new input data

also change the parameter names from in_samples, out_samples to in_n_frames,
out_n_frames, respectively (n_frames = samples / channels)

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-11-08 10:27:30 +02:00
Peter Meerwald
6d61c7779d resampler: Introduce work_channels
work_channels is the number of channels in the resampler stage

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2013-11-08 10:17:46 +02:00
Peter Meerwald
c60a36ecdd resampler: Introduce work frame size (w_fz)
w_fz represents the number of bytes per frame in the resampler stage

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2013-11-08 10:05:25 +02:00
Luiz Augusto von Dentz
f434087e42 card: Only set active_profile with available profile
When a card is being created and no profile has been assigned
pa_card_new will attempt to select one from the list but it does that
without checking the available flag which can lead to select profiles
not available.
2013-11-05 21:33:04 +02:00
Luiz Augusto von Dentz
85e7fbc196 introspect: Fix ABI break introduced by b98a2e1
The size of pa_card_profile_info cannot change even if it just a field
appended to end because each entry is appended to a contiguous memory
and accessed by offset this may lead clients to access invalid data.

To fix a new struct called pa_card_profile_info2 is introduced and shall
be used for now on while pa_card_profile_info shall be considered
deprecated but it is still mantained for backward compatibility.

A new field called profiles2 is introduced to pa_card_info, this new field
is an array of pointers to pa_card_profile_info2 so it should be possible
to append new fields to the end of the pa_card_profile_info2 without
breaking binary compatibility as the entries are not accessed by offset.
2013-11-05 21:26:34 +02:00
David Henningsson
6dddee4214 alsa-mixer: Add internal surround speaker elements
These kcontrol names have started to show up lately, in
combination with surround internal speakers.

BugLink: https://bugs.launchpad.net/bugs/1236965
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2013-11-01 21:27:29 +01:00
João Paulo Rechi Vita
078dc15944 console-kit: Remove logging of every message on the bus 2013-11-01 16:28:45 +02:00
Peter Meerwald
e8a84270c3 tests: Extract PA_CPU_TEST* macros to separate header
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-11-01 15:02:24 +01:00
Pierre Ossman
4262d6a14f daemon conf: "high-priority" setting isn't respected
The code got removed by accident during the cleanup in commit 9c438bcac6. So
this patch is needed to bring it back and make things work like documented.
2013-11-01 14:50:51 +01:00
poljar (Damir Jelić)
6e4335cc71 zsh-completion: Add --monitor-stream completion to pacat 2013-10-29 20:59:32 +02:00
Tanu Kaskinen
073051f983 simple: Improve pa_simple_read() documentation
There was a question in IRC about whether pa_simple_read() blocks or
not. It's already documented on the simple API overview page, but it's
good to say it also in the function reference. As a bonus, I added
some additional details to the documentation too.
2013-10-29 20:53:48 +02:00
Tanu Kaskinen
38b8c42b35 bluetooth: Fix variable constness
The string points to memory inside a DBusMessage, so we don't own the string.
2013-10-29 20:46:47 +02:00
Tanu Kaskinen
c922dce784 bluetooth: Remove adapter_remove_all()
The function was redundant, because all it did was call adapter_free()
for each adapter in the hashmap, and that can be delegated to
pa_hashmap when freeing or emptying it.
2013-10-29 20:44:14 +02:00
poljar (Damir Jelić)
b49298c51e zsh-completion: Fix pacat device completion
The pacat completion didn't complete the right devices for the --record
and --playback flags.

This patch fixes this and makes the device completion for pacat easily
expandable.
2013-10-29 19:47:06 +02:00
poljar (Damir Jelić)
47729c43b4 bash-completion: Add --monitor-stream completion to pacat 2013-10-29 19:46:18 +02:00
Peter Meerwald
832ad693f5 modargs: Add pa_modargs_get_sample_rate()
return sample rate from the "rate" module argument

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2013-10-29 19:35:29 +02:00
Peter Meerwald
22ee1b9d53 modargs: Add pa_modargs_get_resample_method()
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2013-10-29 19:26:58 +02:00
Ben Brewer
68156d3f79 mainloop, glib-mainloop: time_restart could cause incorrect event ordering
This fixes a bug where calling time_restart can leave the current event
in the cache, even though the restart scheduled the event in the future.
This would cause the event to get executed more frequently than it should.
2013-10-29 19:14:00 +02:00
Peter Meerwald
81f0eb626e tests: Resampler output memchunk may be reset (zero)
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2013-10-29 18:31:32 +02:00
Peter Meerwald
f4635818bd memblock: Fix typo in description of pa_memblock_unref_fixed(), cleanup
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2013-10-29 18:26:57 +02:00
Rafael Ferreira
09e88de0af Updated Brazilian Portuguese translation
Signed-off-by: Rafael Ferreira <rafael.f.f1@gmail.com>
2013-10-23 07:30:46 +01:00
João Paulo Rechi Vita
9490a067bb bluetooth: Track discovery modules by index
Previously module-bluez5-discover and module-bluez4-discover were being
tracked using their pa_module pointer. But during daemon shutdown these
modules are unloaded before module-bluetooth-discover, leaving stale
pointers in module-bluetooth-discover's userdata. To avoid this problem
this commit makes module-bluetooth-discover keep track of
module-bluez5-discover and module-bluez4-discovery by their indexes.
2013-10-15 10:42:25 +03:00
Tanu Kaskinen
b402f9e01f build-sys: Print CPPFLAGS in configure
I needed this for verifying that the conditional defining of
_FORTIFY_SOURCE works.
2013-10-12 23:17:15 +03:00