paraslash.git
10 years agobuild: Move relevant parts to client section.
Andre Noll [Sat, 14 Sep 2013 03:10:51 +0000 (03:10 +0000)]
build: Move relevant parts to client section.

These parts belong to the client section at the bottom of configure.ac.
This also gets rid of @client_ldflags@.

10 years agobuild: Move relevant parts to server section.
Andre Noll [Sat, 14 Sep 2013 03:05:10 +0000 (03:05 +0000)]
build: Move relevant parts to server section.

Currently $server_errlist_objs is updated whenever a feature that
affects para_server was detected. This mix of feature detection and
build options is hard to maintain and error-prone, so let's move the
definition of $server_errlist_objs to the already existing section
for para_server.

The patch also kills the unused @server_ldflags@ output variable.

10 years agobuild: Create section for para_audioc.
Andre Noll [Sat, 14 Sep 2013 02:49:43 +0000 (02:49 +0000)]
build: Create section for para_audioc.

This moves everything related to para_audioc to the bottom of
configure.ac and kills @audioc_ldflags@.

10 years agobuild: Create section for para_write.
Andre Noll [Sat, 14 Sep 2013 02:46:37 +0000 (02:46 +0000)]
build: Create section for para_write.

This moves all parts of configure.ac related to para_write to a
separate section at the bottom and kills @write_ldflags@.

The patch also fixes a minor issue for setups where libao is the only
"real" writer. Previously we used FILE_WRITE as the default writer
in this case. This commit changes it to AO_WRITE.

10 years agobuild: Create section for para_play.
Andre Noll [Sat, 14 Sep 2013 02:35:14 +0000 (02:35 +0000)]
build: Create section for para_play.

This moves all parts related to para_play to a separate section
at the bottom of configure.ac and gets rid of the output variable
@play_ldflags@ in favor of a simple LDFLAGS setting.

10 years agobuild: Create section for para_afh.
Andre Noll [Sat, 14 Sep 2013 02:20:00 +0000 (02:20 +0000)]
build: Create section for para_afh.

This moves those parts of configure.ac related to para_afh to an
own section at the bottom and gets rid of the unused @afh_ldflags@
output variable.

10 years agobuild: Create section for para_recv.
Andre Noll [Sat, 14 Sep 2013 02:08:51 +0000 (02:08 +0000)]
build: Create section for para_recv.

Similar to the previous patch, this moves the creation of
$recv_cmdline_objs and $recv_errlist_objs to a separate section at
the end of configure.ac and gets rid of the now unused @recv_ldflags@
output variable.

10 years agobuild: Create section for para_filter.
Andre Noll [Sat, 14 Sep 2013 01:48:41 +0000 (01:48 +0000)]
build: Create section for para_filter.

Currently, the construction of $filters, $filter_errlist_objs and
$filter_cmdline_objs is spread out over configure.ac as each test
modifies these variables.

The code in configure.ac becomes easier to read if these variables
are set up in a separate section after all tests have been performed.

This patch also gets rid of filter_ldflags. Due to the previous
cleanups, it only contained -lm which is now added in Makefile.in,
along with all other linker flags for para_filter.

10 years agobuild: ldflags conversion: coreaudio.
Andre Noll [Fri, 13 Sep 2013 07:13:03 +0000 (07:13 +0000)]
build: ldflags conversion: coreaudio.

Straight-forward transformation, relevant to MacOS only.

10 years agobuild: ldflags conversion: libcurses.
Andre Noll [Fri, 13 Sep 2013 07:07:11 +0000 (07:07 +0000)]
build: ldflags conversion: libcurses.

Straight-forward as only para_gui depends on the curses lib.

10 years agobuild: ldflags conversion: libnsl.
Andre Noll [Fri, 13 Sep 2013 06:54:42 +0000 (06:54 +0000)]
build: ldflags conversion: libnsl.

Similar to the previous patch, this converts the ldflags needed
for nsl and gets rid of the useless check for inet_ntoa().

10 years agobuild: ldflags conversion: libsocket.
Andre Noll [Fri, 13 Sep 2013 06:49:50 +0000 (06:49 +0000)]
build: ldflags conversion: libsocket.

This converts the ldflags needed for the socket/connect system calls
in the usual way. It also drops the check for the connect() system
call, as it should always be either in -lc or -lsocket.

10 years agobuild: ldflags conversion: libgcrypt.
Andre Noll [Fri, 13 Sep 2013 06:37:51 +0000 (06:37 +0000)]
build: ldflags conversion: libgcrypt.

Analogous to the previous patch.

10 years agobuild: ldflags conversion: libssl.
Andre Noll [Fri, 13 Sep 2013 06:35:04 +0000 (06:35 +0000)]
build: ldflags conversion: libssl.

Straight-forward transformation.

10 years agobuild: ldflags conversion: libosl.
Andre Noll [Fri, 13 Sep 2013 06:28:55 +0000 (06:28 +0000)]
build: ldflags conversion: libosl.

Straight-forward transformation.

10 years agobuild: ldflags conversion: libsamplerate.
Andre Noll [Fri, 13 Sep 2013 06:23:53 +0000 (06:23 +0000)]
build: ldflags conversion: libsamplerate.

Straight-forward transformation.

10 years agobuild: ldflags conversion: libreadline.
Andre Noll [Fri, 13 Sep 2013 06:18:01 +0000 (06:18 +0000)]
build: ldflags conversion: libreadline.

This also renames readline_libs to readline_ldflags, just to make
the naming more consistent to the other tests.

10 years agobuild: ldflags conversion: libao.
Andre Noll [Fri, 13 Sep 2013 06:12:38 +0000 (06:12 +0000)]
build: ldflags conversion: libao.

10 years agobuild: ldflags conversion: alsa.
Andre Noll [Fri, 13 Sep 2013 06:07:09 +0000 (06:07 +0000)]
build: ldflags conversion: alsa.

Again, a straight-forward transformation.

10 years agobuild: ldflags conversion: liboss.
Andre Noll [Fri, 13 Sep 2013 06:00:22 +0000 (06:00 +0000)]
build: ldflags conversion: liboss.

Straight-forward change, no cppflags necessary.

10 years agobuild: ldflags conversion: libflac.
Andre Noll [Fri, 13 Sep 2013 05:55:25 +0000 (05:55 +0000)]
build: ldflags conversion: libflac.

This converts the handling of the libflac linker flags, just like
the previous patches did for other libraries.

10 years agobuild: ldflags conversion: libmad.
Andre Noll [Fri, 13 Sep 2013 05:52:57 +0000 (05:52 +0000)]
build: ldflags conversion: libmad.

Usual conversion from per-executable variables in configure.ac to
per-library autoconf output variable + per-target LDFLAGS setting.

10 years agobuild: ldflags conversion: libfaad.
Andre Noll [Fri, 13 Sep 2013 05:47:41 +0000 (05:47 +0000)]
build: ldflags conversion: libfaad.

This adds the linker flags for libfaad to LDFLAGS in Makefile.in
for those targets that need it. This avoids some duplication in
configure.ac. No cppflags conversion in this patch.

10 years agobuild: ldflags/cppflags conversion: libopus.
Andre Noll [Fri, 13 Sep 2013 05:42:58 +0000 (05:42 +0000)]
build: ldflags/cppflags conversion: libopus.

Again, the --with-opus-headers option was ignored completely. In fact
opus_cppflags was not even mentioned in Makefile.in.

Fix this and also convert opus_ldflags as usual.

10 years agobuild: cppflags/ldflags conversion: libspeex.
Andre Noll [Fri, 13 Sep 2013 05:36:22 +0000 (05:36 +0000)]
build: cppflags/ldflags conversion: libspeex.

This fixes the --with-speex-headers option, which has never worked,
by adding the speex_cppflags output variable and including the given
flags in CPPFLAGS for the three objects that need it.

The straight-forward conversion for speex linker flags is also
performed in this patch.

10 years agobuild: ldflags conversion: libvorbis.
Andre Noll [Fri, 13 Sep 2013 05:31:09 +0000 (05:31 +0000)]
build: ldflags conversion: libvorbis.

Same rationale as the previous patch, this time with vorbis_ldflags.

10 years agobuild: ldflags conversion: libogg.
Andre Noll [Fri, 13 Sep 2013 05:24:07 +0000 (05:24 +0000)]
build: ldflags conversion: libogg.

The next step on the way to the removing the per-executable ldflags
variables.  This sets ogg_ldflags in configure.ac, creates an output
variable from it, and adds it to LDFLAGS in Makefile.in for all
executables that need it.

10 years agobuild: cppflags/ldflags conversion: libid3tag
Andre Noll [Fri, 13 Sep 2013 05:12:58 +0000 (05:12 +0000)]
build: cppflags/ldflags conversion: libid3tag

This removes the rule for mp3_afh.o so that this object will instead
be created by means of the generic rule. To make this work, CPPFLAGS is
modified for this target to include suitable cpp options for libid3tag
as determined during configure.

Similarly, the linker flags for libid3tag are removed from
server_ldflags, afh_ldflags, play_ldflags, recv_ldflags and
play_ldflags, and appropriate linker flags are added to LDFLAGS for
all executables that need it.

10 years agobuild: Remove duplicates from $all_objs.
Andre Noll [Fri, 13 Sep 2013 03:13:38 +0000 (03:13 +0000)]
build: Remove duplicates from $all_objs.

In Makefile.in $all_objs is defined as the concatenation of the
object lists of all executables. This variable is used to determine
the set of dependency files to include. Since the concatenation
contains common objects more than once, we currently include common
dependencies multiple times.

This is not a problem, but it may slow down the build. The make sort
function removes duplicate words, so by sorting $all_objs we make
sure to include each dependency file only once.

10 years agobuild: Remove inactive DEBUG_CPPFLAGS.
Andre Noll [Fri, 13 Sep 2013 02:35:23 +0000 (02:35 +0000)]
build: Remove inactive DEBUG_CPPFLAGS.

These were commented out for some years, and don't really add any
value.

10 years agobuild: Replace error2.pl by error2.c.
Andre Noll [Fri, 13 Sep 2013 01:41:15 +0000 (01:41 +0000)]
build: Replace error2.pl by error2.c.

The C code is much faster than the old perl script. Since the resulting
executable runs on the build system, the compiler for this system
must be called to compile error2.c. The new HOSTCC variable takes
care of this.

With this patch applied, the only remaining dependencies on perl are
help2man and autoconf.

10 years agobuild: Fix filter output of configure summary.
Andre Noll [Sat, 26 Oct 2013 05:26:01 +0000 (07:26 +0200)]
build: Fix filter output of configure summary.

The $filters variable contained newlines, which made the output
rather ugly.

10 years agobuild: Convert remaining object lists to one object per line format.
Andre Noll [Sat, 26 Oct 2013 05:24:31 +0000 (07:24 +0200)]
build: Convert remaining object lists to one object per line format.

This makes patches easier to read and eases conflict handling.

10 years agobuild: Separate curses detection from gui configuration.
Andre Noll [Sun, 8 Sep 2013 01:11:16 +0000 (01:11 +0000)]
build: Separate curses detection from gui configuration.

It's cleaner to separate feature/library detection from the logic
that decides whether an executable can be built.

This patch creates a separate section for para_gui which contains
the list of all objects for para_gui and sets $build_gui to either
"yes" or "no", depending on whether a usable curses library was found.

10 years agobuild: Move down fade section.
Andre Noll [Fri, 6 Sep 2013 01:39:20 +0000 (01:39 +0000)]
build: Move down fade section.

The logic which checks whether an executable can be build on the
given system should come after the tests for features and libraries.
The section for the para_fade executable violates this rule, so move
it down to where it belongs.

10 years agobuild: Add object "cmdline" suffix only once.
Andre Noll [Sun, 8 Sep 2013 01:10:56 +0000 (01:10 +0000)]
build: Add object "cmdline" suffix only once.

This is equivalent, but it is both simpler and less error-prone than
calling add_cmdline() for each check. Change all affected assignments
to the one-line-per-object format while we're at it.

10 years agoINSTALL: Add an example for cross-compiling.
Andre Noll [Thu, 5 Sep 2013 03:51:19 +0000 (03:51 +0000)]
INSTALL: Add an example for cross-compiling.

These are the commands I use to compile paraslash on the raspberry pi.

10 years agobuild: Fix make install for cross builds.
Andre Noll [Fri, 30 Aug 2013 05:02:06 +0000 (05:02 +0000)]
build: Fix make install for cross builds.

make install discards symbols from executables by using the -s option
to the install command. If no install command was detected at configure
time, the install-sh script shipped in the paraslash source tree is
used instead.

This is currently broken for cross-builds because install -s runs the
native strip command by default but the cross-strip is required here.

Both the install script and the install command from gnu coreutils
support custom strip commands, but the syntax for specifying these are
different. A decent install program is available at least on FreeBSD,
NetBSD, MacOS and Linux, so let's just kill the script and use the
--strip-command option of the install program to allow the user to
specify a suitable cross-strip.

10 years agobuild: Generate man pages directly from ggo files.
Andre Noll [Fri, 30 Aug 2013 00:10:41 +0000 (00:10 +0000)]
build: Generate man pages directly from ggo files.

Currently all man pages are created by help2man which executes the
para_xxx binaries just compiled with the --detailed-help and --version
options given to obtain the input for the man page to create.

The obvious shortcoming of this approach is that it simply does not
work when cross-compiling. There is another disadvantage though: Since
the man page file (para_xxx.1) depends on the executable (para_xxx),
any code change causes all affected man pages to be recreated, even
if nothing has changed that would alter the man page content.

The good news is that gengetopt can create the help output without
generating or compiling any code. The bad news is that help2man
insists on executing a program with --help and --version to get the
output.

This commit teaches Makefile to create a dummy shell script for each
executable which accepts the above options and runs gengetopt on the
.ggo file to obtain the help text.

This makes cross-compiling possible and shortens rebuild times since
with the patch applied, the man page is only recreated when the ggo
file changes.

10 years agobuild: Remove fnmatch, malloc, realloc tests.
Andre Noll [Sat, 31 Aug 2013 04:19:53 +0000 (04:19 +0000)]
build: Remove fnmatch, malloc, realloc tests.

These cause more harm than good. When cross-compiling for the arm-based
rpi, weird rpc_malloc link failures showed up. Removing the tests
solves the problem.

10 years agobuild: Make crypto optional.
Andre Noll [Thu, 29 Aug 2013 22:57:11 +0000 (22:57 +0000)]
build: Make crypto optional.

Now that all three executables that need a crypto library have been
made optional, it is no longer a fatal error if no library was found.
This patch makes the build succeed in this case, albeit para_server,
para_audiod and para_client will not be built.

10 years agobuild: Make audiod optional.
Andre Noll [Thu, 29 Aug 2013 21:42:43 +0000 (21:42 +0000)]
build: Make audiod optional.

The previous two commits made para_server and para_client depend
on crypto support. This patch does the same thing for para_audiod.
It adds a section that sets $build_audiod to yes or no, depending
on whether a crypto library was detected. This clears the path to
making crypto support optional.

10 years agobuild: Build para_client only if crypto lib was found.
Andre Noll [Thu, 29 Aug 2013 21:09:45 +0000 (21:09 +0000)]
build: Build para_client only if crypto lib was found.

This creates a separate section for para_client, similar to the one
for para_server that was added in the previous patch.

The new section sets $build_client to either yes or no, depending on
whether a crypto library (openssl nor gcrypt) was found by the tests
performed earlier. This test is always true at the moment since we
abort anyway if neither library was detected. But this is about to
change, so..

10 years agobuild: Create a separate section for para_server.
Andre Noll [Thu, 29 Aug 2013 20:56:33 +0000 (20:56 +0000)]
build: Create a separate section for para_server.

The new section is added after osl and crypto detection has been
performed. We only build para_server if both libosl and a crypto
library was found.

This check is not necessary at the moment since we abort earlier if
neither openssl nor gcrypt was detected, but it will eventually allow
to make crypto support optional.

10 years agobuild: Compute $all_errlist_objs.
Andre Noll [Thu, 29 Aug 2013 20:52:56 +0000 (20:52 +0000)]
build: Compute $all_errlist_objs.

It is less error-prone to compute this value once after feature
detection than to update the list of all objects in each test.

We now also make sure that no object is listed more than once.

10 years agobuild: Replace $extras by per-executable variable.
Andre Noll [Thu, 29 Aug 2013 20:35:54 +0000 (20:35 +0000)]
build: Replace $extras by per-executable variable.

This changes the summary at the end of the configure script to
output one line per optional executable rather than to list all
optional executables in a single line.

The new build_xxx variables are also useful to compute the set of
all $all_errlist_objects at a single location, which will be done
in a subsequent patch.

10 years agobuild: Remove two dead recipes from Makefile.in.
Andre Noll [Sat, 14 Sep 2013 05:34:54 +0000 (05:34 +0000)]
build: Remove two dead recipes from Makefile.in.

In commit f5fb7ab5 we switched from skencil to dia for creating the
overview.pdf file.  This commit missed to remove the Make recipes
for creating the pdf file from the skencil sources. Remove it now.

10 years agobuild: Remove check for buggy snprintf().
Andre Noll [Thu, 29 Aug 2013 19:09:18 +0000 (19:09 +0000)]
build: Remove check for buggy snprintf().

This check has not found any problematic snprintf() so far. But more
importantly, it uses AC_RUN_IFELSE() which should be avoided since
it can not work for cross-compile setups. Remove the check.

10 years agoMerge branch 'maint'
Andre Noll [Sun, 1 Dec 2013 10:40:40 +0000 (11:40 +0100)]
Merge branch 'maint'

10 years agoconfigure.ac: Fix definition of recv_ldflags.
Andre Noll [Sun, 1 Dec 2013 00:41:16 +0000 (01:41 +0100)]
configure.ac: Fix definition of recv_ldflags.

This cut+paste typo in the libflac section causes the build system
to link para_recv against the wrong set of libraries.

10 years agoMerge branch 't/mood_cleanups'
Andre Noll [Sun, 1 Dec 2013 00:14:37 +0000 (01:14 +0100)]
Merge branch 't/mood_cleanups'

Cooking since 2011-10-13, seems to be fine.

6bcd10 mood: Deduplicate score formula.
f24778 mood: Combine compute_num_played_score() and compute_last_played_score().
62a968 mood: Don't open-code compute_dynamic_score().
2c85cd mood: Don't add files without valid information to the score table.
5e9ded mood: Simplify compute_dynamic_score().
ab9f71 mood.c: Remove unused int_log2().

10 years agoMerge branch 'maint'
Andre Noll [Sun, 17 Nov 2013 15:51:54 +0000 (16:51 +0100)]
Merge branch 'maint'

10 years agoMerge branch 't/for-maint' into maint
Andre Noll [Sun, 17 Nov 2013 15:49:35 +0000 (16:49 +0100)]
Merge branch 't/for-maint' into maint

A single fix that was cooking for some weeks.

0a7cad build: Fix --with-opus-libs.

10 years agoopusdec: Latency improvements.
Andre Noll [Mon, 9 Sep 2013 16:21:06 +0000 (16:21 +0000)]
opusdec: Latency improvements.

Currently the opus decoder works on the ogg page level, i.e. during
each scheduler iteration it tries to extract one ogg page from the
stream and decodes all opus packages therein. Since ogg pages can be
quite large (20K), decoding can take a significant amount of time,
especially on slow machines. If the decoding takes longer than the
buffer time of the configured writer, audible buffer underruns result.

This changes the opus decoder to decode only a single packet during
each iteration. With this patch applied, latency improves greatly,
and underruns occur on neither an old 150MHz AMD K6 nor on the
raspberry pi.

10 years agoaft: Make get_afsi_of_path() static.
Andre Noll [Sat, 28 Sep 2013 19:08:41 +0000 (21:08 +0200)]
aft: Make get_afsi_of_path() static.

Also simplify the documentation of the return value.

10 years agoaft: Make load_afsi() and safe_afsi() static.
Andre Noll [Sat, 28 Sep 2013 19:04:05 +0000 (21:04 +0200)]
aft: Make load_afsi() and safe_afsi() static.

Fix a whitespace issue and simplify the documentation of the return
code as we are at it.

10 years agoaft: Make get_afsi_object_of_row() static.
Andre Noll [Sat, 28 Sep 2013 18:42:31 +0000 (20:42 +0200)]
aft: Make get_afsi_object_of_row() static.

This function only used within aft.c. Also improve the documentation
a bit and fix an overlong line.

10 years agoMerge branch 'maint'
Andre Noll [Sun, 3 Nov 2013 11:53:53 +0000 (12:53 +0100)]
Merge branch 'maint'

10 years agoflacdec: Fix DECODER_ABORTED handling.
Andre Noll [Tue, 3 Sep 2013 22:26:57 +0000 (22:26 +0000)]
flacdec: Fix DECODER_ABORTED handling.

If the flac read callback is called with too little data available
in the input queue to decode a single frame, we abort the decoder
and call FLAC__stream_decoder_flush() afterwards. This discards the
partially submitted frame so we must feed these data again when more
input is available.

However, we currently miss to do so, resulting in all sorts of
flac errors.  This patch sets ->unconsumed to zero which fixes the bug.

10 years agoflacdec: Avoid busy loop.
Andre Noll [Tue, 3 Sep 2013 22:55:21 +0000 (22:55 +0000)]
flacdec: Avoid busy loop.

May happen when the last frame of a stream is incomplete.

10 years agoflacdec: Fix mono output.
Andre Noll [Tue, 3 Sep 2013 22:13:41 +0000 (22:13 +0000)]
flacdec: Fix mono output.

In the write callback of the flac decoder we correctly allocate and
fill an output buffer of n * 2 bytes for mono streams, where n is the
block size stored in the frame header. However, later in this function
twice as many bytes are added to the buffer tree. This may result in
a segmentation fault due to reading beyond the allocated buffer.

Fix this by adding n * channels * 2 bytes, which is correct for both
mono and stereo files.

10 years agoflacdec: Avoid declaration after statement.
Andre Noll [Mon, 22 Jul 2013 23:19:52 +0000 (01:19 +0200)]
flacdec: Avoid declaration after statement.

Fixes

flacdec_filter.c:243:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]

10 years agoflacdec: Improve documentation of unconsumed.
Andre Noll [Tue, 3 Sep 2013 22:13:21 +0000 (22:13 +0000)]
flacdec: Improve documentation of unconsumed.

Mention that this variable stores the number of unconsumed
bytes *that have already been fed* to the decoder.

10 years agofd.c: Fix bad English in comment.
Andre Noll [Tue, 3 Sep 2013 22:19:57 +0000 (22:19 +0000)]
fd.c: Fix bad English in comment.

Don't say that a return value is returned.

10 years agoMerge branch 't/buffer_tree_improvements'
Andre Noll [Sun, 27 Oct 2013 08:37:44 +0000 (09:37 +0100)]
Merge branch 't/buffer_tree_improvements'

Was cooking for about a month.

bcea04 btr: Simplify btr_node_status().
072391 buffer_tree: Improve btr_splice_out_node().

10 years agoMerge branch 't/fork-safe-prng'
Andre Noll [Sun, 13 Oct 2013 14:01:40 +0000 (16:01 +0200)]
Merge branch 't/fork-safe-prng'

Was cooking for two weeks.

a496f5 crypt: Add workaround for non-fork-safe PRGs.

10 years agomood: Deduplicate score formula.
Andre Noll [Wed, 4 Sep 2013 20:14:12 +0000 (20:14 +0000)]
mood: Deduplicate score formula.

mood.c computes the score of an audio file from its subscores (mood,
last_played, num_played) at two locations, both of which use the same
formula (a + b + c) / 3.

Get rid of this duplication by doing the calculation only once in
compute_dynamic_score(). Rename this function to compute_score() as
it now includes the (static) mood score as well.

10 years agomood: Combine compute_num_played_score() and compute_last_played_score().
Andre Noll [Wed, 4 Sep 2013 19:26:46 +0000 (19:26 +0000)]
mood: Combine compute_num_played_score() and compute_last_played_score().

These two functions have only one caller, compute_dynamic_score(), which
just adds the two return values. Let's combine all three functions to a
single one.

10 years agomood: Don't open-code compute_dynamic_score().
Andre Noll [Wed, 4 Sep 2013 19:24:15 +0000 (19:24 +0000)]
mood: Don't open-code compute_dynamic_score().

compute_dynamic_score() adds the two values for the numplayed and the
lasteplayed score. No need to duplicate this code here.

10 years agomood: Don't add files without valid information to the score table.
Andre Noll [Wed, 4 Sep 2013 19:18:59 +0000 (19:18 +0000)]
mood: Don't add files without valid information to the score table.

Currently if get_afsi_of_row() fails, we add the file to the score
list anyway. This function should never fail, and if it does, we are
in serious trouble anyway and should return the proper error code
rather than success.

10 years agomood: Simplify compute_dynamic_score().
Andre Noll [Wed, 24 Jul 2013 22:43:28 +0000 (00:43 +0200)]
mood: Simplify compute_dynamic_score().

Never use one housekeeping variable when you could just as easily
use two or three. - Roedy Green: How To Write Unmaintainable Code

10 years agomood.c: Remove unused int_log2().
Andre Noll [Wed, 24 Jul 2013 22:45:17 +0000 (00:45 +0200)]
mood.c: Remove unused int_log2().

This function was commented out for six years.

10 years agoMerge branch 't/audiod_cleanups'
Andre Noll [Sun, 6 Oct 2013 16:05:27 +0000 (18:05 +0200)]
Merge branch 't/audiod_cleanups'

Was cooking for ~2 weeks

1ff4b2 audiod: Don't compute stat info unnecessarily.
d80f5d audiod: Force status dump every 5 seconds.
e34e5f audiod: Improve status timeout handling.
fe7442 audiod: Reorder exit log messages a bit.
32a078 audiod: Fix memory leak on exit: stat client.
706778 audiod: Fix memory leak on exit: gengetopt.
eec23a audiod: Fix memory leak on exit: close slots.
cd5f0a audiod: Unify startup messages of receivers, filters and writers.
597966 audiod: Print a warning if filters are ignored.
a94e8e audiod: Remove pointless continue statement in com_stat().
f45bc6 audiod: Make command array static.
c96792 audiod: Fix error message on status errors.

10 years agobuild: Fix --with-opus-libs.
Andre Noll [Sat, 28 Sep 2013 14:27:56 +0000 (16:27 +0200)]
build: Fix --with-opus-libs.

Due to a silly cut & paste bug this option sets $speex_libs rather
than $opus_libs. Since the assignment comes after speex detection,
the option is effectively a no-op.

10 years agobtr: Simplify btr_node_status().
Andre Noll [Sat, 30 Mar 2013 21:30:54 +0000 (21:30 +0000)]
btr: Simplify btr_node_status().

This changes btr_node_status() to check for errors before looking
at queue sizes. In certain cases this avoids to call the possibly
expensive btr_get_output_queue_size().

If no more input is going to arrive for an internal node whose output
queue is full, btr_node_status() now returns EOF immediately, which
is better than the previous scheme where we waited for the output
queue to become empty before returning EOF.

10 years agobuffer_tree: Improve btr_splice_out_node().
Andre Noll [Sun, 31 Mar 2013 15:34:50 +0000 (15:34 +0000)]
buffer_tree: Improve btr_splice_out_node().

This changes btr_splice_out_node() to take a pointer to a btrn, just
like btr_remove_node(). This allows to set the variable to NULL after
the node has been spliced out. The callers are updated accordingly.

10 years agoMerge branch 't/misc_cleanups'
Andre Noll [Sun, 29 Sep 2013 10:59:04 +0000 (12:59 +0200)]
Merge branch 't/misc_cleanups'

Was cooking since 2013-08-04.

3f97ae buffer_tree: Improve documentation of btr_no_parent().
fb9209 Avoid gcc warning on FreeBSD.
778af7 command.c: Avoid declaration after statement.
61c957 extract_v4_addr(): Don't return a structure.
1d7937 command.c: Remove pointless initialization.
c17ede crypt.c: Remove condition which is always true.
a12ecb ipc: Close proc fd.
01d37b Make log functions static.
0ba631 score: Improve documentation of score_update().
d6cf71 GIT-VERSION-GEN: Don't include output of git update-index.

10 years agocrypt: Add workaround for non-fork-safe PRGs.
Andre Noll [Thu, 22 Aug 2013 21:13:37 +0000 (23:13 +0200)]
crypt: Add workaround for non-fork-safe PRGs.

Some PRNGs implementations suffer from the problem that after a fork()
the PRNG state of parent and child process differ only by the child pid
which is mixed into the state. Certain versions of openssl are known to
contain this flaw.

On such implementations two command handlers will generate the same
challenge and session keys if their pid is identical. This may happen
due to pid wrapping.

This patch works around this shortcoming by reading some pseudo random
bytes in the parent process after each fork().

10 years agoplay: Fix prev command.
Andre Noll [Sun, 22 Sep 2013 14:45:10 +0000 (16:45 +0200)]
play: Fix prev command.

The command handler for com_prev() stores the number of the
previous (valid) file in ->next_file of struct play_task and sets
->rq to CRT_FILE_CHANGE. The real work is supposed to be done in
load_next_file() which is called from the main post_select() function.

However, load_next_file() ignores ->next_file and computes the number
of the next file itself. Hence the "prev" command acts exactly as
"next", i.e. it selects the next rather than the previous file.

Fix this by ignoring ->next_file only if ->rq is CRT_NONE, which
indicates a normal end of file condition.

10 years agoaudiod: Don't compute stat info unnecessarily.
Andre Noll [Mon, 9 Sep 2013 21:20:31 +0000 (21:20 +0000)]
audiod: Don't compute stat info unnecessarily.

Currently we compute this information in each scheduler iteration
and check whether it has changed since the last time we sent it to
the stat clients.

This is quite expensive, so this patch teaches para_audiod to only look
at the status items if the last write time was more than 500ms ago.

10 years agoaudiod: Force status dump every 5 seconds.
Andre Noll [Sat, 20 Jul 2013 12:22:04 +0000 (14:22 +0200)]
audiod: Force status dump every 5 seconds.

Without this, para_audiod might not notice for a long time when
a stat client went away.

Also avoid to dump the status twice.

10 years agoaudiod: Improve status timeout handling.
Andre Noll [Sun, 21 Jul 2013 14:23:00 +0000 (16:23 +0200)]
audiod: Improve status timeout handling.

Don't look at the task error field directly. The node status gives
equivalent information.

10 years agoaudiod: Reorder exit log messages a bit.
Andre Noll [Sun, 7 Jul 2013 12:06:01 +0000 (14:06 +0200)]
audiod: Reorder exit log messages a bit.

On exit only one emergency message should be printed. If para_audiod
receives a signal which causes it to exit, we currently print two
messages. This downgrades the loglevel of the first message to NOTICE,
and moves the emergency message to the bottom of clean_exit().

10 years agoaudiod: Fix memory leak on exit: stat client.
Andre Noll [Sun, 7 Jul 2013 12:02:40 +0000 (14:02 +0200)]
audiod: Fix memory leak on exit: stat client.

Currently we don't close stat clients on exit which results in (benign)
memory leaks. Introduce the new public close_stat_clients() and call
it from clean_exit() to avoid the leak.

This patch also removes the pointles local variable "fd".

10 years agoaudiod: Fix memory leak on exit: gengetopt.
Andre Noll [Sat, 6 Jul 2013 21:04:14 +0000 (23:04 +0200)]
audiod: Fix memory leak on exit: gengetopt.

Free gengetopt config structure on exit.

10 years agoaudiod: Fix memory leak on exit: close slots.
Andre Noll [Sat, 6 Jul 2013 20:26:03 +0000 (22:26 +0200)]
audiod: Fix memory leak on exit: close slots.

Currently we don't bother to close slots on exit. This is no problem
but it causes valgrind to report a bunch of memory leaks. This patch
makes it close all writers, filters and receivers on exit.

To this aim, the cleanup part of close_unused_slots() is abstracted out
into the new close_slot(), which is now also called from clean_exit()
for each slot, just before para_audiod exits. In order to avoid
forward declarations, clean_exit() had to be moved below the two
other functions.

10 years agoaudiod: Unify startup messages of receivers, filters and writers.
Andre Noll [Thu, 5 Sep 2013 04:18:48 +0000 (04:18 +0000)]
audiod: Unify startup messages of receivers, filters and writers.

During buffer tree startup para_audiod logs one message with log
level NOTICE for the receiver and one for each filter. The writer
startup message is printed only with loglevel INFO though.

Upgrade the loglevel of this message to NOTICE as well.

10 years agoaudiod: Print a warning if filters are ignored.
Andre Noll [Mon, 2 Sep 2013 01:46:32 +0000 (01:46 +0000)]
audiod: Print a warning if filters are ignored.

If the regular expression of a filter specifier does not match any
audio formats, we ignore this filter spec silently. Most likely this
was not intended and deserves a log message, so let's add it.

10 years agoaudiod: Remove pointless continue statement in com_stat().
Andre Noll [Sun, 7 Jul 2013 16:54:32 +0000 (18:54 +0200)]
audiod: Remove pointless continue statement in com_stat().

The loop ends here anyway.

10 years agoaudiod: Make command array static.
Andre Noll [Thu, 5 Sep 2013 04:52:18 +0000 (04:52 +0000)]
audiod: Make command array static.

This array is only used in audiod_command.c.

10 years agoaudiod: Fix error message on status errors.
Andre Noll [Sat, 20 Jul 2013 10:28:18 +0000 (12:28 +0200)]
audiod: Fix error message on status errors.

If para_audiod can not parse a status item received from para_server,
it currently prints

task_notify: notifying task client: audiod switched off
btr_remove_node: removing btr node client from buffer tree
unregister_task: unregistering client (audiod switched off)

This is misleading at best. The error message for status timeouts has
the same problem. This patch makes para_audiod print meaningful error
messages in both cases.

10 years agoMerge branch 'maint'
Andre Noll [Sun, 22 Sep 2013 00:12:29 +0000 (02:12 +0200)]
Merge branch 'maint'

This incoporates a couple of important bug fixes found at athcx.

10 years agobash_completion: Run client/audioc from PATH.
Andre Noll [Wed, 11 Sep 2013 00:46:26 +0000 (00:46 +0000)]
bash_completion: Run client/audioc from PATH.

This way it works for everybody.

10 years agoconfigure: Print opus audio file handler if opus lib was found.
Andre Noll [Wed, 4 Sep 2013 04:35:38 +0000 (04:35 +0000)]
configure: Print opus audio file handler if opus lib was found.

The variable is called $audio_format_handlers rather than
$server_audio_formats. The value is only used to display the supported
audio formats, so this bug is rather benign.

10 years agobtr: splice-out fix.
Andre Noll [Fri, 6 Sep 2013 23:21:44 +0000 (23:21 +0000)]
btr: splice-out fix.

When splicing out a node we set the ->parent pointer of all child
nodes to the parent of the given node, and move each child to the
->children list of the parent.

Except when there is no parent. If the given node was a root node
(or an internal node whose parent vanished), we leave the ->children
list untouched. In this case the assertion a few lines later triggers
and aborts the program. Fix this by removing the nodes from the list.
Such nodes have become root nodes themselves, so they should not be
on any list of children.

10 years agofecdec: Avoid fecdec output buffer overruns.
Andre Noll [Sun, 1 Sep 2013 17:48:46 +0000 (17:48 +0000)]
fecdec: Avoid fecdec output buffer overruns.

The size of the buffer tree pool of the amp filter is 64K, which
is smaller than BTRN_MAX_PENDING of buffer_tree.c (96K). The latter
value is used in btr_node_status() as follows. If input for a buffer
tree node is available and there is less than BTRN_MAX_PENDING bytes
in the output queue of the node, the function returns 1 to indicate
that the node should continue to process its input.

This can result in a fatal error condition when the buffer tree pool
fills up completely. Avoid this by increasing the pool size to 128K.

10 years agovss: Avoid assertion "i == g->num_header_slices - 1".
Andre Noll [Sun, 1 Sep 2013 15:54:25 +0000 (15:54 +0000)]
vss: Avoid assertion "i == g->num_header_slices - 1".

This fixes a very old bug in the timing code for fec slices. Depending
on the number of bytes to submit and on the number of slices of the
current fec group it may happen that we reserve more slices than
needed for the audio file header. This is not a problem per se, but the
above assertion hits in this case and aborts para_server.

Fix this by removing the assertion, and make sure that all reserved
header slices are properly initialized.

10 years agoconfigure: Fix restoring LDFLAGS.
Andre Noll [Thu, 29 Aug 2013 22:20:30 +0000 (22:20 +0000)]
configure: Fix restoring LDFLAGS.

The configure script saves the values of CPPFLAGS, CFLAGS and LDLFAGS
before each check and restores the old values afterwards. However,
for LDLFAGS this was broken at several places, since we used LD_FLAGS
(with an underscore) for saving the value and LDFLAGS for restoring it
(or vice versa).

This bug had the effect that a user-specified value of LDFLAGS was
ignored in some tests because LDFLAGS was restored to the empty
value LD_FLAGS during an earlier test.

This patch changes all occurrences of LD_FLAGS in configure.ac to
LDFLAGS.

10 years agoerror.h: Fix typo in comment.
Andre Noll [Wed, 11 Sep 2013 04:21:05 +0000 (04:21 +0000)]
error.h: Fix typo in comment.

10 years agoamp: Downgrade level of log message.
Andre Noll [Mon, 2 Sep 2013 01:48:05 +0000 (01:48 +0000)]
amp: Downgrade level of log message.

The scaling factor is often one, so this is not very important
information.  Set the loglevel to INFO.