Arun Raghavan [Tue, 4 Oct 2011 19:28:52 +0000 (00:58 +0530)]
alsa: Make mixer error handling more robust still
Instead of relying on the snd_mixer_* functions failing, we check for
POLLERR and POLLNVAL first. After this, any errors in handling the mixer
events are deemed fatal (that is we cause the ALSA source/sink thread to
terminate).
The case where POLLERR is set but POLLNVAL is not does not actually
occur, but we're making this a soft failure (stop polling the mixer, but
don't kill the I/O thread). If other conditions where POLLERR occurs
turn up, we need to handle them explicitly.
Thanks to Linus Torvalds for helping get this right.
Arun Raghavan [Tue, 4 Oct 2011 08:36:26 +0000 (14:06 +0530)]
echo-cancel: Fail if loaded between a sink and its monitor
Loading between a sink and its monitor causes a deadlock (while sending
messages for latency snapshots). It isn't a case that has any real
conceivable use, so let's just disallow it.
Arun Raghavan [Tue, 4 Oct 2011 04:59:03 +0000 (10:29 +0530)]
alsa: Better error handling in mixer rtpoll callback
This improves the error handling in the mixer rtpoll callback. It avoids
a crash if an error occurs (the rtpoll_item is freed but still
referenced), and specifically makes sure we don't continue trying to
poll the device if the card is disconnected.
Arun Raghavan [Tue, 4 Oct 2011 05:35:59 +0000 (11:05 +0530)]
alsa: Give compressed formats preference over PCM
This makes set_formats() put PCM formats lower down the list than
compressed formats since we negotiate by picking the first format in
this list that is also in the client-provided list of possible formats
during sink input creation.
This will be incorrect if we ever decide to do encoding in PA (for
things like AC3/DTS encoding for multichannel output over S/PDIF).
Marc-André Lureau [Sat, 1 Oct 2011 11:16:35 +0000 (12:16 +0100)]
stream-restore: Support a simple fallback volume table
The purpose of this patch is to make it possible to configure stream volumes
before pulseaudio is run for the first time. This is useful, for example, in
embedded products where the default volumes have to be sensible already in
the first boot.
memblockq: Improve debuggability by storing a name and a sample spec.
These are not used for anything at this point, but this
makes it easy to add ad-hoc debug prints that show the
memblockq name and to convert between bytes and usecs.
Colin Guthrie [Sat, 1 Oct 2011 11:03:44 +0000 (12:03 +0100)]
libpulse: Always return a three part version number in API calls.
For both the headers and the library we should provide clean, three part
strings as this has been what we've previously done in the past
and some external systems apparently rely on this format. While it's not
something we've officially commented on before, there is no real advantage
to us to change it so let's not try to tidy things up too much
considering some third party apps (e.g. Skype) seem to dislike a two
part version string.
sink,source: Avoid unnecessary call to pa_rtclock_now()
pa_{sink,source}_volume_change_apply were being called by the ALSA I/O
thread on every iteration, causing a pa_rtclock_now() call, which can
sometimes be heavy. We avoid this call by making sure there actually are
changes to apply before proceeding into the function.
While we're at it, also dropping a redundant check on s->write_volume.
sink,source: Handle missing in the shared volume case
This makes sure that when we're traversing the device chain for sources
and sinks with shared volume, we handle the case that a sink-input or
source-output of one of these might be unlinked (while unloading a
module, for example).
David Henningsson [Wed, 14 Sep 2011 12:55:07 +0000 (14:55 +0200)]
conf: Make sure module-dbus-protocol is loaded after module-default-device-restore
module-dbus-protocol gets the default sink, which sets the default sink
if not already set. This is turn makes module-default-device-restore do
nothing.
To solve the problem, make sure module-default-device-restore is loaded
before module-dbus-protocol and not the other way around.
Uses the shared volume infrastructure by default with an option to
fallback on the old pretend-volume-sharing-that-kind-of-works if someone
wants it that way.
Users who keep left != right (or any sort of unbalanced channel volumes)
will likely want to disable shared volumes since it will cause their
master sink/source volume to be balanced.
This really isn't a very pleasant scenario since users would need to
manually set up echo cancellation in their config for this (until we
have a way to store module configuration). That said, the majority case
benefits from the volume sharing, so let's not wait for the
configuration infrastructure to be ready to use this.
Uses the shared volume infrastructure by default with an option to
fallback on the old pretend-volume-sharing-that-kind-of-works if someone
wants it that way.
volume: Handle varying channel count for shared volumes
This handles the case where a virtual sink/source and it's master have
different channel counts. The solution is not ideal because if the
former has fewer channels and the master has channel volumes that are
not all at the same level, it will lose this information and have all
channels at the same level.
This is not just a theoretical problem, since module-echo-cancel
prefers a mono virtual source/sink and will usually be sitting on top of
a stereo ALSA source/sink.
That said, I don't really see a good solution to this problem, so the
idea is to make volume sharing optional (on by default) in
module-echo-cancel, so that the few people who care can then disable it
if they so desire.
Colin Guthrie [Tue, 13 Sep 2011 20:15:49 +0000 (21:15 +0100)]
volume: Rename 'sync volume' to 'deferred volume'.
This just covers Lennart's concern over the terminology used.
The majority of this change is simply the following command:
grep -rli sync[-_]volume . | xargs sed -i 's/sync_volume/deferred_volume/g;s/PA_SINK_SYNC_VOLUME/PA_SINK_DEFERRED_VOLUME/g;s/PA_SOURCE_SYNC_VOLUME/PA_SOURCE_DEFERRED_VOLUME/g;s/sync-volume/deferred-volume/g'
Some minor tweaks were added on top to tidy up formatting and
a couple of phrases were clarified too.
Colin Guthrie [Tue, 6 Sep 2011 10:35:33 +0000 (11:35 +0100)]
modargs: Ensure modargs can be accessed in their raw form.
When dealing with proplists passed as modargs, we need the unescaped form
in order to properly deal with quotes (ticks + double quotes). As the previous
code always called pa_unescape() before adding it into the modarg hashmap, this
was impossible.
This modification simply stores two proplists. If the unescaped value
is different from the raw value, we also keep the raw form.
When parsing proplist arguments, we use this raw form and do the unescaping
ourselves when processing it.
This changes the current behaviour which required you to double escape
proplists arguments. This double escape mechanism did allow you to mix
and match what types of quotes you used to delimit the individial
proplist values, but it made the actual data much harder to pass in.
This approach has the drawback that you cannot mix and match the quotes
you use, but this is a very minor issue and IMO pales in comparison to
the general clarity gained.
See the discussion on the mailing list for more background:
http://lists.freedesktop.org/archives/pulseaudio-discuss/2011-September/011220.html
Antonio Ospite [Fri, 9 Sep 2011 10:05:29 +0000 (12:05 +0200)]
alsa-mixer: Add support for the Microsoft Kinect Sensor device
The Kinect shows up as a UAC device after the firmware has been loaded,
but in order to be detected by pulseaudio a 4-channels input only
mapping is needed. Provide a new profile for that and set it with a udev
rule.
pa_core_maybe_vacuum now vacuums if there are either no streams or all devices are suspended.
The mempool_vacuum argument to module-suspend-on-idle is gone and defaults to true now.
Colin Guthrie [Wed, 7 Sep 2011 19:19:44 +0000 (20:19 +0100)]
bluetooth: Bump DBus version to 1.3.0 and drop conditional code.
We used to support older DBus versions but 1.3.0 is two years old
now and by requiring it we cut down of deviated code paths at
runtime and thus have less support issues.
Colin Guthrie [Mon, 5 Sep 2011 21:19:41 +0000 (22:19 +0100)]
raop: Use the port supplied by avahi when connecting to RAOP devices.
The Apple TV for example uses a non-default port, but we previously ignored
this. We now correctly parse the server string but in so doing, we end up
parsing the address twice. As we need a pure IP/hostname of the device itself
to use in our requests, this is somewhat unavoidable.
Sadly there are still other problems with Apple TVs, but this is still
one step closer.
Colin Guthrie [Sun, 4 Sep 2011 19:05:14 +0000 (21:05 +0200)]
formats: Export more functions needed for a clean build.
All of these functions are not actually defined in format.h
(they are defined in internal.h) and thus should really be
included only in libpulsecommon and implemented in a separate
source file.
However if that approach was taken, and these functions were
included in libpulsecommon, then they would have a link time
dependancy on libpulse (as these four functions use other
pa_format_info_* functions). As the opposite is already true
(libpulse depends on libpulsecommon), this is not possible as
it creates a circular dependancy.
Thus the only option is to just to include these four functions
in the map-file, but not actually export any public headers for
them. Of course users could use this implementation by defining
them in their own headers, but the only practical problem
with this approach is naming conflicts which is unlikely to happen.
Colin Guthrie [Sun, 4 Sep 2011 18:40:21 +0000 (20:40 +0200)]
formats: The format code should be in libpulse, not libpulsecommon
Without this change any applications calling e.g. pa_format_info_new()
and friends will be explicitly linked against libpulsecommon-$MAJORMINOR.so
which is something we specifically avoid as it may contain ABI/API unstable
functions.
Also ensure we export pa_format_info_from_string() for external use.
Colin Guthrie [Fri, 2 Sep 2011 11:51:26 +0000 (12:51 +0100)]
device-restore: Simplify the migration of data to per-port keys.
Rather than write all the keys out for each port, simply write a 'null'
port entry and modify the read code to 'fallback' to this when it cannot
find a key. This is needed as the code used when writing the key may not
actually have the sink ports available at the time it uses them,
and thus can cause a segv. This approach adds some degree of overhead
but it's relatively minimal and it can be mitigated by compiling
without support for legacy database formats if so desired.
Thanks to David Henningsson for pointing out the problem.
David Henningsson [Mon, 4 Jul 2011 08:12:17 +0000 (10:12 +0200)]
alsa-mixer: Set "Front" control to 0 dB on headphone path
I've seen more than one system where the volume control named
"Front" is a part of audio path for headphones. This is somewhat
of a compromise: While we don't merge it into the path, as that
would be regressing machines where "Front" isn't a part of the
audio path, it would still enable sound on these machines.
Arun Raghavan [Wed, 31 Aug 2011 05:51:57 +0000 (11:21 +0530)]
vala: Add has_type_id=false to all enums, structs and classes
Since none of our types is derived from GType, explicitly signal this.
The default value for this attribute changed at some point, breaking our
bindings.
Arun Raghavan [Mon, 29 Aug 2011 12:17:39 +0000 (17:47 +0530)]
echo-cancel: Don't allow streams to attach while unloading
When unloading, some module may end up trin to move a sink-input or
source-output back onto our virtual sink/source, causing an infinite
loop of us moving the stream away and having it moved back.
We prevent this from happening by preventing any stream from being
attached during unload.
David Henningsson [Fri, 26 Aug 2011 12:04:18 +0000 (14:04 +0200)]
Set better priorities on input paths
The priorities should be set in the approximately likeliness that someone
would like to use them. This is hard to guess of course, but this is
a better guess compared to the existing configuration.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Colin Guthrie [Wed, 24 Aug 2011 21:50:28 +0000 (22:50 +0100)]
device-restore: Restore volumes on port change.
This will allow for volumes to be saved separately for e.g. Headphones vs. Speakers.
At present it is possible that no volume will be saved for the device prior to the port
switch. In this case the volume will not change from the value set under the other port.
In an ideal world we would save the volume before switching port, but that would require
a new hook.
Colin Guthrie [Wed, 24 Aug 2011 21:28:13 +0000 (22:28 +0100)]
device-restore: Split device restore database into two parts.
The device restore saves both the current port for a device, and the volume/mute/formats.
The latter three are really related to the device+port, not the device on it's own.
Thus we store just the port for a device in one key and the volume/mute/formats
under a different key that includes both the device and the port.
Arun Raghavan [Thu, 25 Aug 2011 12:17:05 +0000 (17:47 +0530)]
echo-cancel: Move speex preprocessing out of the main module
I initially included put the Speex preprocessing assuming that we'd want
to use the digital gain control and noise suppression from Speex for all
echo cancelling implementations. In practice, we're probably going to
get entire implementations all processing in one package (WebRTC, custom
modules from various vendors, etc.).
This moves out this preprocessing and related knobs into the speex
implementation, which serves to clean out all implementation-specific
details from the module-echo-cancel core.
Colin Guthrie [Thu, 18 Aug 2011 14:36:04 +0000 (15:36 +0100)]
def: Add a new enum to allow differntiation between sinks and sources.
This is for bits of code or API where the concepts and constructs are
extensibly the same for sinks and sources. To avoid duplication we can
simply define our structure/API and then use this enum to differentiate
the two.
After discussion with Colin, decided that we don't want to do this
piecemeal -- need some discussion on the mailing-list and then we should
do this across the tree in one fell swoop post 1.0.
Arun Raghavan [Wed, 17 Aug 2011 17:08:43 +0000 (22:38 +0530)]
alsa: Open iec958 device with NONAUDIO bit set in passthrough mode
This is required for E-AC3 streams, as well as to let receivers we're
sending non-PCM data (which avoids playing noise if the data is
incorrect for some reason).
David Henningsson [Mon, 15 Aug 2011 12:05:50 +0000 (14:05 +0200)]
Remove offensive part of error message
I don't know the exact cause for someone to submit a bug report for
this error message: if someone is truly offended by it (if so it is
a reminder that some people are more sensitive than others, and I do
want those people to feel welcome as well), or if it's a system's
check (if this goes through, it shows the system works, and the person
might put more work into his/her next patch), or if it's just a bug
(after all, it's not that weird to run two instances of PulseAudio?).
Either one could be reason enough to apply IMO.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>