Commit graph

6717 commits

Author SHA1 Message Date
Mikel Astiz
71bd458bd1 bluetooth: Disable profile auto-switch policy for headsets
Given that headsets have just one single port exposing whether the
audio is streaming (playing) or not, it's not possible that
module-bluetooth-policy would distinguish A2DP/HSP cases, and thus
the automatic selection of the card profile is not deterministic.

For this reason, disable the policy entirely for headsets and focus
only on HFGW and A2DP source profiles.
2012-11-29 05:37:45 +02:00
Mikel Astiz
40329acc1a bluetooth: Merge headset ports into one
Merge the former "hsp-output" and "a2dp-output" ports into one single
port, in order to fix the regression of having several independent
entries in the UI.
2012-11-29 05:36:01 +02:00
Niels Ole Salscheider
523af5b302 virtual-surround: check if resampled memblock is not equal to input
Since commit e32a408b3c, we silence the
input memblock in order to give the resampler enough input samples, if
necessary.
But if there is no need to resample the hrir, the resampled memblock is
actually the same as the input memblock. Thus, we have to make sure that
we do not silence it in this case.
2012-11-29 05:28:39 +02:00
Tanu Kaskinen
41055145d7 bluetooth: Unload device module when no audio profiles connected
Without this patch, device modules will be left around after the
device has been disconnected and when they are reconnected, the
discovery module will load duplicate device module instances.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=57239
2012-11-23 00:18:06 +02:00
Mikel Astiz
0bd428df04 bluetooth: Run the discovery hook only when necessary
This is a minor optimization too, but the main benefit is that it's
makes the code easier to understand (I hope), since run_callback()
won't be called at times when it's not needed.
2012-11-23 00:17:55 +02:00
Tanu Kaskinen
ebf5f29bb3 bluetooth: Add helper pa_bluetooth_device_any_audio_connected()
The new helper function makes it easier to check whether any audio
profiles are connected. That information is needed by the discovery
module for deciding whether a new device module should be loaded. The
device module should use this information too to unload itself at the
right time, but that's currently not implemented.
2012-11-23 00:04:17 +02:00
Mikel Astiz
59c8476d64 bluetooth: Rename former device_is_audio()
Use a more accurate name for the function since it doesn't just check
if it is an audio device (which can be detected quite early), but it
also checks if the most relevant properties (device info, etc.) have
been received.

Besides, add the const qualifier to the pointer since it's not going to
be modified.
2012-11-22 23:51:17 +02:00
Tanu Kaskinen
6545cc77f4 bluetooth: Ignore Device.Connected
The Device.Connected was only used for tracking whether a device module
should be loaded, but that information is already included in the
individual profile state properties. The property can therefore be
completely ignored without any loss in functionality.
2012-11-22 23:43:06 +02:00
Tanu Kaskinen
55baf5424e bluetooth: Add a pa_bluetooth_discovery pointer to pa_bluetooth_device.
This simplifies some function argument lists.
2012-11-22 15:04:26 +02:00
Juho Hämäläinen
868158f115 stream-restore: Add missing method handler argument.
Stream-restore DBus API method argument list is missing last boolean
argument apply_immediately, causing assert to fail in AddEntry handling.

Signed-off-by: Juho Hämäläinen <jusa@hilvi.org>
2012-11-20 11:57:21 +02:00
Arun Raghavan
968c9c45ac core: Remove bad free() call
The string created when trying to use XDG_RUNTIME_DIR is freed before it
is used in a debug message, and is freed again.

https://bugs.freedesktop.org/show_bug.cgi?id=57280
2012-11-19 21:32:18 +05:30
Arun Raghavan
3effdfc16f sink-input, source-output: Check rate update success for passthrough
This makes sure we don't try to plug in a passthrough stream if the
final sink/source sample spec doesn't match what we want. In the future,
we might want to change rate updates to try a full sample spec update
for passthrough streams.

https://bugs.freedesktop.org/show_bug.cgi?id=50951
2012-11-19 13:10:36 +05:30
Arun Raghavan
da4163a85e source-output: Fix volume fixup for rate update
The could that should have been after the rate update ended up being
before, which is incorrect.
2012-11-19 12:56:33 +05:30
Arun Raghavan
93836989e6 build-sys: Drop ChangeLog generation
This drops ChangeLog generation from git. It does not make sense to
distribute 500 kB of ChangeLog given how easy it is these days to browse
history with git.

We might replace this with a release-annoucement-esque high-level
summary of changes.
2012-11-17 10:55:05 +05:30
Arun Raghavan
9b0dff3a58 build-sys: Bump soname 2012-11-17 10:54:16 +05:30
Arun Raghavan
87e89ac4eb build-sys: Bump BlueZ dependency to 4.99
Since the old UNIX fd IPC mechanism was removed and we rely on the D-Bus
based API, this is the oldest version that is known to reliably work.
2012-11-16 23:16:05 +05:30
Arun Raghavan
e5953fb0dd modules: Micro-optimisation for rewind_requested paths
Since some devices can be chatty with regards to how often they return
from poll(), this adds a PA_UNLIKELY() to all the the rewind_requested
checks in our sink modules to make the general case (no rewind was
requested) the fast path.
2012-11-16 23:16:05 +05:30
Tanu Kaskinen
29f064aa3d sink: Process rewind requests also when suspended.
When a rewind is requested on a sink input, the request parameters are
stored in the pa_sink_input struct. The parameters are reset during
rewind processing, and if the sink decides to ignore the rewind
request due to being suspended, stale parameters are left in
pa_sink_input. It's particularly problematic if the rewrite_bytes
parameter is left at -1, because that will prevent all future rewind
processing on that sink input. So, in order to avoid stale parameters,
every rewind request needs to be processed, even if the sink is
suspended.

Reported-by: Uoti Urpala
2012-11-16 23:16:05 +05:30
Arun Raghavan
cd1102cce0 sink, source: Prevent unnecessary rate update attempts
We don't need to try a rate update if the desired sample rate is the
same as the one the sink or source is already using.
2012-11-16 23:16:04 +05:30
David Henningsson
0a0189d972 alsa-mixer: Prefer "Digital Input Source:Digital Mic 1"
...over "Digital Input Source:Analog Input". It makes life a little
easier for users of Dell xps m1330.

Just an old Ubuntu delta I never upstreamed until now.
The patch was originally written by Daniel T Chen <crimsun@ubuntu.com>.

BugLink: https://bugs.launchpad.net/bugs/453966
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-11-16 13:20:34 +01:00
Tanu Kaskinen
872f56dc7e mainloop: Don't care about the mainloop state variable when waking up the mainloop.
If the mainloop is just about to enter polling, but m->state
is not POLLING yet when some other thread calls
pa_mainloop_wakeup(), the mainloop will not be woken up.
It's safe to write to the wakeup pipe at any time, so let's
just remove the check.
2012-11-15 17:57:51 +02:00
Tanu Kaskinen
58de999a31 mainloop: Change wakeup_requested type from pa_bool_t to pa_atomic_t.
The variable is accessed from multiple threads, so it should
be atomic.
2012-11-15 17:52:22 +02:00
David Henningsson
387681d417 alsa-mixer: Add "CLFE" and "Bass Speaker" names
These are sometimes being used in the HDA driver and we should
support them.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-11-14 13:14:08 +01:00
Arun Raghavan
ead5447231 man: Correction for how sample rate switching is disabled
Setting to 0 in the parser causes daemon startup to fail.
2012-11-12 22:24:52 +05:30
Sjoerd Simons
706e7aeb25 build-sys: Correct bluez support error if sbc is missing 2012-11-12 10:25:55 +05:30
David Henningsson
2b26793f0f alsa-mixer: Add a few more machines to internal mic whitelist
Based on feedback in the bug below (comments 128, 129, 131).

BugLink: https://bugs.launchpad.net/bugs/946232
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-11-09 12:14:18 +01:00
Tanu Kaskinen
dfd44036b5 pulse: Fix hole handling in pa_stream_peek().
Previously, if there was a hole in a recording stream,
pa_stream_peek() would crash. Holes could be handled silently inside
pa_stream_peek() by generating silence (wouldn't work for compressed
streams, though) or by skipping any holes. However, I think it's
better to let the caller decide how the holes should be handled, so
in case of holes, pa_stream_peek() will return NULL data pointer and
the length of the hole in the nbytes argument.

This change is technically an interface break, because previously the
documentation didn't mention the possibility of holes that need
special handling. However, since holes caused crashing anyway in the
past, it's not a regression if applications keep misbehaving due to
not handing holes properly.

Some words about when holes can appear in recording streams: I think
it would be reasonable behavior if overruns due to the application
reading data too slowly would cause holes. Currently that's not the
case - overruns will just cause audio to be skipped. But the point is
that this might change some day. I'm not sure how holes can occur
with the current code, but as the linked bug shows, they can happen.
It's most likely due to recording from a monitor source where the
thing being monitored has holes in its playback stream.

BugLink: http://bugs.launchpad.net/bugs/1058200
2012-11-08 15:38:32 +01:00
Arun Raghavan
38c650dca9 introspect: Minor documentation fix
s/pa_latency_info/pa_timing_info
2012-11-08 14:57:48 +05:30
Pierre-Louis Bossart
635eef9981 alsa: get avail, delay, timestamps in a single kernel call
Refactor code to fetch avail, delay and timestamp values
in a single call to snd_pcm_status().
The information reported is exactly the same as before,
however it is extracted in a more atomic manner to
improve timer-based scheduling.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2012-11-07 08:20:19 +01:00
Arun Raghavan
700cd890a9 Revert "tests: modify alsa-time-test to use 'check' framework"
This reverts commit 1569601864.

Rethinking this, it makes more sense to not add this to the check
framework. This is mostly useful for exposing ALSA driver issues, and
it's handy to be able to build this as a standalone executable.
2012-11-05 17:48:20 +05:30
Arun Raghavan
7d97fe56c7 alsa: Drop verbosity on UCM message
We don't need to log an error-level message for missing UCM config.
2012-11-05 17:48:20 +05:30
Deng Zhengrong
7ce7464c16 build: fix Mac OS X configure process
The original header file doesn't exist on Lion (10.7.4).
2012-11-04 10:07:31 +01:00
Frédéric Dalleau
153e17e3bb resampler: Fix crash if 'auto' resampler chooses ffmpeg with variable rate
To reproduce, add resampler-method = ffmpeg in daemon.conf
then start PA, and load module-loopback

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb2f1db40 (LWP 23047)]
0x00000000 in ?? ()
(gdb) bt
0  0x00000000 in ?? ()
1  0xb7c463cb in pa_resampler_set_input_rate (r=0x80e9438, rate=44011) at pulsecore/resampler.c:365
2  0xb7c6321d in pa_sink_input_process_msg (o=0x80e87a0, code=3, userdata=0xabeb, offset=0, chunk=0x0)
    at pulsecore/sink-input.c:1833
3  0xb7e9840b in sink_input_process_msg_cb (obj=0x80e87a0, code=3, data=0xabeb, offset=0, chunk=0x0)
        at modules/module-loopback.c:538
4  0xb7c2709b in pa_asyncmsgq_dispatch (object=0x80e87a0, code=3, userdata=0xabeb, offset=0, memchunk=0xb2f1d17c)
        at pulsecore/asyncmsgq.c:322
5  0xb7c4c6e3 in asyncmsgq_read_work (i=0x80dd580) at pulsecore/rtpoll.c:564
6  0xb7c4b34a in pa_rtpoll_run (p=0x80fb7e0, wait_op=true) at pulsecore/rtpoll.c:238
7  0xb7dd90af in thread_func (userdata=0x80afe88) at modules/alsa/alsa-sink.c:1785
8  0xb7bf3291 in internal_thread_func (userdata=0x8095d08) at pulsecore/thread-posix.c:83
9  0xb7ab9d4c in start_thread (arg=0xb2f1db40) at pthread_create.c:308
10 0xb79f3ace in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
2012-11-04 10:07:31 +01:00
Tanu Kaskinen
45c27ca29a build: Add PROTOCOL to EXTRA_DIST.
It's useful documentation, no reason to leave it out of the tarball.
2012-11-04 10:07:31 +01:00
Tanu Kaskinen
485106d560 device-restore: When restoring volume, print the restored volume to the log. 2012-11-04 10:07:31 +01:00
Tanu Kaskinen
3e5b872dc2 build: Add .gitignore files to EXTRA_DIST.
As a packager, I want to be able to do "git format-patch
v3.0..origin/master" and I want the generated patches to apply cleanly
against the 3.0 tarball. The patches don't currently apply cleanly if
there are any changes to the .gitignore files, because the .gitignore
files are not shipped in the tarball. This patch fixes that problem.
2012-11-04 10:07:31 +01:00
Wieland Hoffmann
3b67ebb63e man pulse-daemon.conf: Correct typoes 2012-11-03 15:42:35 +01:00
Arun Raghavan
5cc60fa897 build-sys: Document libpulsecommon vs. libpulse duplication 2012-11-03 11:52:58 +01:00
Arun Raghavan
d754b63bcb i18n: Fix POTFILES for poll changes
poll.c was moved to poll-posix.c and poll-win32.c was added for the
Windows port.
2012-11-03 10:52:35 +01:00
Arun Raghavan
5ec0d8122a build-sys: Bump soname 2012-11-03 10:44:42 +01:00
Arun Raghavan
eeab4efa98 Revert "core: adjust playing_for and underrun_for at rewind"
This reverts commit 5bc6cadcb2.

I wasn't meaning to push this out - just merged for review / testing.
2012-11-03 10:29:20 +01:00
Uoti Urpala
5bc6cadcb2 core: adjust playing_for and underrun_for at rewind
A rewind may erase data that sink_input counted in playing_for or
underrun_for earlier. Add code adjusting those values after a rewind.

One visible symptom of this bug was problems recovering from an
underrun. When a client calls pa_stream_write() with a large block of
memory, the function can split that into smaller pieces before sending
it to the server. When receiving new data for a stream that had
silence queued due to underrun, the server would do a rewind to
replace the queued-but-not-played silence with the new data. Because
of the bug, this rewind itself would not change underrun_for. It's
possible for multiple rewinds to be done without filling the sink
buffer in between (which is what would eventually reset underrun_for).
In this case, the server rapidly processing the split packets would
rewind the stream for _each_ of them (as underrun_for would stay set),
erasing valid audio as a result.
2012-10-31 15:27:15 +05:30
Arun Raghavan
94039790f8 svolume: Fix ARM alignment issues
As Peter Meerwald <p.meerwald@bct-electronic.com> discovered, our ARM
svolume code performance is quite terrible when the incoming samples are
not word-aligned. This can very easily be the case, since the
architecture only requires that the samples be 16-bit aligned, and we
might end up running the innermost loop after processing modulo-4
samples. The performance degradation was ~50x on a Cortex A9
(Pandaboard).

This reworks the svolume logic to first consume enough samples to make
sure the rest is word aligned, and reordering the processing to work
with 4 samples at a time first, and then finally deal with the
remainder.

With this, performance is comparable for arbitrary alignments (~3x
faster than the C code).
2012-10-30 20:34:21 +05:30
Arun Raghavan
96fa87086d tests: Minor alignment adjustment fix for cpu-test 2012-10-30 20:34:20 +05:30
Tanu Kaskinen
0a8634f03e match: Use the SINK_INPUT_FIXATE hook instead of NEW.
The callback relies on the sample spec being finalized, which is not
true with the NEW hook.

In case you're wondering about the "hook EARLY - 1, to match before
stream-restore" comment that was not changed even though the code that
the comment concerned was changed: the comment was apparently written
at a time when module-stream-restore used the NEW hook too, and later
stream-restore has been changed to use the FIXATE hook. So, the
comment was wrong/nonsensical before this patch. Since these two
modules now use the same hook again, the comment makes sense again.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=55135
2012-10-30 16:32:34 +02:00
Tanu Kaskinen
0da87df4ec combine: Keep the timer active in the null mode only when running.
Previously thread_func() used PA_SINK_IS_OPENED() to check whether
some data should be rendered. process_render_null() used a different
check: it would return immediately if the sink was not in the RUNNING
state. This caused a busy loop when the sink was in the IDLE state,
because process_render_null() didn't update the timestamp, and
thread_func() still kept the timer active using the old timestamp.
pa_rtpoll_run() would return immediately because of the old timestamp.

This is fixed by using the same check in both thread_func() and
process_render_null(). Since the checks are the same, it's actually
redundant to have the check in process_render_null(), so it is now an
assertion.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=54779
2012-10-30 16:30:08 +02:00
Tanu Kaskinen
3adbb5ad03 virtual-surround-sink: Fix setting max_request and max_rewind.
The sink has different frame size than the sink input, so
the max_request and max_rewind values of the sink input need
to be converted when setting the sink max_request and
max_rewind values.

The conversion is already done correctly in
sink_input_update_max_request_cb() and
sink_input_update_max_rewind_cb().
2012-10-30 16:28:48 +02:00
Tanu Kaskinen
1fc2cf8425 loopback: Don't fix the source output format/rate/channels.
Once the sink input has been routed in pa_sink_input_new(),
the sample spec and channel map have already become fixed.
The sink input and source output must use the same stream
format, because the data is copied as-is.
2012-10-30 16:27:17 +02:00
Tanu Kaskinen
a68652a42c loopback: Use the real sample spec once it's known.
When module-loopback is loaded without arguments, the ss and
map variables are initialized with dummy values. This caused
a problem, because also pa_memblockq_new() was called with
the dummy values, making it work incorrectly. The base was
set to 1 instead of the real frame size, which in turn
caused alignment related crashes.
2012-10-30 16:26:06 +02:00
Tanu Kaskinen
e4adf9c4d8 resampler: Make sure that there are no overflows when multiplying potentially big numbers.
This fixes at least one crash that has been observed. The
multiplication in trivial_resample() overflowed when
resampling from 96 kHz to 48 kHz, causing an assertion
error:

Assertion 'o_index * fz < pa_memblock_get_length(output->memblock)' failed at pulsecore/resampler.c:1521, function trivial_resample(). Aborting.

Without the assertion, the memcpy() after the assertion
would have overwritten some random heap memory.
2012-10-30 16:21:35 +02:00