platform/upstream/pulseaudio.git
11 years agosource: When updating a monitor source's rate, update the sink rate too
Tanu Kaskinen [Fri, 9 Aug 2013 06:39:49 +0000 (09:39 +0300)]
source: When updating a monitor source's rate, update the sink rate too

If the sink rate is not updated, then the monitor source will appear
to have a different rate than the sink, but in reality there's never
any resampling done when moving data from the sink to the monitor
source, so it's a lie that the monitor source has a different rate.
The result of lying is that clients that capture from the monitor
source will have streams that run too fast or slow.

11 years agosource: Fix monitor source rate changing
Tanu Kaskinen [Fri, 9 Aug 2013 04:45:26 +0000 (07:45 +0300)]
source: Fix monitor source rate changing

When a sink changes its sample rate, also the monitor source rate
needs to be changed. In order to determine whether a source supports
rate changing, the code checks if the update_rate() callback is set,
but monitor sources don't have that callback set, so the old code
always failed to change the monitor source rate.

This patch fixes the monitor source rate changing by handling monitor
sources as a special case in pa_source_update_rate(): if the source is
a monitor source, then the update_rate() callback is not required.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=66424
11 years agoresampler: Add a choose_auto_resampler function
poljar (Damir Jelić) [Wed, 7 Aug 2013 17:55:44 +0000 (19:55 +0200)]
resampler: Add a choose_auto_resampler function

This function returns our preferred resampler if the user choose the
auto (or if he has chosen an unsupported) resampler.

11 years agoresampler: Get rid of redundant implementation specific structs
poljar (Damir Jelić) [Wed, 7 Aug 2013 17:37:55 +0000 (19:37 +0200)]
resampler: Get rid of redundant implementation specific structs

This patch removes implementation specific structs that contain a single
member.

11 years agoresampler: Add assert to set_input/output_rate
poljar (Damir Jelić) [Wed, 10 Jul 2013 11:10:04 +0000 (13:10 +0200)]
resampler: Add assert to set_input/output_rate

This adds asserts to check if the implementation has an update rate
function defined for the unlikely event that some implementation forgets
to assign a update rate function we can simply bail.

It is expected from the resampling implementations to have such a
function even if the state of the resampler is completely reset.

11 years agoresampler: Introduce a implementation specific struct
poljar (Damir Jelić) [Mon, 24 Jun 2013 11:36:49 +0000 (13:36 +0200)]
resampler: Introduce a implementation specific struct

This struct holds all the implementation specific data in one place.

11 years agoResampler: Don't use the peaks resampler for upsampling
poljar (Damir Jelić) [Fri, 28 Jun 2013 16:55:04 +0000 (18:55 +0200)]
Resampler: Don't use the peaks resampler for upsampling

This patch fixes this assertion:
    Assertion 'r->i_ss.rate >= r->o_ss.rate' failed at ../../src/pulsecore/resampler.c:1744, function peaks_init(). Aborting.

11 years agoresampler: Add a function for comparing sample format precision
poljar (Damir Jelić) [Fri, 28 Jun 2013 15:58:22 +0000 (17:58 +0200)]
resampler: Add a function for comparing sample format precision

11 years agoresampler: choose_work_format use switch instead of if/else
poljar (Damir Jelić) [Thu, 11 Jul 2013 17:28:29 +0000 (19:28 +0200)]
resampler: choose_work_format use switch instead of if/else

This way the function for choosing the work format should
be more readable and easier to expand in the future.

11 years agoresampler: Move the work format finding logic into a separate function
poljar (Damir Jelić) [Wed, 26 Jun 2013 14:31:49 +0000 (16:31 +0200)]
resampler: Move the work format finding logic into a separate function

11 years agoresampler: fix_method use switch instead of if/else
poljar (Damir Jelić) [Wed, 26 Jun 2013 14:09:08 +0000 (16:09 +0200)]
resampler: fix_method use switch instead of if/else

This way the fix method function should be more readable and easier to
expand in the future.

11 years agoresampler: Move the fix method logic into a separate function
poljar (Damir Jelić) [Wed, 26 Jun 2013 11:51:55 +0000 (13:51 +0200)]
resampler: Move the fix method logic into a separate function

11 years agoresampler: Make resampler struct implementation agnostic
poljar (Damir Jelić) [Tue, 18 Jun 2013 12:22:26 +0000 (14:22 +0200)]
resampler: Make resampler struct implementation agnostic

The pa_resampler struct contains many implementation specific
structures. These create overhead and don't belong there anyways.

This patch moves the implementation specific structures out of the
pa_resampler structure.

11 years agosink, source: Return early from pa_*_update_rate(), if there's no need to do anything
Tanu Kaskinen [Fri, 9 Aug 2013 06:38:02 +0000 (09:38 +0300)]
sink, source: Return early from pa_*_update_rate(), if there's no need to do anything

11 years agosink, source: Small readability improvement
Tanu Kaskinen [Fri, 9 Aug 2013 05:56:23 +0000 (08:56 +0300)]
sink, source: Small readability improvement

11 years agosink, source: Fix default and alternate rate assertions
Tanu Kaskinen [Fri, 9 Aug 2013 05:55:52 +0000 (08:55 +0300)]
sink, source: Fix default and alternate rate assertions

11 years agosink, source: Don't care about default and alternate rate in passthrough mode
Tanu Kaskinen [Fri, 9 Aug 2013 05:51:12 +0000 (08:51 +0300)]
sink, source: Don't care about default and alternate rate in passthrough mode

In passthrough mode the device rate is set to match the stream rate,
and the default and alternate rates are ignored.

11 years agosink, source: Reduce indentation level in *_update_rate()
Tanu Kaskinen [Fri, 9 Aug 2013 04:42:07 +0000 (07:42 +0300)]
sink, source: Reduce indentation level in *_update_rate()

11 years agosource-output: Get the correct source for "direct_on_input" streams
Tanu Kaskinen [Wed, 14 Aug 2013 13:54:28 +0000 (16:54 +0300)]
source-output: Get the correct source for "direct_on_input" streams

If a capture stream captures from a single sink input (so the capture
stream is a so called "direct on input" stream), then it needs to
connect to the monitor source of the sink to which the sink input is
connected. Previously the correct source was not figured out
automatically, causing the capture stream creation to fail.

11 years agotunnel-sink-new: add a rewrite of module-tunnel using libpulse
Alexander Couzens [Wed, 21 Aug 2013 11:58:19 +0000 (13:58 +0200)]
tunnel-sink-new: add a rewrite of module-tunnel using libpulse

The old tunnel module duplicates functionality that is in libpulse,
due to implementing the native protocol, and the protocol code in
the old tunnel module tends to get broken every now and then, because
people forget to update the tunnel module protocol implementation
when changing the native protocol. module-tunnel-sink-new avoids this
problem by using libpulse to communicate with the remote server.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
11 years agoclient-conf: refactor cookie loaders
Alexander Couzens [Wed, 21 Aug 2013 11:48:12 +0000 (13:48 +0200)]
client-conf: refactor cookie loaders

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
11 years agobash-completion: Fix device completion for pacat
poljar (Damir Jelić) [Wed, 14 Aug 2013 14:09:06 +0000 (16:09 +0200)]
bash-completion: Fix device completion for pacat

The Bash shell completion for pacat --device combines the name of the
last sink and the name of the first source. This patch fixes that by
adding a whitespace separator in the list of devices.

Buglink: https://bugs.freedesktop.org/show_bug.cgi?id=68106
11 years agopacat: Added support for recording from one specific sink input
Magnus Ekhall [Sun, 11 Aug 2013 19:21:41 +0000 (21:21 +0200)]
pacat: Added support for recording from one specific sink input

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=66326
11 years agosink-input: Don't assert when removing non-existent volume factor
Arun Raghavan [Sat, 3 Aug 2013 06:09:17 +0000 (11:39 +0530)]
sink-input: Don't assert when removing non-existent volume factor

This makes it easier for users of this API to add/updated a volume
factor by doing a _remove_volume_factor() followed by an
add_volume_factor(), rather than having to either remember whether this
is the first set operation or have an API to query whether a factor has
already been set.

11 years agoalsa: Trivial whitespace deletion
Arun Raghavan [Wed, 7 Aug 2013 13:00:44 +0000 (18:30 +0530)]
alsa: Trivial whitespace deletion

11 years agodoc: Update LICENSE to reflect optional libpulse dep on libdbus
Arun Raghavan [Tue, 25 Jun 2013 03:50:03 +0000 (09:20 +0530)]
doc: Update LICENSE to reflect optional libpulse dep on libdbus

11 years agothread-mq: Support a mainloop as thread/consumer
Alexander Couzens [Tue, 6 Aug 2013 03:29:45 +0000 (05:29 +0200)]
thread-mq: Support a mainloop as thread/consumer

This is needed by the tunnel module rewrite, which runs pa_mainloop in
the IO thread instead of pa_rtpoll.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
11 years agoi18n: Update zh_TW translation
Cheng-Chia Tseng [Tue, 6 Aug 2013 03:47:39 +0000 (09:17 +0530)]
i18n: Update zh_TW translation

https://bugs.freedesktop.org/show_bug.cgi?id=56454

11 years agocli: Use pa_xnew0 to save some 0 inits
Peter Meerwald [Mon, 29 Jul 2013 20:13:42 +0000 (22:13 +0200)]
cli: Use pa_xnew0 to save some 0 inits

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
11 years agopacmd: Discriminate between interactive and non-interactive mode
Peter Meerwald [Mon, 29 Jul 2013 20:13:41 +0000 (22:13 +0200)]
pacmd: Discriminate between interactive and non-interactive mode

interactive sessions are initiated with a hello message in order to
receive a welcome message from the PA daemon and a command prompt

interactive sessions have a terminal connected to stdin

non-interactive sessions execute commands given on the command line
or received via stdin; non-interactive sessions have neither welcome
message nor command prompt

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
11 years agocli: Output prompt and welcome message only when requested by 'hello'
Peter Meerwald [Mon, 29 Jul 2013 20:13:40 +0000 (22:13 +0200)]
cli: Output prompt and welcome message only when requested by 'hello'

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
11 years agoalsa-mixer: Prefer moving "Capture" before moving boosts
David Henningsson [Fri, 2 Aug 2013 13:03:26 +0000 (15:03 +0200)]
alsa-mixer: Prefer moving "Capture" before moving boosts

Some HD-audio codecs (at least ALC269VB and ALC283) become quite noisy on
high Mic Boost levels. So e g, if there is a "Mic Boost" and a "Capture"
control, both ranging from 0 dB to +30 dB, you get better quality if
"Mic Boost" is 0 dB and "Capture" is +30 dB, than the other way around.

By changing the order in the configuration files, this patch makes us prefer
leaving "Mic Boost" low and "Capture" high if the user selects a medium gain.

(This is based on limited experience, and there is no guarantee that there are
no sound cards that work the other way around, and therefore this patch could
potentially regress quality on those machines. Hopefully those are fewer, so
this is what we should default to.)

BugLink: https://bugs.launchpad.net/1085402
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
11 years agosample: Apply SPARC-specific condition on SPARC only
Arun Raghavan [Tue, 30 Jul 2013 09:21:59 +0000 (14:51 +0530)]
sample: Apply SPARC-specific condition on SPARC only

Improves correctness, unbreaks software volume in recent Android.

11 years agoFix typos in command_names
Kerrick Staley [Sun, 21 Jul 2013 08:08:43 +0000 (01:08 -0700)]
Fix typos in command_names

11 years agoresampler: Fix peaks resampler's channel handling
Tanu Kaskinen [Wed, 10 Jul 2013 18:48:40 +0000 (21:48 +0300)]
resampler: Fix peaks resampler's channel handling

In the resampling phase the input and output data have the same number
of channels (o_ss.channels).

11 years agoloopback: Increase the maximum allowed latency
Tanu Kaskinen [Tue, 16 Jul 2013 11:12:42 +0000 (14:12 +0300)]
loopback: Increase the maximum allowed latency

Currently the biggest possible sink latency is 10 seconds. The total
latency of the loopback is divided evenly for the source, an
intermediate buffer and the sink, so if I want to test 10 s sink
latency, the total needs to be three times that, i.e. 30 seconds.

11 years agoalsa-ucm: Make combination ports have lower priority
David Henningsson [Fri, 19 Jul 2013 14:38:16 +0000 (16:38 +0200)]
alsa-ucm: Make combination ports have lower priority

Usually, you want to use one input or output at a time: e g,
you expect your speaker to mute when you plug in headphones.

Therefore, the headphones+speaker port should have lower priority
and both headphones and speaker.

A practical formula to do this is 1/x = 1/xa + 1/xb + .. + 1/xn.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
11 years agodaemon.conf: Document new speex-float-1 default
David Henningsson [Tue, 23 Jul 2013 13:58:42 +0000 (15:58 +0200)]
daemon.conf: Document new speex-float-1 default

We document the default values in daemon.conf, but this was not
updated when we changed the default from speex-float-3 to speex-float-1.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
11 years agovala: Add CVolume.set()
Tanu Kaskinen [Thu, 18 Jul 2013 06:16:22 +0000 (09:16 +0300)]
vala: Add CVolume.set()

Thanks to Alberto Ruiz for the patch.

11 years agodbus: Fix invalid dbus_bool_t values
Tanu Kaskinen [Wed, 17 Jul 2013 20:14:24 +0000 (23:14 +0300)]
dbus: Fix invalid dbus_bool_t values

libdbus doesn't like it if it's passed a boolean whose value is not 0
nor 1.

11 years agosink: Add missing curly braces
Tanu Kaskinen [Tue, 16 Jul 2013 10:58:47 +0000 (13:58 +0300)]
sink: Add missing curly braces

The missing braces didn't cause any practical problems, but obviously
the intention was to reset the chunk only if the memblock was
non-NULL.

11 years agopactl: Print available flag of card profiles
Luiz Augusto von Dentz [Mon, 15 Jul 2013 15:21:26 +0000 (18:21 +0300)]
pactl: Print available flag of card profiles

11 years agointrospect: Expose card profile available flag
Luiz Augusto von Dentz [Mon, 15 Jul 2013 15:21:25 +0000 (18:21 +0300)]
introspect: Expose card profile available flag

Available flag can be used by clients to disable the selection of
profiles unavailable.

Update protocol to 29

11 years agoucm: Fix an incorrect log message
Tanu Kaskinen [Thu, 27 Jun 2013 16:19:14 +0000 (19:19 +0300)]
ucm: Fix an incorrect log message

The log message didn't match the code, so one of them was wrong. It's
entirely possible that the code is wrong, but I didn't have the
motivation to study the code enough to understand what the code is
supposed to do.

11 years agolog: Harmonize log target output
Tanu Kaskinen [Thu, 20 Jun 2013 14:24:28 +0000 (17:24 +0300)]
log: Harmonize log target output

The file targets used different output format than stderr and syslog.
That's now fixed.

11 years agolog: Use pa_write() instead of write()
Tanu Kaskinen [Thu, 20 Jun 2013 14:24:27 +0000 (17:24 +0300)]
log: Use pa_write() instead of write()

11 years agolog: Remove pa_log_set_fd()
Tanu Kaskinen [Thu, 20 Jun 2013 14:24:26 +0000 (17:24 +0300)]
log: Remove pa_log_set_fd()

The function isn't used any more.

11 years agobuild-sys: Fix misuse of "dependant"
João Paulo Rechi Vita [Fri, 12 Jul 2013 17:51:25 +0000 (14:51 -0300)]
build-sys: Fix misuse of "dependant"

Dependant in British English is a person who is financially supported by
someone else. To express software dependency relations "dependent"
should be used instead, which is correct for both British and US
English.

11 years agobluetooth: Fix coding style
João Paulo Rechi Vita [Fri, 12 Jul 2013 17:51:24 +0000 (14:51 -0300)]
bluetooth: Fix coding style

11 years agobluetooth: Remove unused DBusError
João Paulo Rechi Vita [Fri, 12 Jul 2013 17:51:23 +0000 (14:51 -0300)]
bluetooth: Remove unused DBusError

11 years agomodule: Fix style
João Paulo Rechi Vita [Fri, 12 Jul 2013 17:51:22 +0000 (14:51 -0300)]
module: Fix style

11 years agotunnel: Fix reading state from wrong variable
Tanu Kaskinen [Sun, 14 Jul 2013 10:39:32 +0000 (13:39 +0300)]
tunnel: Fix reading state from wrong variable

u->sink->state is not yet updated, so the state must be read from
u->sink->thread_info.state. This makes pausing and resuming of the
smoother happen at the right time.

Thanks to Pierre Ossman for the patch.

11 years agocaps: Fix compilation on Windows
Tanu Kaskinen [Sun, 14 Jul 2013 10:26:24 +0000 (13:26 +0300)]
caps: Fix compilation on Windows

Thanks to Pierre Ossman for the patch.

11 years agoalsa: Support ALSA without a use case manager
Pierre Ossman [Wed, 10 Jul 2013 14:26:17 +0000 (16:26 +0200)]
alsa: Support ALSA without a use case manager

The ALSA use case manager is a fairly recent addition,
so make sure the ALSA modules can be used on systems that
have an older version of ALSA.

11 years agolog: Fix thread name printing
Tanu Kaskinen [Thu, 11 Jul 2013 11:14:29 +0000 (14:14 +0300)]
log: Fix thread name printing

Not all threads have a name.

Thanks to Pierre Ossman for the patch.

11 years agomodule: Fix crash in pa_module_unload_all()
Tanu Kaskinen [Thu, 11 Jul 2013 10:35:24 +0000 (13:35 +0300)]
module: Fix crash in pa_module_unload_all()

Previously, if there were no modules loaded when the daemon exited,
pa_module_unload_all() would crash due to giving zero count to
pa_xnew().

Thanks to Pierre Ossman for the patch.

11 years agoRevert "resampler: Resample first followed by remapping if have more out channels...
Tanu Kaskinen [Wed, 10 Jul 2013 18:24:04 +0000 (21:24 +0300)]
Revert "resampler: Resample first followed by remapping if have more out channels than in channels"

This reverts commit 30ce3a14e5ae1cd316a18bec95b831c07ac57a1a.

The commit broke the leftover buffer handling, see [1] for more
information.

[1] http://thread.gmane.org/gmane.comp.audio.pulseaudio.general/17479/focus=17487

11 years agosink-input: Keep reference ratio up-to-date
Tanu Kaskinen [Wed, 3 Apr 2013 15:28:32 +0000 (18:28 +0300)]
sink-input: Keep reference ratio up-to-date

The reference ratio should always be kept up-to-date. If the reference
ratio is not updated when the input volume changes, the stale
reference ratio ends up being used as the new input volume when the
input is moved.

11 years agoUse pa_(c)volume_snprint_verbose() everywhere
Tanu Kaskinen [Wed, 3 Apr 2013 13:36:43 +0000 (16:36 +0300)]
Use pa_(c)volume_snprint_verbose() everywhere

All pa_cvolume_snprint(), pa_volume_snprint(),
pa_sw_cvolume_snprint_dB() and pa_sw_volume_snprint_dB() calls have
been replaced with pa_cvolume_snprint_verbose() and
pa_volume_snprint_verbose() calls, making the log output more
informative and the code sometimes simpler.

11 years agopulse: Add verbose volume printing functions
Tanu Kaskinen [Wed, 3 Apr 2013 13:36:42 +0000 (16:36 +0300)]
pulse: Add verbose volume printing functions

For more informative logging.

11 years agoloopback: Fix cork state not updated after move
Mikel Astiz [Mon, 1 Jul 2013 08:27:21 +0000 (10:27 +0200)]
loopback: Fix cork state not updated after move

The source output and sink inputs should be corked if the corresponding
sink/source is suspended, as handled during module initialization. This
also needs to be handled during stream move, because the suspend state
of the destination sink/source might be different to the previous one.

This fixes the issue with an infinite number of "Requesting rewind due
to end of underrun" traces after a stream move.

11 years agosconv: avoid multiply in ARM NEON s16->float conversion
Peter Meerwald [Tue, 2 Jul 2013 12:06:04 +0000 (14:06 +0200)]
sconv: avoid multiply in ARM NEON s16->float conversion

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
11 years agosconv: avoid multiply in ARM NEON float->s16 conversion
Peter Meerwald [Tue, 2 Jul 2013 09:43:35 +0000 (11:43 +0200)]
sconv: avoid multiply in ARM NEON float->s16 conversion

optimization idea taken from libavresample

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
11 years agochannelmap, volume: Don't refer to bool in the public API documentation
Tanu Kaskinen [Thu, 4 Jul 2013 09:20:15 +0000 (12:20 +0300)]
channelmap, volume: Don't refer to bool in the public API documentation

11 years agomainloop-test: Use FALSE instead of false for gboolean
Tanu Kaskinen [Thu, 4 Jul 2013 09:33:47 +0000 (12:33 +0300)]
mainloop-test: Use FALSE instead of false for gboolean

11 years agomacro: Remove unneeded typedef for pa_bool_t.
poljar (Damir Jelić) [Fri, 28 Jun 2013 10:55:27 +0000 (12:55 +0200)]
macro: Remove unneeded typedef for pa_bool_t.

11 years agoRevert windows BOOL variables to use TRUE/FALSE instead of true/false
poljar (Damir Jelić) [Thu, 27 Jun 2013 23:09:24 +0000 (01:09 +0200)]
Revert windows BOOL variables to use TRUE/FALSE instead of true/false

11 years agoRevert dbus_bool_t variables to use TRUE/FALSE instead of true/false
poljar (Damir Jelić) [Thu, 27 Jun 2013 23:08:31 +0000 (01:08 +0200)]
Revert dbus_bool_t variables to use TRUE/FALSE instead of true/false

11 years agoFix alignment issues introduced by the pa_bool -> bool conversion
poljar (Damir Jelić) [Thu, 27 Jun 2013 23:03:47 +0000 (01:03 +0200)]
Fix alignment issues introduced by the pa_bool -> bool conversion

11 years agoRemove pa_bool_t and replace it with bool.
poljar (Damir Jelić) [Thu, 27 Jun 2013 17:28:09 +0000 (19:28 +0200)]
Remove pa_bool_t and replace it with bool.

commands used for this (executed from the pulseaudio/src directory):
    find . -regex '\(.*\.[hc]\|.*\.cc\|.*\.m4\)' -not -name 'macro.h' \
        -a -not -name 'reserve.[ch]' -a -not -name 'reserve-monitor.[ch]' \
        -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
        -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
        -a -not -name 'poll-win32.c' -a -not -name 'thread-win32.c' \
        -a -not -name 'dllmain.c' -a -not -name 'gconf-helper.c' \
        -exec sed -i -e 's/\bpa_bool_t\b/bool/g' \
        -e 's/\bTRUE\b/true/g' -e 's/\bFALSE\b/false/g' {} \;

and:
    sed -i -e '181,194!s/\bpa_bool_t\b/bool/' \
        -e '181,194!s/\bTRUE\b/true/' -e \
        '181,194!s/\bFALSE\b/false/' pulsecore/macro.h

11 years agobuild-sys: Add native-instruments-traktor-audio2.conf to Makefile.am
Tanu Kaskinen [Wed, 3 Jul 2013 12:20:28 +0000 (15:20 +0300)]
build-sys: Add native-instruments-traktor-audio2.conf to Makefile.am

Thanks to Jan Steffens for reporting the issue.

11 years agodevice-manager: Refuse to load empty descriptions
Tanu Kaskinen [Tue, 2 Jul 2013 14:46:11 +0000 (17:46 +0300)]
device-manager: Refuse to load empty descriptions

11 years agoRevert "alsa-mixer: Add a couple of assertions"
David Henningsson [Fri, 28 Jun 2013 14:16:22 +0000 (16:16 +0200)]
Revert "alsa-mixer: Add a couple of assertions"

This reverts commit 2613e4c74733e67d56af165df4637bf902b08508.

Please don't replace correct NULL pointer checks with assertions.

11 years agodevice-manager: Add a sanity check for reading entries
Tanu Kaskinen [Tue, 4 Jun 2013 17:42:48 +0000 (20:42 +0300)]
device-manager: Add a sanity check for reading entries

There is code elsewhere that assumes that if user_set_description is
true, then the description is non-NULL.

11 years agowaveout: Simplify setting the device description
Tanu Kaskinen [Fri, 31 May 2013 19:27:19 +0000 (22:27 +0300)]
waveout: Simplify setting the device description

11 years agoalsa-mixer: Add a couple of assertions
Tanu Kaskinen [Thu, 27 Jun 2013 15:47:12 +0000 (18:47 +0300)]
alsa-mixer: Add a couple of assertions

I checked the code to ensure that the assertions hold currently.

11 years agodynarray: Reimplement with nicer semantics
Tanu Kaskinen [Wed, 26 Jun 2013 13:13:47 +0000 (16:13 +0300)]
dynarray: Reimplement with nicer semantics

A dynamic array is a nice simple container, but the old interface
wasn't quite what I wanted it to be. I like GLib's way of providing
the free callback at the container creation time, because that way
the free callback doesn't have to be given every time something is
removed from the array.

The allocation pattern was changed too: instead of increasing the
array size always by 25 when the array gets full, the size gets
doubled now (the lowest non-zero size is still 25).

The array can't store NULL pointers anymore, and pa_dynarray_get() was
changed so that it's forbidden to try to access elements outside the
valid range.

The set of supported operations may seem a bit arbitrary. The
operation set is by no means complete at this point. I have included
only those operations that are required by the current code and some
unpublished code of mine.

11 years agosource: Fix an indentation mistake
Tanu Kaskinen [Wed, 26 Jun 2013 18:21:00 +0000 (21:21 +0300)]
source: Fix an indentation mistake

11 years agoobject: Initialize allocated memory to zero
Tanu Kaskinen [Wed, 19 Jun 2013 15:40:17 +0000 (18:40 +0300)]
object: Initialize allocated memory to zero

This is safer and more convenient for subclasses.

11 years agodevice-port: Assert that ports have a description
Tanu Kaskinen [Wed, 19 Jun 2013 15:39:58 +0000 (18:39 +0300)]
device-port: Assert that ports have a description

It's easier to work with the port description if it can be assumed
that it's always non-NULL. I have checked that the current code base
always ensures a non-NULL description.

11 years agoprotocol-esound/http/simple: Make sure callers can handle iochannel_write changes
David Henningsson [Mon, 24 Jun 2013 15:29:26 +0000 (17:29 +0200)]
protocol-esound/http/simple: Make sure callers can handle iochannel_write changes

With the new behaviour, you will not always get a callback after a
successful write. Make sure the callers can properly handle this.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
11 years agoWhitespace cleanup: Remove all multiple newlines
poljar (Damir Jelić) [Tue, 18 Jun 2013 20:17:48 +0000 (22:17 +0200)]
Whitespace cleanup: Remove all multiple newlines

This patch removes all occurrences of double and triple
newlines.

Command used for this:
find .  -type d \( -name ffmpeg \) -prune -o \
        -regex '\(.*\.[hc]\|.*\.cc\)' \
        -a -not -name 'adrian-aec.*' -a -not \
        -name reserve.c -a -not -name 'rtkit.*' \
        -exec sed -i -e '/^$/{N;s/^\n$//}' {} \;

Two passes were needed to remove triple newlines.
The excluded files are mirrored files from external sources.

11 years agoStyle fix: Remove new lines from opening brackets
poljar (Damir Jelić) [Tue, 18 Jun 2013 20:24:24 +0000 (22:24 +0200)]
Style fix: Remove new lines from opening brackets

This patch replaces every occurrence of ')\n{' with ') {'.

Command used for this:
    find .  -type d \( -name ffmpeg \) -prune -o \
        -regex '\(.*\.[hc]\|.*\.cc\)' \
        -a -not -name core-util.c -a -not \
        -name adrian-aec.c -a -not -name g711.c \
        -exec sed -i -e '/)$/{N;s/)\n{$/) {/}' {} \;

The excluded files are mirrored files from external sources.

11 years agoStyle fix: Add a space between the closing/opening bracket
poljar (Damir Jelić) [Tue, 18 Jun 2013 14:45:30 +0000 (16:45 +0200)]
Style fix: Add a space between the closing/opening bracket

This patch replaces every occurrence of '){' with ') {'.
The ffmpeg source tree was excluded since it will disappear anyways.

Command used for this:
    find . -type d \( -name ffmpeg \) -prune -o \
        -regex '\(.*\.[hc]\|.*\.cc\)' \
        -exec sed -i -e 's/){/) {/' {} \;

11 years agoStyle fix: Add a space betwen the if statement and the opening bracket
poljar (Damir Jelić) [Tue, 18 Jun 2013 14:45:20 +0000 (16:45 +0200)]
Style fix: Add a space betwen the if statement and the opening bracket

This patch replaces every occurrence of 'if(' with 'if ('.
The ffmpeg source tree was excluded since it will disappear anyways.

Command used for this:
    find . -type d \( -name ffmpeg \) -prune -o \
            -regex '\(.*\.[hc]\|.*\.cc\)' \
            -exec sed -i -e 's/ if(/ if (/' {} \;

11 years agoWhitespace cleanup: Fix broken indentation by hand
poljar (Damir Jelić) [Tue, 18 Jun 2013 19:53:37 +0000 (21:53 +0200)]
Whitespace cleanup: Fix broken indentation by hand

This patch fixes wrong indentation introduced by the last patch.

This was mostly done with vim-s retab feature.

11 years agoWhitespace cleanup: Remove tabs
poljar (Damir Jelić) [Tue, 18 Jun 2013 19:39:30 +0000 (21:39 +0200)]
Whitespace cleanup: Remove tabs

This patch removes all tabs hidden inside the source tree and replaces
them with 4 spaces.

Command used for this:
    find . -type d \( -name bluetooth \) -prune -o
    -regex '\(.*\.[hc]\|.*\.cc\)' -a -not -name 'reserve*.[ch]'
    -a -not -name 'gnt*.h' -a -not -name 'adrian*'
    -exec sed -i -e 's/\t/    /g' {} \;

The excluded files are mirrored files from external sources containing
tabs.

11 years ago.gitignore: Add build-aux
Tanu Kaskinen [Sun, 23 Jun 2013 07:31:13 +0000 (10:31 +0300)]
.gitignore: Add build-aux

11 years agocore-util: Fix log message levels
Tanu Kaskinen [Sun, 23 Jun 2013 07:23:10 +0000 (10:23 +0300)]
core-util: Fix log message levels

This code is from heftig, but the mistake that I'm fixing here is my
own. Before applying heftig's patch, I downgraded the level of one of
the log messages. I managed to downgrade a different message than what
I intended, so now I'm undoing that mistake.

11 years agolog: Fix error message
Tanu Kaskinen [Thu, 20 Jun 2013 14:19:15 +0000 (17:19 +0300)]
log: Fix error message

file_path contains the last tried file name, including the suffix, so
the error message was wrong:

    Tried to open target file '/tmp/test.log.99', '/tmp/test.log.99.1',
    '/tmp/test.log.99.2' ... '/tmp/test.log.99.99', but all failed.

11 years agocli, log: Improve the set-log-target functionality
Shuai Fan [Wed, 19 Jun 2013 03:59:08 +0000 (11:59 +0800)]
cli, log: Improve the set-log-target functionality

Add a new log target 'newfile:PATH', and refactoring 'pa_log_target_type'.

Signed-off-by: Shuai Fan <shuai900217@126.com>
11 years agobluetooth: Fix too late assertion
Tanu Kaskinen [Wed, 5 Jun 2013 14:45:06 +0000 (17:45 +0300)]
bluetooth: Fix too late assertion

u was dereferenced before the assertion that checks that u isn't NULL.

11 years agocombine: Fix crash in output freeing
Tanu Kaskinen [Tue, 18 Jun 2013 18:21:08 +0000 (21:21 +0300)]
combine: Fix crash in output freeing

The outputs are removed from the idxset before output_free() is
called. Trying to remove them again in output_free(), and asserting
that it should succeed caused crashing whenever outputs were freed.

This bug was introduced in commit
061878b5a47ed9aa05d12430b039874b63c29a84.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=65901
11 years agozeroconf: Fix pa_mainloop_api_once usage
Arun Raghavan [Mon, 17 Jun 2013 12:41:08 +0000 (18:11 +0530)]
zeroconf: Fix pa_mainloop_api_once usage

We need the mainloop lock to be taken around pa_mainloop_api_once() to
prevent an assert due to the defer event creation and setting of the
destroy callback not being performed atomically.

11 years agomainloop: Document need for mainloop lock around pa_mainloop_api_once
Arun Raghavan [Mon, 17 Jun 2013 12:37:42 +0000 (18:07 +0530)]
mainloop: Document need for mainloop lock around pa_mainloop_api_once

This needs us to expose a bit of implementation detail, but this seems
to be the cleanest way without an API change.

The specific problem is that pa_mainloop_api_once() needs to first
create a defer event and then set its destroy callback. If the defer
event is completed before the callback is set, an assert will be
trigerred.

11 years agopstream: Fixup hangs caused by recent iochannel patch
David Henningsson [Mon, 17 Jun 2013 06:52:07 +0000 (08:52 +0200)]
pstream: Fixup hangs caused by recent iochannel patch

Now that we don't *always* get a callback after having written
something, make sure we can continue writing as long as it fully
succeeds.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
11 years agosink-input: Log format negotiation better
Arun Raghavan [Sat, 15 Jun 2013 04:12:02 +0000 (09:42 +0530)]
sink-input: Log format negotiation better

This provides more details on format negotiation success and failure to
make debugging problems easier.

11 years agoiochannel: Document modified pa_iochannel_write return value
Arun Raghavan [Fri, 14 Jun 2013 11:42:03 +0000 (17:12 +0530)]
iochannel: Document modified pa_iochannel_write return value

11 years agoiochannel: Avoid unnecessary wakeup after successful write
David Henningsson [Thu, 13 Jun 2013 12:26:09 +0000 (14:26 +0200)]
iochannel: Avoid unnecessary wakeup after successful write

To save some CPU (in low latency scenarios), don't re-enable the
"writable" event after it has succeeded. It is very likely the next
write will succeed right away too.

This means that we always need to handle EAGAIN/EWOULDBLOCK as a
successful write of 0 bytes, so I also verified that all callers to
pa_iochannel_write handled this correctly.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
11 years agoalsa: Fix "Scheduling delay of..." message
David Henningsson [Wed, 12 Jun 2013 11:49:05 +0000 (13:49 +0200)]
alsa: Fix "Scheduling delay of..." message

The tsched_watermark is in bytes, not in usecs. Fix this by introducing
a new variable, and also use that variable in some places for optimisation.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>