paraslash.git
11 years agofecdec: Defer decoding until the first slice of the second group arrives.
Andre Noll [Sat, 19 Sep 2009 08:21:48 +0000 (10:21 +0200)]
fecdec: Defer decoding until the first slice of the second group arrives.

Otherwise, this could lead to buffer underruns in the decoding application
in case slices are missed. So introdce group_completion_status which tracks
whether we already have received the first group sucessfully and are waiting
for the first slice of the next group.

11 years agoafh: Fix memory leak.
Andre Noll [Sat, 19 Sep 2009 08:18:14 +0000 (10:18 +0200)]
afh: Fix memory leak.

11 years agostdin: Increase input buffer size.
Andre Noll [Sat, 19 Sep 2009 08:16:23 +0000 (10:16 +0200)]
stdin: Increase input buffer size.

16K was a bit small for the ogg_decode filter.

11 years agotv_scale(): Avoid integer overflow.
Andre Noll [Sat, 19 Sep 2009 08:11:19 +0000 (10:11 +0200)]
tv_scale(): Avoid integer overflow.

Just use an uint64_t and compute everything in microseconds which even
simplifies the code a bit.

11 years agovss: Honor header chunk when computing FEC group start.
Andre Noll [Sat, 19 Sep 2009 08:08:59 +0000 (10:08 +0200)]
vss: Honor header chunk when computing FEC group start.

The first chunk of an ogg vorbis file is the audio file header
which should not be included in the calculation of the FEC
group timing.

11 years agoFEC timing improvements.
Andre Noll [Sat, 12 Sep 2009 16:16:56 +0000 (18:16 +0200)]
FEC timing improvements.

Currently we compute the time of a FEC group as the number of
containing chunks times the chunk time. The time between sending
two slices therefore depends only on the number of chunks the group
contains. Groups containing many slices are sent with larger delays
than groups containing few slices.

This approach is not optimal for the following reason: Consider a group
containing only few slices which is followed by a group containing
many slices. This happens frequently at the end of VBR MP3 files which
contain some seconds of silence or applause at the end because this
last part is often encoded at a lower bitrate than the preceding part.

In this scenario buffer underruns in the receiving application can
easily occur if the previous FEC group has been decoded and completely
fed to the writer before enough slices of the next group have arrived
to decode the second group.

This patch changes the timing of FEC groups such that all but the
first group use the duration of the _previous_ group as the basis
for the timing.

11 years agovss_send(): Fix EOF-check for FEC clients.
Andre Noll [Sat, 12 Sep 2009 16:13:36 +0000 (18:13 +0200)]
vss_send(): Fix EOF-check for FEC clients.

If the last chunk has been sent to all http/dccp clients we have
to wait until the last FEC group has been sent before setting the
NEXT flag that causes all senders to shut down its clients. The old
code tested if a slice was sent to any FEC  client during vss_send()
and set the NEXT flag if nothing was sent.

However, this is not sufficient as there may be still slices available
which have to be sent at some future time. This patch teaches
vss_send() to detect this condition. It also renames the boolean
variable sent_something to fec_active, which is more to the point.

11 years agomood: Do not handle events if no mood is active.
Andre Noll [Sun, 6 Sep 2009 20:23:45 +0000 (22:23 +0200)]
mood: Do not handle events if no mood is active.

In case a file is being removed with "para_client rm" while in playlist mode,
the following assertion triggers:

mood.c:521: del_afs_statistics: Assertion `n' failed.

This happens because the file is contained in the score table but statistics are not enabled.
Fix it by ignoring events if cuurent_mood is NULL.

11 years agofilter: Register the filter chain as the last task.
Andre Noll [Sun, 6 Sep 2009 20:19:31 +0000 (22:19 +0200)]
filter: Register the filter chain as the last task.

Without this patch, the command

para_filter -f mp3dec < foo.mp3 > /dev/null

would take several minutes because the stdin buffer is usually full and the stdout buffer empty
which causes select() to be called with empty fd sets, resulting in a one second timeout.

11 years agofade: Avoid a gcc warning.
Andre Noll [Wed, 2 Sep 2009 11:59:54 +0000 (13:59 +0200)]
fade: Avoid a gcc warning.

The following warning is harmless and gcc is just being stupid:

fade.c: In function 'main':
fade.c:111: warning: 'val' may be used uninitialized in this function
fade.c:111: note: 'val' was declared here

11 years agoKill the quick hack that changed timing for the first fec goup.
Andre Noll [Mon, 31 Aug 2009 19:26:54 +0000 (21:26 +0200)]
Kill the quick hack that changed timing for the first fec goup.

This did never really work.

11 years agomp3dec: Improve bad main_data_begin pointer error handling.
Andre Noll [Mon, 31 Aug 2009 19:17:21 +0000 (21:17 +0200)]
mp3dec: Improve bad main_data_begin pointer error handling.

These errors from mad_frame_decode() are non-fatal and happen if the
stream is started at the middle of the file, e.g. when para_audiod
is started while para_server is already streaming.

If libmad encounters such an error it throws away the first (and
probably the second) frame which messes up the timing in udp/fec mode,
causing an audible buffer underrun after the remaining frames of the
first fec group have been decoded and fed to the writer.

This patch makes the mp3dec filter keep track of bad main_data_begin
pointer errors that happen at the start of the stream. In this case
decoding is deferred until more data has arrived or 60ms have passed.

11 years agocom_stat(): Be more anal in checking command line options.
Andre Noll [Sun, 30 Aug 2009 12:26:32 +0000 (14:26 +0200)]
com_stat(): Be more anal in checking command line options.

Also check the number of arguments and use para_atoi32 to convert
the argument into an int.

11 years agoFix off-by-one bug in fixup_info_string().
Andre Noll [Sun, 30 Aug 2009 11:20:14 +0000 (13:20 +0200)]
Fix off-by-one bug in fixup_info_string().

This caused the chunk time not being properly displayed due to a
missing newline in the status output.

11 years agoNEWS update.
Andre Noll [Sat, 29 Aug 2009 20:28:41 +0000 (22:28 +0200)]
NEWS update.

11 years agoAlsa timing improvements.
Andre Noll [Sat, 29 Aug 2009 20:17:55 +0000 (22:17 +0200)]
Alsa timing improvements.

This moves the computation of the select timeout from
alsa_write_post_select() to alsa_write_pre_select(). The code now
computes when the next buffer underrun would occur and uses that
value to set the timeout for the next select call. This decreases
the number of writes to the alsa handle and therefore also the CPU
usage of para_write/para_audiod.

11 years agodaemon: Don't set the umask to zero.
Andre Noll [Fri, 21 Aug 2009 19:30:23 +0000 (21:30 +0200)]
daemon: Don't set the umask to zero.

Clearing umask creates more problems that it solves.

11 years agoFix two typos in daemon.c.
Andre Noll [Fri, 21 Aug 2009 19:08:29 +0000 (21:08 +0200)]
Fix two typos in daemon.c.

11 years agoMerge commit 'meins/master'
Andre Noll [Mon, 3 Aug 2009 14:00:31 +0000 (16:00 +0200)]
Merge commit 'meins/master'

11 years ago[filter]: Do filter conversion during post_select.
Andre Noll [Sun, 2 Aug 2009 13:29:47 +0000 (15:29 +0200)]
[filter]: Do filter conversion during post_select.

This is more natural and allows to get rid of the hack that
forced a minimal timout in case something was converted.

11 years agoPrint an error message if the filter config file contains invalid options.
Andre Noll [Sat, 25 Jul 2009 16:29:06 +0000 (18:29 +0200)]
Print an error message if the filter config file contains invalid options.

11 years agoTeach para_fade to accept a mixer channel to fade.
Andre Noll [Sat, 25 Jul 2009 13:51:48 +0000 (15:51 +0200)]
Teach para_fade to accept a mixer channel to fade.

This allows to fade not only the volume channel but all other channels that are
supported by oss.

11 years agoKill unused para_reap_children().
Andre Noll [Mon, 20 Jul 2009 16:54:15 +0000 (18:54 +0200)]
Kill unused para_reap_children().

Found by cppcheck.

11 years agoFix memory leaks in [alsa,file,oss]write.c.
Andre Noll [Sun, 19 Jul 2009 12:16:42 +0000 (14:16 +0200)]
Fix memory leaks in [alsa,file,oss]write.c.

Small and harmless but anyway.

11 years agoRemove unused label "out".
Andre Noll [Sat, 18 Jul 2009 13:40:39 +0000 (15:40 +0200)]
Remove unused label "out".

11 years agoaudiod: Clean up status output.
Andre Noll [Sat, 18 Jul 2009 13:19:24 +0000 (15:19 +0200)]
audiod: Clean up status output.

It's a mess. Fortunately, this is much cleaner in 0.4.x..

11 years agoaudiod: Properly prefix uptime string.
Andre Noll [Sat, 18 Jul 2009 12:57:15 +0000 (14:57 +0200)]
audiod: Properly prefix uptime string.

The prefix was missing the first time the uptime was printed in the status output.

11 years agoaudiod: Fix some memory leaks in the com_stat() error paths.
Andre Noll [Sat, 18 Jul 2009 12:22:25 +0000 (14:22 +0200)]
audiod: Fix some memory leaks in the com_stat() error paths.

11 years agoFix a memory leak in filter.c.
Andre Noll [Sat, 18 Jul 2009 12:00:17 +0000 (14:00 +0200)]
Fix a memory leak in filter.c.

We must free the filter configs as well.

11 years agoFix a typo in the udp_recv help.
Andre Noll [Sat, 18 Jul 2009 10:26:04 +0000 (12:26 +0200)]
Fix a typo in the udp_recv help.

11 years agoFix memory leaks in xxx_recv_init().
Andre Noll [Sat, 18 Jul 2009 10:25:39 +0000 (12:25 +0200)]
Fix memory leaks in xxx_recv_init().

Not serious but it's good to make valgrind happy.

11 years agoMake RSA keys larger than 512 bit work.
Andre Noll [Sat, 18 Jul 2009 09:30:24 +0000 (11:30 +0200)]
Make RSA keys larger than 512 bit work.

This allows to use the 2048 bit keys which are necessary for paraslash-0.4.x also for
paraslash-0.3.5.

11 years agoFix com_init() in case arguments are given.
Andre Noll [Sat, 11 Jul 2009 19:01:27 +0000 (21:01 +0200)]
Fix com_init() in case arguments are given.

As the ->name field of struct afs_table was only initialized in the afs process,
com_init(), which gets forked from the server process, did not see the table
names and would segfault due to a NULL pointer dereference if table names
were given as arguments.

Fix it by initializing the ->name fields in the definition of the afs_tables array.

This bug was introduced in commit 53d503ce back in 2007...

11 years agoScoring fixes.
Andre Noll [Sat, 11 Jul 2009 14:53:50 +0000 (16:53 +0200)]
Scoring fixes.

Rename add_item_score to get_item_score(), properly check its return value,
and use the computed score only for admissible files.

11 years agofade.c: Fix a gcc warning on FreeBSD.
Andre Noll [Tue, 7 Jul 2009 13:53:59 +0000 (15:53 +0200)]
fade.c: Fix a gcc warning on FreeBSD.

fade.c:220: warning: long unsigned int format, time_t arg (arg 4)

11 years agorecv/filter: Init loglevel earlier.
Andre Noll [Sun, 5 Jul 2009 21:26:54 +0000 (23:26 +0200)]
recv/filter: Init loglevel earlier.

This avoids that early debug messages are always printed.

11 years agoFix a bug in the output of para_audioc.
Andre Noll [Sun, 5 Jul 2009 08:40:55 +0000 (10:40 +0200)]
Fix a bug in the output of para_audioc.

This bites In case of short writes to stdout. The bug was literally there since day one
but never showed up as short writes usually don't happen with the rather small amount
of data that is written by para_audioc.

11 years agoINSTALL: Fix the help text on how to create the RSA key pair.
Andre Noll [Sat, 4 Jul 2009 21:21:56 +0000 (23:21 +0200)]
INSTALL: Fix the help text on how to create the RSA key pair.

Some day, I will write a user-friendly script that generates the keys...

11 years agoNEWS update.
Andre Noll [Sat, 4 Jul 2009 14:24:25 +0000 (16:24 +0200)]
NEWS update.

11 years agoaudioc stat: Remove __a_unused attributes from com_stat().
Andre Noll [Sat, 4 Jul 2009 14:22:44 +0000 (16:22 +0200)]
audioc stat: Remove __a_unused attributes from com_stat().

argc and argv _are_ used.

11 years agoaudioc stat: Make status item mask 64 bits wide.
Andre Noll [Sat, 4 Jul 2009 14:21:36 +0000 (16:21 +0200)]
audioc stat: Make status item mask 64 bits wide.

We already have more than 32 status items.

11 years agoMerge commit 'fml/master'
Andre Noll [Sat, 4 Jul 2009 13:53:43 +0000 (15:53 +0200)]
Merge commit 'fml/master'

11 years agoSupport netmask subsets
Gerrit Renker [Tue, 30 Jun 2009 08:20:19 +0000 (10:20 +0200)]
Support netmask subsets

This allows to specify sets of addresses which are defined by sharing
the least-common netmask value.

For example, if the allow list contains the following addresses:

        10.0.0.2/24  10.0.0.2/32

then the second address is redundant since it is already included
via the first one. The least-common netmask value is 24; with this
patch a command like

        para_client sender http deny 10.0.0.0/24

will catch both addresses.

11 years agoMake allow/deny syntax consistent with that of add/delete
Gerrit Renker [Tue, 30 Jun 2009 08:17:16 +0000 (10:17 +0200)]
Make allow/deny syntax consistent with that of add/delete

After the changes for the add/delete commands, this patch updates
allow/deny to use the same syntax and (almost) the same code.

11 years agoUpdate to gengetopt 2.22.2.
Andre Noll [Sun, 21 Jun 2009 10:12:28 +0000 (12:12 +0200)]
Update to gengetopt 2.22.2.

This introduced a new gcc warning which is fixed by this patch.

11 years agoDeactivate gcc's strict aliasing optimizations.
Andre Noll [Sat, 13 Jun 2009 17:22:51 +0000 (19:22 +0200)]
Deactivate gcc's strict aliasing optimizations.

This causes a lot of warnings which are not easy to fix and probably
harmless. So simply disallow gcc to assume the strictest aliasing
rules.

11 years agoAdd new ls option -d.
Andre Noll [Sat, 13 Jun 2009 11:53:42 +0000 (13:53 +0200)]
Add new ls option -d.

This is useful for the conversion script that transforms the afs
database to the 0.4 format.

11 years agoMerge commit 'fml/master'
Andre Noll [Sat, 6 Jun 2009 13:48:34 +0000 (15:48 +0200)]
Merge commit 'fml/master'

11 years agoTrivial typo fixes and cosmetic cleanups.
Andre Noll [Thu, 4 Jun 2009 22:43:28 +0000 (00:43 +0200)]
Trivial typo fixes and cosmetic cleanups.

11 years agoFix a typo in the audiod man page.
Andre Noll [Wed, 3 Jun 2009 08:44:23 +0000 (10:44 +0200)]
Fix a typo in the audiod man page.

Thanks to Gerrit Renker who pointed out the typo.

11 years agoMerge commit 'fml/master'
Andre Noll [Sun, 31 May 2009 10:40:10 +0000 (12:40 +0200)]
Merge commit 'fml/master'

11 years agoalsa_write: Avoid EAGAIN.
Andre Noll [Sun, 31 May 2009 10:34:39 +0000 (12:34 +0200)]
alsa_write: Avoid EAGAIN.

Before writing to the sound device, use snd_pcm_avail_update() to
check how many frames alsa will accept and write only that many
frames.

11 years agoMerge commit 'meins/master'
Andre Noll [Thu, 28 May 2009 09:19:25 +0000 (11:19 +0200)]
Merge commit 'meins/master'

11 years agoTruncate overlong tag info and replace newlines by spaces.
Andre Noll [Wed, 27 May 2009 17:16:54 +0000 (19:16 +0200)]
Truncate overlong tag info and replace newlines by spaces.

The tag info which is computed by the audio format handlers and stored
in the audio file table is read into a fixed-size buffer by the audio
file selector in open_and_update_audio_file(), passed to the server
process and then sent to the client via the stat command. It is not
interpreted at all during this process. In particular, it is not
essential for correctly streaming the audio file.

Vorbis comments and id3v2 tags have no size limit and may contain
arbitrary data which may lead to the following twi problems:

- As noted by Gerrit Renker, if the tag info is too long
to fit into the fixed-size buffer, the current code skips
the audio file and removes it from the list of currently
admissible files. So para_server fails to stream such files.

- If the tag info contains newlines, these are included
verbatim in the status output which may confuse para_audiod.

This patch truncates the tag info string if it does not fit into the
4K buffer and replaces newlines by spaces. This is a bit ugly but
avoids both of the above problems. It's still possible to retrieve
the complete tag info via the "ls -lv" command.

11 years agoaft: Reorganize make_status_items().
Andre Noll [Tue, 26 May 2009 20:20:50 +0000 (22:20 +0200)]
aft: Reorganize make_status_items().

It's cleaner to allocate the struct ls_data within make_status_items().

11 years agoFix build on MacOs.
Andre Noll [Tue, 26 May 2009 18:51:48 +0000 (20:51 +0200)]
Fix build on MacOs.

The changes to write.h broke the osx writer. The fix is trivial though.

11 years agoaft: Make make_status_items() static.
Andre Noll [Mon, 25 May 2009 21:02:50 +0000 (23:02 +0200)]
aft: Make make_status_items() static.

Move its single caller, open_and_update_audio_file(), below
make_status_items and get rid of the declaration in afs.h.

11 years agoKill some semicolons outside function definitions.
Andre Noll [Sun, 17 May 2009 18:14:26 +0000 (20:14 +0200)]
Kill some semicolons outside function definitions.

11 years agostruct writer_node: Store the number of the writer rather than a pointer.
Andre Noll [Thu, 14 May 2009 06:34:06 +0000 (08:34 +0200)]
struct writer_node: Store the number of the writer rather than a pointer.

This makes it easier to get the name of the writer from the writer_node
struct.

11 years agoFix a gcc warning on x86_64.
Andre Noll [Mon, 11 May 2009 07:47:31 +0000 (09:47 +0200)]
Fix a gcc warning on x86_64.

11 years agoFix a copy-and-paste typo in the udp sender.
Andre Noll [Sun, 10 May 2009 20:55:56 +0000 (22:55 +0200)]
Fix a copy-and-paste typo in the udp sender.

11 years agoFix the --log_color option of para_server and para_audiod.
Andre Noll [Sun, 10 May 2009 20:55:20 +0000 (22:55 +0200)]
Fix the --log_color option of para_server and para_audiod.

11 years agorbtree: Add const qualifier to some functions.
Andre Noll [Sun, 10 May 2009 19:31:13 +0000 (21:31 +0200)]
rbtree: Add const qualifier to some functions.

The 'rb_first()', 'rb_last()', 'rb_next()' and 'rb_prev()' calls take a pointer
to an RB node or RB root. They do not change the pointed objects, so add a
'const' qualifier.

See commit f4b477c47332367d35686bd2b808c2156b96d7c7 in the linux source tree.

11 years agoAdd some missing source code documentation.
Andre Noll [Sun, 10 May 2009 18:41:11 +0000 (20:41 +0200)]
Add some missing source code documentation.

11 years agoAdd ggo/.gitignore to hide derived ggo files.
Andre Noll [Sun, 10 May 2009 16:11:30 +0000 (18:11 +0200)]
Add ggo/.gitignore to hide derived ggo files.

11 years agoAdd new prebuffer filter.
Andre Noll [Sun, 10 May 2009 15:46:40 +0000 (17:46 +0200)]
Add new prebuffer filter.

This could be handy for lossy networks that require a lot of buffering
in addition to methods (like FEC) to cope with packet loss.

11 years agofilter: Force a minimal select timeout if something was converted.
Andre Noll [Sun, 10 May 2009 15:40:42 +0000 (17:40 +0200)]
filter: Force a minimal select timeout if something was converted.

When filter_preselect() runs. other pre_select functions might have
already been called and decided to do nothing, e.g. because their
output buffer was full or the input buffer was empty.

If this call to filter_preselect() changed any of the involved buffers,
we want those other pre_select() functions to be called ASAP. So force
a minimal timeout for the next select call to avoid unnecessary delays.

11 years agomp3dec: Try harder to recover from non-fatal errors.
Andre Noll [Sun, 10 May 2009 13:28:13 +0000 (15:28 +0200)]
mp3dec: Try harder to recover from non-fatal errors.

If there's still data left, try to decode the next header in the
same scheduler run. This avoids unnecessary copies of large parts
of the mp3 input buffer.

11 years agoaudiod: Properly handle wng open failures.
Andre Noll [Sun, 10 May 2009 12:11:38 +0000 (14:11 +0200)]
audiod: Properly handle wng open failures.

If opening the writer node group fails, no task is being registered to the
scheduler although a task structure is allocated. This makes audiod think
everything is fine until the output buffer of the receiver or a filter is
filled up which may take several seconds.

Fix this flaw by setting the error field of the wng to -E_TASK_UNREGISTERED.
This causes audiod to close the receiver node and the filter chain and to
clear the affected slot.

11 years agoFirst draft of the oss writer.
Andre Noll [Sat, 9 May 2009 08:59:14 +0000 (10:59 +0200)]
First draft of the oss writer.

This adds client-side support for FreeBSD and NetBSD and provides an
alternative writer for Linux.

11 years agoAllow writers that have no pre_select functions.
Andre Noll [Fri, 8 May 2009 19:49:30 +0000 (21:49 +0200)]
Allow writers that have no pre_select functions.

Also, fix the pointer being printed in a debug message of the scheduler.

11 years agoNEWS update.
Andre Noll [Fri, 8 May 2009 08:04:11 +0000 (10:04 +0200)]
NEWS update.

11 years agoMerge branch 'next'
Andre Noll [Thu, 7 May 2009 17:03:49 +0000 (19:03 +0200)]
Merge branch 'next'

11 years agonew codename, reset version to git
Andre Noll [Thu, 7 May 2009 15:46:15 +0000 (17:46 +0200)]
new codename, reset version to git

11 years agothe paraslash-0.3.4 release tarball
Andre Noll [Thu, 7 May 2009 15:38:49 +0000 (17:38 +0200)]
the paraslash-0.3.4 release tarball

11 years agoparaslash 0.3.4 v0.3.4
Andre Noll [Thu, 7 May 2009 15:35:34 +0000 (17:35 +0200)]
paraslash 0.3.4

11 years agoRemove an overambitious sanity check in the fecdec filter.
Andre Noll [Thu, 7 May 2009 14:44:57 +0000 (16:44 +0200)]
Remove an overambitious sanity check in the fecdec filter.

11 years agoKill a bashism in configure.ac.
Andre Noll [Mon, 4 May 2009 14:23:04 +0000 (16:23 +0200)]
Kill a bashism in configure.ac.

This caused additional quotes when /bin/sh is dash or tcsh which would result
in syntax errors during compilation.

11 years agoFix compilation on FreeBSD.
Andre Noll [Mon, 4 May 2009 11:34:16 +0000 (13:34 +0200)]
Fix compilation on FreeBSD.

Without these two includes, compilation fails on FreeBSD with

/usr/include/net/if.h:265: error: field `ifru_addr' has incomplete type
/usr/include/net/if.h:266: error: field `ifru_dstaddr' has incomplete type
/usr/include/net/if.h:267: error: field `ifru_broadaddr' has incomplete type
/usr/include/net/if.h:299: error: field `ifra_addr' has incomplete type
/usr/include/net/if.h:300: error: field `ifra_broadaddr' has incomplete type
/usr/include/net/if.h:301: error: field `ifra_mask' has incomplete type
/usr/include/net/if.h:368: error: field `addr' has incomplete type
/usr/include/net/if.h:369: error: field `dstaddr' has incomplete type

11 years agoFix two gcc warnings.
Andre Noll [Mon, 4 May 2009 11:12:17 +0000 (13:12 +0200)]
Fix two gcc warnings.

mp3_afh.c:420: warning: comparison of distinct pointer types lacks a cast
alsa_write.c:119: warning: format '%zu' expects type 'size_t', but argument 4 has type 'int'

11 years agoMerge branch 'master' into next
Andre Noll [Sun, 3 May 2009 17:09:16 +0000 (19:09 +0200)]
Merge branch 'master' into next

11 years agoAlsa fixes and cleanups.
Andre Noll [Sun, 3 May 2009 16:11:22 +0000 (18:11 +0200)]
Alsa fixes and cleanups.

This patch

- replaces the unused E_SND_PCM_INFO error by E_PHYSICAL_WIDTH,

- checks the return value of snd_pcm_format_physical_width() and returns
  -E_PHYSICAL_WIDTH if this causes bytes_per_frame being non-positive,

- introduces an upper bound for the start threshold. Without that
  change, playback could be delayed by several seconds on some alsa
  configurations (problem pointed out by Johannes Wörner, thanks).

- does not return early on input errors which could cause the last
  part of the audio stream being skipped.

- avoids calling snd_pcm_writei() with a frame count of zero which
  could happen with the old code in case there's more than zero but
  less than a full frame of audio data available.

- cleans up the documentation of struct private_alsa_write_data

11 years agoRe-revert "Auto-adjust fecdec output buffer size."
Andre Noll [Sat, 2 May 2009 10:53:54 +0000 (12:53 +0200)]
Re-revert "Auto-adjust fecdec output buffer size."

This re-applies commit 35f9051506345255c7ed3c076b7df5f3b7d26039 which
should work due to the previous output buffer patch.

11 years agoMerge branch 'master' into next
Andre Noll [Sat, 2 May 2009 09:50:17 +0000 (11:50 +0200)]
Merge branch 'master' into next

11 years agoUse only a single buffer pointer for filters/receivers.
Andre Noll [Sat, 2 May 2009 09:46:46 +0000 (11:46 +0200)]
Use only a single buffer pointer for filters/receivers.

This allows filters to change the output buffer size on the fly.

11 years agofecdec: Add another sanity check to find_group().
Andre Noll [Fri, 1 May 2009 20:07:49 +0000 (22:07 +0200)]
fecdec: Add another sanity check to find_group().

11 years agoalsa: Do not call alsa shutdown functions if alsa wasn't yet initialized.
Andre Noll [Fri, 1 May 2009 12:05:47 +0000 (14:05 +0200)]
alsa: Do not call alsa shutdown functions if alsa wasn't yet initialized.

This might happen if the wng is destroyed before any output was
produced. This bug could trigger

para_audiod: pcm.c:1105: snd_pcm_drain: Assertion `pcm' failed

causing audiod to crash.

11 years agoalsa: Fix a typo in comment.
Andre Noll [Fri, 1 May 2009 11:51:33 +0000 (13:51 +0200)]
alsa: Fix a typo in comment.

11 years agofecdec: Be more anal when finding fec groups.
Andre Noll [Fri, 1 May 2009 11:42:21 +0000 (13:42 +0200)]
fecdec: Be more anal when finding fec groups.

If the number of (data) slices changes, there's something seriously
wrong. So return an error if we detect this situation.

11 years agofecdec: Fix warning message when freeing incomplete groups.
Andre Noll [Fri, 1 May 2009 11:35:54 +0000 (13:35 +0200)]
fecdec: Fix warning message when freeing incomplete groups.

This could lead to a segfault.

11 years ago[client] Dynamically allocate output buffer.
Andre Noll [Wed, 29 Apr 2009 19:26:00 +0000 (21:26 +0200)]
[client] Dynamically allocate output buffer.

This should simplify subsequent patches that allow variable-sized
output buffers for filters/receivers.

11 years agoMerge branch 'master' into next
Andre Noll [Mon, 27 Apr 2009 18:26:34 +0000 (20:26 +0200)]
Merge branch 'master' into next

11 years agoRevert "Auto-adjust fecdec output buffer size."
Andre Noll [Sun, 26 Apr 2009 20:35:53 +0000 (22:35 +0200)]
Revert "Auto-adjust fecdec output buffer size."

This reverts commit 35f9051506345255c7ed3c076b7df5f3b7d26039.

Currently, filters must not change their output buffer on the fly
because the writer might already have a reference to the old buffer
and keeps using this buffer.

As dealing with changing output buffers requires much more work,
including changes to the generic filter and writer code, let's defer
this change to post 0.3.4.

11 years agoMerge branch 'master' into next
Andre Noll [Sun, 26 Apr 2009 19:05:18 +0000 (21:05 +0200)]
Merge branch 'master' into next

11 years agoafs: Rename signal_post_select() to afs_signal_post_select().
Andre Noll [Sun, 26 Apr 2009 17:48:40 +0000 (19:48 +0200)]
afs: Rename signal_post_select() to afs_signal_post_select().

Just to distinguish the fatal error messages on shutdown.

11 years agoAvoid dirty afs tables on shutdown.
Andre Noll [Sun, 26 Apr 2009 17:45:59 +0000 (19:45 +0200)]
Avoid dirty afs tables on shutdown.

The server process must wait for afs because afs catches SIGINT/SIGTERM
and may thus not respond immediately to these SIGNALS.

Before reacting to the signal, afs might want to use the shared memory
area and the mmd mutex.  If the server process destroys this mutex
too early and afs tries to lock the shared memory area, the call to
mutex_lock() will fail and terminate the afs process. This leads to
dirty osl tables.

There's no such problem with the other children of the server process
(the command handlers) as these reset their SIGINT/SIGTERM handlers
to the default action, i.e.  these processes get killed immediately
by the above kill().

11 years agoFix an invalid free() in command handlers.
Andre Noll [Sun, 26 Apr 2009 16:08:13 +0000 (18:08 +0200)]
Fix an invalid free() in command handlers.

The chunk table and the info_string are pointers located in the mmd
struct that point to dynamically allocated memory that must be freed
by the parent and the child. However, as the mmd struct is in a shared
memory area, there's no guarantee that after the fork these pointers
are still valid in child context. As these two pointers are not used
in the child anyway, we save them to local variables and free the
memory via that copy in the child.

This gets rid of

*** glibc detected *** para_server (serving 127.0.0.1#53650): double free or corruption (!prev): 0x08086fe0 ***

11 years agoMerge branch 'master' into next
Andre Noll [Sat, 25 Apr 2009 20:33:43 +0000 (22:33 +0200)]
Merge branch 'master' into next

Conflicts:
mp3_afh.c

11 years ago[net]: Fix buffer overflow in send_cred_buffer().
Andre Noll [Sat, 25 Apr 2009 13:17:58 +0000 (15:17 +0200)]
[net]: Fix buffer overflow in send_cred_buffer().

As pointed out by Johannes Wörner, para_audioc crashes on recent
Ubuntu systems due to stack smashing. This is caused by writing past
the end of the control buffer which stores the message header and
the socket credentials.

This patch fixes the bug by allocating a properly sized buffer.

11 years agoMerge commit 'fml/master'
Andre Noll [Thu, 23 Apr 2009 21:26:23 +0000 (23:26 +0200)]
Merge commit 'fml/master'