paraslash.git
13 years agoconnect_local_socket(): Silence noisy debug message.
Andre Noll [Tue, 5 Oct 2010 06:10:54 +0000 (08:10 +0200)]
connect_local_socket(): Silence noisy debug message.

13 years agosched: Use built-in instead of open-coded timeout helpers.
Andre Noll [Sun, 1 Aug 2010 17:56:10 +0000 (19:56 +0200)]
sched: Use built-in instead of open-coded timeout helpers.

In many places, sched_min_delay() or sched_request_timeout() are
open-coded.  Use the corresponding helpers from sched.c instead and
rename the "timeout" parameter of sched_request_timeout() to avoid
warnings on old gcc versions.

13 years agoImprove filter help text.
Andre Noll [Mon, 23 Aug 2010 13:25:07 +0000 (15:25 +0200)]
Improve filter help text.

- Mention that "efficient way" means zero-copy,

- Replace "filter options" by "options for a particular filter",

- Replace -f by --filter.

13 years agonet: Rename create_remote_socket() connect_local_socket().
Andre Noll [Mon, 23 Aug 2010 13:14:48 +0000 (15:14 +0200)]
net: Rename create_remote_socket() connect_local_socket().

It's all about local unix domain sockets, so avoid the word
"remote". Also, this function does not create the socket special
in /var/paraslash.

13 years agofade: Print the mixer device.
Andre Noll [Mon, 23 Aug 2010 11:39:16 +0000 (13:39 +0200)]
fade: Print the mixer device.

Otherwise the error "no such file" can be misleading.

13 years agoafh: Chunk numbers are zero-based.
Andre Noll [Tue, 17 Aug 2010 20:11:24 +0000 (22:11 +0200)]
afh: Chunk numbers are zero-based.

This makes the numbers match what para_server logs.

13 years agoFix an invalid-free-bug in the ogg audio format handler code.
Andre Noll [Mon, 9 Aug 2010 22:15:04 +0000 (00:15 +0200)]
Fix an invalid-free-bug in the ogg audio format handler code.

In process_ogg_packets(), if ogg_sync_pageout() fails, we jmp to
the out label where "stream" is being freed by ogg_stream_clear()
without being initialized.

This causes para_afh and para_server to segfault in libogg:

*** glibc detected *** para_afh: munmap_chunk(): invalid pointer: 0x6f890d42 ***
======= Backtrace: =========
/usr/lib/glibc/lib/libc.so.6(+0x66e5a)[0x6f712e5a]
/usr/lib/glibc/lib/libc.so.6(+0x68021)[0x6f714021]
/usr/local/lib/libogg.so.0(ogg_stream_clear+0x2f)[0x6f891adf]
para_afh[0x804cb52]
para_afh[0x804cbeb]
para_afh[0x804ce59]
para_afh[0x804be71]
para_afh[0x804a97c]
/usr/lib/glibc/lib/libc.so.6(__libc_start_main+0xd9)[0x6f6c2c79]
para_afh[0x8049991]

Fix this bug by returning the error code directly rather than jumping
to "out".

13 years agonew codename, reset version to git
Andre Noll [Fri, 6 Aug 2010 12:13:56 +0000 (14:13 +0200)]
new codename, reset version to git

13 years agothe paraslash-0.4.4 release tarball
Andre Noll [Fri, 6 Aug 2010 12:09:52 +0000 (14:09 +0200)]
the paraslash-0.4.4 release tarball

13 years agoparaslash 0.4.4 v0.4.4
Andre Noll [Fri, 6 Aug 2010 12:05:04 +0000 (14:05 +0200)]
paraslash 0.4.4

13 years agomanual: Minor cleanups.
Andre Noll [Mon, 2 Aug 2010 07:12:16 +0000 (09:12 +0200)]
manual: Minor cleanups.

- Mention that OGG/Speex also needs periodic audio file headers, reword
this sentence.

- para_write now understands formats != 16 bit, so remove this restriction also
from the documentation. Also mention that the sample format is being read from
the wav header, if present.

- Typo fix.

13 years agoFix typo in write_common.h.
Andre Noll [Sun, 1 Aug 2010 17:48:30 +0000 (19:48 +0200)]
Fix typo in write_common.h.

This makes doxygen happy again.

13 years agoRename some variables to avoid warnings on old gcc versions.
Andre Noll [Sun, 1 Aug 2010 17:46:32 +0000 (19:46 +0200)]
Rename some variables to avoid warnings on old gcc versions.

Fortunately, gcc-4 no longer warns on these. However, gcc-3.3 is still supported
for compiling paraslash, so rename "index" to "idx" and "conf" to "config" to get
rid of warnings of the form

wmadec_filter.c:1013: warning: declaration of `index' shadows a global declaration

Add documentation of ->free_config() while we're at it.

13 years agoNEWS update.
Andre Noll [Sun, 1 Aug 2010 17:38:33 +0000 (19:38 +0200)]
NEWS update.

13 years agoMerge branch 't/speex'
Andre Noll [Sun, 1 Aug 2010 11:26:42 +0000 (13:26 +0200)]
Merge branch 't/speex'

13 years agoMerge branch 't/error2'
Andre Noll [Sun, 1 Aug 2010 11:25:59 +0000 (13:25 +0200)]
Merge branch 't/error2'

13 years agoNEWS update
Andre Noll [Thu, 29 Jul 2010 18:55:12 +0000 (20:55 +0200)]
NEWS update

13 years agoMerge branch 't/bits_per_sample'
Andre Noll [Thu, 29 Jul 2010 18:52:06 +0000 (20:52 +0200)]
Merge branch 't/bits_per_sample'

13 years agoalsa: Add a missing "goto again" statement.
Andre Noll [Mon, 26 Jul 2010 11:02:56 +0000 (13:02 +0200)]
alsa: Add a missing "goto again" statement.

Without this the return value of btr_node_status() might be incorrect
as the wrong minimal input queue size was used.

13 years agoAdd a reference to the speex home page.
Andre Noll [Thu, 29 Jul 2010 16:25:41 +0000 (18:25 +0200)]
Add a reference to the speex home page.

Also mention the name of the speex Debian package.

13 years agoAdd missing documentation of rfds parameter of accept_sender_client().
Andre Noll [Tue, 27 Jul 2010 21:19:31 +0000 (23:19 +0200)]
Add missing documentation of rfds parameter of accept_sender_client().

Fixes

/home/work/maan/scm/paraslash/send_common.c:260: warning: The following parameters of accept_sender_client(struct sender_status *ss, fd_set *rfds) are not documented:
parameter 'rfds'

13 years agoaacdec: Fix a brown paper bag bug.
Andre Noll [Mon, 26 Jul 2010 11:05:42 +0000 (13:05 +0200)]
aacdec: Fix a brown paper bag bug.

Oops, we were using PARA_MAX() instead of PARA_MIN() to determine
the number of bytes to convert in the next run.  This silly bug could
lead to a segfault in the aacdec filter. Moreover, the assertion in
buffer_tree.c that would have caught the bug was _also_ b0rken.

But it's not my fault. I blame Grover of the Sesame street for both
bugs. He did explain the difference between near and far, although
this knowledge is next to useless for a programmer. And he did not
say a single word about MIN and MAX, or true and false. No wonder
such bugs happen.

13 years agoMake autoconf-2.66 happy.
Andre Noll [Mon, 5 Jul 2010 21:42:31 +0000 (23:42 +0200)]
Make autoconf-2.66 happy.

This removes more lines than it adds and avoids the following warning;

configure.ac:689: warning: AC_DEFINE_UNQUOTED: `
configure.ac:689:       result=
configure.ac:689:       for i in $status_items; do
configure.ac:689:               result="$result SI_$(echo $i | tr 'a-z' 'A-Z')' is not a valid preprocessor define value

13 years agoUse a perl script to create error2.h
Andre Noll [Sun, 4 Jul 2010 09:23:28 +0000 (11:23 +0200)]
Use a perl script to create error2.h

This is *much* faster than the shell code in configure. Perl is
required anyway for help2man, so this patch does not introduce
additional requirements on the build system.

13 years agoAdd support for the speex codec.
Andre Noll [Tue, 22 Jun 2010 22:53:46 +0000 (00:53 +0200)]
Add support for the speex codec.

This patch adds support for yet another audio format: speex, a
CELP-based codec designed for speech.

As speex is usually used in combination with the OGG container format,
we only support this combination. The new OGG/Speex audio format
handler provides a callback structure for the generic ogg code,
very similar to the OGG/Vorbis audio format handler.

The new speex code is split over three source files: spx_afh.c contains
the audio format handler, spxdec_filter.c the decoder and spx_common.c
common functions used by both audio format handler and decoder.

Many thanks to Jean-Marc Valin, the author of the reference
implementation of the speex decoder. Reusing parts of his code made
it easy to support speex within paraslash.

13 years agoogg: Separate ogg from vorbis code.
Andre Noll [Tue, 22 Jun 2010 21:14:03 +0000 (23:14 +0200)]
ogg: Separate ogg from vorbis code.

This moves vorbis-independent code from ogg_afh.c to the new file
ogg_afh_common.c so that it can be used also for the speex audio
format handler that is added by subsequent patches.

The patch introduces a generic callback structure which contains a
function pointer used to call back into the vorbis code once for each
of the three ogg packets of the audio file header.

13 years agoKill supported_audio_formats().
Andre Noll [Tue, 22 Jun 2010 20:00:28 +0000 (22:00 +0200)]
Kill supported_audio_formats().

It's kind of silly to have a function that just returns a constant string
which is known at compile time. Even more silly is to contruct this string
using an #ifdef for each optional audio format when we already
constructed the space-separated list of supported audio formats during
configure.

So just use AC_DEFINE_UNQUOTED() in configure.ac to make the
list of supported audio formats available via config.h and get rid of
supported_audio_formats(). Rename it to SERVER_AUDIO_FORMATS
and kill a useless space character while we're at it.

13 years agoContent complete, some external links missing.
Andre Noll [Mon, 3 May 2010 06:57:10 +0000 (08:57 +0200)]
Content complete, some external links missing.

13 years agoCosmetics: Rename samplerate to sample_rate.
Andre Noll [Wed, 30 Jun 2010 12:09:56 +0000 (14:09 +0200)]
Cosmetics: Rename samplerate to sample_rate.

A subsequent patch will introduce sample_format which looks much nicer
than sampleformat. So let's use the underscored variant throughout.

13 years agowrite: Support audio formats != 16 bit little endian.
Andre Noll [Mon, 12 Jul 2010 15:28:58 +0000 (17:28 +0200)]
write: Support audio formats != 16 bit little endian.

This adds the new --sample_format option to para_write and teaches
the check_wav_task to read the sample format from the wav header
rather than assuming 16 bit little endian.

The alsa, oss and osx writers all ask the upper buffer tree nodes
for the current audio format. For para_write the check_wav task
answers this query by using the value given at the command line,
looking at the wav header, or using 16 bit little endian as the
default answer.

For para_audiod, the current decoder answers this query. In this
case the audio format is either 16 bit little endian or 16 bit
big endian, depending on the endianness of the machine.

13 years agowrite: Make get_btr_value() return void.
Andre Noll [Thu, 1 Jul 2010 09:44:16 +0000 (11:44 +0200)]
write: Make get_btr_value() return void.

Asking upper buffer tree nodes for the sample rate and the channels
count should never fail, because the writer only asks if there is
already some output data to process.

So, replace the tests by assertions, change the return value
of get_btr_value() to void and fix up all callers accordingly.
This simplifies the code a bit.

13 years agoIntroduce decoder_execute().
Andre Noll [Wed, 30 Jun 2010 17:04:30 +0000 (19:04 +0200)]
Introduce decoder_execute().

All four decoders support the same two commands: "sample_rate"
and "channels". This patch adds a public function to filter_common.c
which implements these two commands and is called by all decoders.
This allows to kill four copies of code with identical functionality.

13 years agoDeduplicate --channels and --sample-rate.
Andre Noll [Wed, 30 Jun 2010 16:40:47 +0000 (18:40 +0200)]
Deduplicate --channels and --sample-rate.

These options are identical for all writers. Moreover, they only
make sense for para_write but are ignored for para_audiod.

So move these options from the writer-specific ggo file to write.m4,
the config file for para_write. The writers obtain the sample rate
and the channels count as before via the buffer tree exec mechanism,
but it is now the check_wav node rather than the btr node of the writer
that computes this information from the given option, the wav header
or the builtin default.

The new HANDLE_EXEC macro contains the logic for determining the
source of both the sample rate and the channels count.

13 years agoCosmetics: Rename samplerate to sample_rate.
Andre Noll [Wed, 30 Jun 2010 12:09:56 +0000 (14:09 +0200)]
Cosmetics: Rename samplerate to sample_rate.

A subsequent patch will introduce sample_format which looks much nicer
than sampleformat. So let's use the underscored variant throughout.

13 years agofilter.h: Add some missing documentation.
Andre Noll [Sat, 10 Jul 2010 11:24:36 +0000 (13:24 +0200)]
filter.h: Add some missing documentation.

13 years agonew codename, reset version to git
Andre Noll [Mon, 5 Jul 2010 15:29:59 +0000 (17:29 +0200)]
new codename, reset version to git

13 years agothe paraslash-0.4.3 release tarball
Andre Noll [Mon, 5 Jul 2010 15:25:03 +0000 (17:25 +0200)]
the paraslash-0.4.3 release tarball

13 years agoparaslash 0.4.3 v0.4.3
Andre Noll [Mon, 5 Jul 2010 15:19:12 +0000 (17:19 +0200)]
paraslash 0.4.3

13 years agoRemove some unused error codes.
Andre Noll [Mon, 5 Jul 2010 06:19:53 +0000 (08:19 +0200)]
Remove some unused error codes.

13 years agoaudiod: Set the audio format restart barrier also when closing the receiver.
Andre Noll [Sun, 4 Jul 2010 21:27:37 +0000 (23:27 +0200)]
audiod: Set the audio format restart barrier also when closing the receiver.

When the current audio file changes, it may happen that para_audiod's receiver
detects the EOF condition before the status has been updated to reflect the file
change. In this case, para_audiod might restart the old receiver even if a
different audio format is about to be streamed next.

This patch adds a per audio format 200ms delay which starts at receiver close time.
During this time interval the receiver for this audio format will not be started again.

13 years agogui: Replace also \r and \f by spaces.
Andre Noll [Sun, 4 Jul 2010 21:17:41 +0000 (23:17 +0200)]
gui: Replace also \r and \f by spaces.

id3 comments might contain these characters which can mess up the curses output.

13 years agooggdec: Introduce a small delay on stream start.
Andre Noll [Sun, 4 Jul 2010 21:16:01 +0000 (23:16 +0200)]
oggdec: Introduce a small delay on stream start.

This patch avoids buffer underruns when using the http receiver.

13 years agoSuppress gcc warning when compiling cmdline files.
Andre Noll [Tue, 29 Jun 2010 06:35:45 +0000 (08:35 +0200)]
Suppress gcc warning when compiling cmdline files.

Use -Wno-unused-function when compiling *.cmdline.o files
to get rid of the annoying warning

cmdline/mp3dec_filter.cmdline.c:174:1: warning: 'free_string_field' defined but not used

13 years agosched: Fix SCHED_DEBUG.
Andre Noll [Mon, 28 Jun 2010 18:46:04 +0000 (20:46 +0200)]
sched: Fix SCHED_DEBUG.

Oops, brown paper bag bug.

13 years agoNEWS update
Andre Noll [Mon, 28 Jun 2010 12:00:14 +0000 (14:00 +0200)]
NEWS update

13 years agoMerge branch 't/udp_lookup'
Andre Noll [Mon, 28 Jun 2010 11:19:21 +0000 (13:19 +0200)]
Merge branch 't/udp_lookup'

13 years agoMerge branch 't/sched_debug'
Andre Noll [Mon, 28 Jun 2010 11:17:48 +0000 (13:17 +0200)]
Merge branch 't/sched_debug'

13 years agoMerge branch 't/decoder_latency'
Andre Noll [Mon, 28 Jun 2010 11:13:43 +0000 (13:13 +0200)]
Merge branch 't/decoder_latency'

13 years agooss_write: Add missing btr_merge().
Andre Noll [Sat, 26 Jun 2010 10:57:06 +0000 (12:57 +0200)]
oss_write: Add missing btr_merge().

Without this patch, the oss writer could detect an EOF condition
even if more data is available.

13 years agoNEWS update.
Andre Noll [Wed, 23 Jun 2010 18:56:07 +0000 (20:56 +0200)]
NEWS update.

13 years agoMerge branch 't/dccp_fec'
Andre Noll [Wed, 23 Jun 2010 18:55:08 +0000 (20:55 +0200)]
Merge branch 't/dccp_fec'

13 years agoweb: Mention the new What's cooking page.
Andre Noll [Wed, 23 Jun 2010 16:05:53 +0000 (18:05 +0200)]
web: Mention the new What's cooking page.

13 years agoNEWS: Remove header.
Andre Noll [Wed, 23 Jun 2010 14:36:12 +0000 (16:36 +0200)]
NEWS: Remove header.

The "NEWS" header is now automatically generated by the scripts that
run grutatxt on the NEWS file and insert the "What's cooking" link.

13 years agoMakefile: Remove oggdec_filter from $all_ggos.
Andre Noll [Wed, 23 Jun 2010 14:34:05 +0000 (16:34 +0200)]
Makefile: Remove oggdec_filter from $all_ggos.

This should have been removed already in the previous patch. With
oggdec_filter still present in $all_ggos, the "tarball" target
can not be made.

13 years agofec: make max_slice_size optional
Gerrit Renker [Sun, 13 Jun 2010 09:30:47 +0000 (11:30 +0200)]
fec: make max_slice_size optional

The default max_slice_size for FEC is the MTU. This patch changes the parser
to make the specification of the max_slice_size optional (for cases using a
slice size less than the MTU).

Other changes:
 * added udp sender help documentation;
 * simplified parse_fec_url() (no additional strlen() needed).

13 years agosender: miscellaneous cleanups
Gerrit Renker [Sun, 13 Jun 2010 09:30:47 +0000 (11:30 +0200)]
sender: miscellaneous cleanups

This collects various minor syntactical changes into a single patch:
 * replace indirection 'ut->sc->xxx' by 'sc->xxx' where possible;
 * more elegant way of duplicating sc->name string;
 * udp_delete_target() now takes sender_client as argument;
 * added IPv4-address:port example for udp_help();
 * revised the definition of E_ADDRESS_LOOKUP (it means what it says)
   and replaced two inappropriate uses by assert(): in each case this
   error value was used to point to an unsupported adress family. But
   since the only supported network protocol is IP, if the case happens,
   it means a bug and should be marked as such.
--
 error.h       |    2 -
 para_audioc   |binary
 error.h       |    2 -
 send_common.c |    2 -
 udp_recv.c    |    4 ---
 udp_send.c    |   64 +++++++++++++++++++++++++++++-----------------------------
 4 files changed, 35 insertions(+), 37 deletions(-)

13 years agoudp: refuse to add the same target twice
Gerrit Renker [Sun, 13 Jun 2010 09:30:47 +0000 (11:30 +0200)]
udp: refuse to add the same target twice

Based on the preceding patches, this turns the UDP targets list into a set.

13 years agoudp: transition to use sender_client 'name' field
Gerrit Renker [Sun, 13 Jun 2010 09:30:47 +0000 (11:30 +0200)]
udp: transition to use sender_client 'name' field

This replaces all occurrences of ut->host/ut->port in the UDP sender with a
'canonical' socket name contained in the embedded sender_client struct.

This field is filled in as soon as the target is added and persists across
shutting down / restarting it.

The host/port fields are now obsolete, thus removed.

13 years agoudp: integrate resolve hook
Gerrit Renker [Sun, 13 Jun 2010 09:30:47 +0000 (11:30 +0200)]
udp: integrate resolve hook

This integrates the new resolve hook into the UDP sender; exploiting the
invariant that the 'port' of sender_command_data structure is now always set.

It further reuses the new resolve_target() function for the pre-configured
sender targets. This is necessary to unify the syntax (otherwise the
server.conf would have to be limited to IP-addresses only), and allows to
use hostnames in the server configuration file.

The worst case that can here be anticipated is that unresolvable targets are
specified in server.conf. In this case the server hangs for circa 20 seconds
per unresolvable target, and then concludes with error messages such as:

 (8355) init_vss_task: initializing udp sender
 ...
 (8355) udp_add_target: adding to target list (10.0.0.2:8000)
 (8355) makesock: can not resolve UDP address funzt.net#8000: Name or service not known.
 (8355) udp_init_target_list: not adding requested target 'funzt.net'
 (8355) makesock: can not resolve UDP address funzt.also.net#8000: Name or service not known.
 (8355) udp_init_target_list: not adding requested target 'funzt.also.net'
 (8355) udp_send_init: udp sender init complete

13 years agosender: add a hook to resolve target names
Gerrit Renker [Sun, 13 Jun 2010 09:30:47 +0000 (11:30 +0200)]
sender: add a hook to resolve target names

This adds a function pointer to interpret and resolve a given URL string in
a target-specific manner, filling in the target's defaults if omitted.

The hook is used for the add/delete commands, currently implemented for UDP.

13 years agonet: host/port string convention
Gerrit Renker [Sun, 13 Jun 2010 09:30:46 +0000 (11:30 +0200)]
net: host/port string convention

This updates the implementation of host_and_port() in such a way that its
output can again be used as input of parse_url():

 * the separator for host and port is now ':' instead of '#';
 * port numbers (services) are now always represented as numbers
   (reverting an earlier change);
 * IPv6 addresses are enclosed in square brackets.

This convention makes it easier to copy&paste output from paraslash commands
(including scripting), and to store target information in a format that is
easy to resolve/reuse at a later stage.

13 years agoRemove oggdec_filter.ggo.
Andre Noll [Tue, 22 Jun 2010 20:25:44 +0000 (22:25 +0200)]
Remove oggdec_filter.ggo.

The two options are no longer used.

13 years agoMake new dccp FEC parameters optional.
Andre Noll [Sat, 19 Jun 2010 18:58:32 +0000 (20:58 +0200)]
Make new dccp FEC parameters optional.

Defaults should do for most scenarios.

13 years agoReduce decoder latency.
Andre Noll [Fri, 18 Jun 2010 20:46:22 +0000 (22:46 +0200)]
Reduce decoder latency.

If large/many FEC slices are used, the decoder gets large amounts of
data in one chunk. Currently it decodes as much as it can which may
take several 100 milliseconds on slow machines -- enough to cause
buffer underruns for the alsa writer.

This patch teaches the decoders to convert only a small amount of data
in one go in order to give the other buffer tree nodes a chance to run.

13 years agodccp_send: Add command line options for FEC parameters.
Andre Noll [Fri, 18 Jun 2010 08:40:06 +0000 (10:40 +0200)]
dccp_send: Add command line options for FEC parameters.

ATM, these are hardcoded as MPS/3/4. This patch allows to impose
an upper bound on the slice size and to change the number of (data)
slices of a FEC group.

13 years agosched: Add debug mode.
Andre Noll [Wed, 16 Jun 2010 20:39:57 +0000 (22:39 +0200)]
sched: Add debug mode.

This adds the compile-time switch SCHED_DEBUG to activate debug
mode for the scheduler. If activated, it measures the time spent in
each post_select() function and prints warning messages if this time
interval is too large.

This patch has no effect if SCHED_DEBUG is not set.

13 years agoPrint a log message if the sender command fails.
Andre Noll [Mon, 14 Jun 2010 15:09:04 +0000 (17:09 +0200)]
Print a log message if the sender command fails.

Currently there is no infrastructure for passing down a value from vss,
which runs in parent context, to the child process. In particular,
we can not pass the return value of the sender subcommand handlers
to com_sender() to propagate it to the client.

However, we may easily write a log message that explains the cause
of the error, which is not optimal, but better than nothing.

Thanks to Gerrit Renker who pointed out this flaw.

13 years agoudp_send: add a time window for errors
Gerrit Renker [Sun, 30 May 2010 16:10:42 +0000 (18:10 +0200)]
udp_send: add a time window for errors

This implements a grace period during which ICMP Destination Unreachable /
Port Unreachable are ignored from the peer, with the purpose of catching
 * synchronisation problems (e.g., receiver started after sender);
 * unforeseen events (e.g. delays, reboot, reconfiguration).

To avoid receiving persistent errors from unicast UDP clients, two time
windows are used:
 (a) The 'error-allowed' period t_A
     This time window starts when the first ECONNREFUSED error is seen
     and ends after t_A seconds. The value of t_A is a guess which should
     cover the expected time needed to sort any receiver problems out.
 (b) The 'error-free' period t_B
     During the t_B seconds following the interval t_A, no further
     connection errors are accepted; if an ECONNREFUSED is seen it
     will cause the target to be evicted from the list.

This windowing process restarts itself, i.e. the first error seen after
t_A+t_B will reset the counters.

The following examples illustrate the algorithm, where 'x' indicates
receipt of an ICMP error message.

 1) Some errors received during initial receiver setup

    |-x-x-x-x-x-x-x--|------------|------....
    |
    t_0              t_0 + t_A    t_0+t_A+t_B

    Since no errors are received after t_0 + t_A, no action will be taken.

 2) Persistent errors

    |-x-x-x-x-x-x-x-x|-x-x-x-x-x-x|
    |
    t_0              t_0 + t_A    t_0+t_A+t_B

    The first error received after t_0+t_A evicts the target.

 3) Recurring short errors

    |-x-x-x-x-x-x-x--|-//--|--------//---|-x-x-x-x-x-x-x--|------------|---...
    |
    t_0                    t_0+t_A+t_B   t_1              t_1+t_A      t_1+t_A+t_B

    Here the counter is reset at the first error after t_1. Since no more errors
    were seen after t_1+t_A, streaming continues.

For simplicity, the implementation uses t_A = t_B = 30 seconds.

The behaviour with an unavailable receiver is now:
May 24 18:08:16 (0) (2702) vss_send: sending 123:0 (548 bytes)
May 24 18:08:18 (0) (2702) vss_send: sending 132:2 (548 bytes)
May 24 18:08:18 (2) (2702) udp_check_socket_state: Evicting 10.0.0.2#8000 after 31 seconds of connection errors.

May 24 19:34:55 (0) (2702) vss_send: sending 5:14 (1232 bytes)
May 24 19:35:10 (0) (2702) vss_send: sending 11:3 (1232 bytes)
May 24 19:35:10 (2) (2702) udp_check_socket_state: Evicting 3ffe::2#8000 after 31 seconds of connection errors.

13 years agoudp: initialize common structure only once
Gerrit Renker [Sun, 30 May 2010 16:06:33 +0000 (18:06 +0200)]
udp: initialize common structure only once

When temporarily closing the UDP stream (e.g. due to 'next' or 'ff'
command), the UDP file descriptor need not be closed.  Hence this
patch moves its initialization into the add_target() function.

The patch also factors global variables out of mcast_sender_setup() function.

13 years agoudp_send: Do not send the current chunk if queue is not empty.
Andre Noll [Sun, 23 May 2010 16:58:22 +0000 (18:58 +0200)]
udp_send: Do not send the current chunk if queue is not empty.

In this case we have enqueued other data _and_ the current chunk already.

13 years agoMove send_chunk() from send_common.c to http_send.c.
Andre Noll [Sun, 23 May 2010 06:42:04 +0000 (08:42 +0200)]
Move send_chunk() from send_common.c to http_send.c.

Due to the previous changes, this function is no longer a generic function
as it is only used by the http sender. So move it to http_send.c and make it static,
along with the queue_chunk_or_shutdown() helper which is only called from
send_chunk().

13 years agocleanup: remove redundant 'max length' argument
Gerrit Renker [Sun, 23 May 2010 05:43:04 +0000 (07:43 +0200)]
cleanup: remove redundant 'max length' argument

This removes the redundant 'max_size_bytes' argument of
 * write_nonblocking(),
 * send_queued_chunks(), and
 * send_chunk(),
since it was set to 0 in all cases.

13 years agoudp_send: send data in MMS-sized chunks
Gerrit Renker [Sun, 23 May 2010 05:43:04 +0000 (07:43 +0200)]
udp_send: send data in MMS-sized chunks

This determines the Maximum Message Size for the UDPv4/v6 layer; using
the earlier functions. The outcome is used to set the FEC slice size,
initialisation of the UDP client has also been moved to the init_fec()
function.

13 years agodccp_send: send data in MPS-sized chunks
Gerrit Renker [Sun, 23 May 2010 05:43:04 +0000 (07:43 +0200)]
dccp_send: send data in MPS-sized chunks

As mandated by RFC 4340, 14., DCCP maintains an internal variable called
'Maximum Packet Size', which can be queried via the DCCP_SOCKOPT_GET_CUR_MPS
socket option. This option has been available since 2007-10-04 (v2.6.23)
and is documented in Documentation/networking/dccp.txt.

The Maximum Packet Size takes into account the path MTU, size of headers and
the estimated overhead for DCCP options. The following table shows various
values that were determined experimentally between two hosts:

     +----------+------------+--------------+--------------------+
     | Medium   | IP version | MTU in bytes | Resulting DCCP MPS |
     +----------+------------+--------------+--------------------+
     | Ethernet |    IPv4    |     1500     |     1424 bytes     |
     | Ethernet |    IPv6    |     1500     |     1404 bytes     |
     +----------+------------+--------------+--------------------+
     | WiFi     |    IPv4    |      576     |      500 bytes     |
     | WiFi     |    IPv4    |     1280     |     1204 bytes     |
     | WiFi     |    IPv4    |     1500     |     1424 bytes     |
     | WiFi (a) |    IPv4    |     2048     |     1972 bytes     |
     +----------+------------+--------------+--------------------+
     | WiFi     |    IPv6    |      576     |      see (b)       |
     | WiFi     |    IPv6    |     1280     |     1184 bytes     |
     | WiFi     |    IPv6    |     1500     |     1404 bytes     |
     | WiFi (a) |    IPv6    |     2048     |     1952 bytes     |
     +----------+------------+--------------+--------------------+

Notes:
 (a) WiFi normally uses Ethernet MTU of 1500 bytes, but the medium
     supports a much larger MTU (Fragmentation threshold) of up to
     about 2300 bytes (system used 802.11g).
 (b) 576 byte MTU not tested for IPv6 since IPv6 mandates a minimum
     MTU of 1280 bytes, as per RFC 2460 section 5 (also RFC 5405, 3.2).

The patch implements the dccp init_fec() function based on the DCCP MPS.

13 years agonet: generic code to query the maximum message size
Gerrit Renker [Sun, 23 May 2010 05:43:04 +0000 (07:43 +0200)]
net: generic code to query the maximum message size

This adds a fallback routine to determine the address-family specific maximum
message size (MMS). This value is an over-estimation of the maximum payload
size that the network layer can take, i.e. it returns the maximum size for
transport-layer header and transport-layer payload.

13 years agosender: clean up old FEC API
Gerrit Renker [Sun, 23 May 2010 05:43:04 +0000 (07:43 +0200)]
sender: clean up old FEC API

After the preceding two patches integrated the new function pointers, this
patch removes the now obsolete open() and send_fec() pointers which are no
longer referenced anywhere. It also reorders send.h to get rid of forward
declarations.

13 years agoudp: integrate new fec interaction
Gerrit Renker [Sun, 23 May 2010 05:43:04 +0000 (07:43 +0200)]
udp: integrate new fec interaction

This patch implements the new UDP-FEC interface in two steps:
 (1) updating the UDP sender analogously to the previous (DCCP sender) patch;
 (2) unifying the struct udp_target by factoring out the fields it has in
     common with 'struct sender_client'.

The open() function is deferred to a subsequent patch. The user can override
the MPS value by supplying a max_slice_bytes value not larger than the MPS.

13 years agodccp: integrate new fec interaction
Gerrit Renker [Sun, 23 May 2010 05:43:04 +0000 (07:43 +0200)]
dccp: integrate new fec interaction

This updates the DCCP sender code to access and initialize the new fec_client
structs.

Particulars:
 * the open() method has been removed, to be supplied in a later patch;
 * the sender_client field became redundant, it is now available as fc->sc.

13 years agovss: add state variable for fec client
Gerrit Renker [Sun, 23 May 2010 05:43:04 +0000 (07:43 +0200)]
vss: add state variable for fec client

This merges the two boolean/integer members 'error' and 'ready' into a
single state variable with the same effect:
 * the specific value of 'error' was not evaluated within vss.c,
   where error < 0 used to disable the fec_client;
 * the ready/and error states are mutually exclusive;
 * the assertion that compute_next_fec_slice() is not called when
   the fec_client is disabled has been removed, since this function is only
   called from vss_send(), which ensures that this condition holds;
 * likewise, vss_playing() holds in compute_slice_timeout() since
   this condition is tested earlier in the caller vss_compute_timeout().

13 years agovss: unify calls to the FEC layer
Gerrit Renker [Sun, 23 May 2010 05:43:03 +0000 (07:43 +0200)]
vss: unify calls to the FEC layer

This reorganizes the internal vss data structures a bit to unify calls to the
FEC layer across different senders:
 * each sender supplies its sender_client data via the 'sc' pointer;
 * the init_fec()/send_fec() function pointers are now parameters
   (so that a global variable is not needed);
 * both these functions then operate on the supplied sender_client data;
 * the transport layer can then interpret the sender_client data in
   specific ways, e.g. by accessing sc->private_data;
 * a new 'ready' flag has been added to track transport-layer state;
 * max_slice_size as paramter has been restored (for overriding MPS value).

Note: this is one patch out of several. It comments out now-incompatible
      changes in the API for the sake of being able to compile. However,
      the new global API requires the whole set of patches to be applied.

13 years agoBasic infrastructure changes for FEC/DCCP support.
Andre Noll [Tue, 27 Apr 2010 19:43:19 +0000 (21:43 +0200)]
Basic infrastructure changes for FEC/DCCP support.

This patch allows to add a FEC client without specifying the FEC
parameters. Instead, these parameters are set at stream start time
via the new ->open() method of the senders.

It is desirable to defer ssetting the FEC parameters to allow dynamic
determination of the slice size. We need an established connection
to find out the best value for the slice size, but the UDP sender
currently has to fix the slice size at target add time, which is
too early.

The slice size for the UDP and the DCCP sender are currently hardcoded
values; this will be fixed by subsequent patches.

13 years agoMerge remote branch 'meins/master'
Andre Noll [Mon, 7 Jun 2010 08:16:41 +0000 (10:16 +0200)]
Merge remote branch 'meins/master'

13 years agoFix paraslash.ico.
Andre Noll [Fri, 21 May 2010 17:16:22 +0000 (19:16 +0200)]
Fix paraslash.ico.

Somehow this broke quite some time ago. The command

convert -colors 16 paraslash.png paraslash.ico

converts the png to an .ico File that is displayed nicely at least
with firefox. Of course, this should be generated on the fly, but
for now it's simpler to just check it in.

13 years agoMerge branch 'maint'
Andre Noll [Sun, 6 Jun 2010 16:35:47 +0000 (18:35 +0200)]
Merge branch 'maint'

Conflicts:
gui.c

13 years agogui: Avoid busy loop if audiod is down.
Andre Noll [Sun, 6 Jun 2010 16:32:11 +0000 (18:32 +0200)]
gui: Avoid busy loop if audiod is down.

The old approach to sleep one second is not sufficient and might still lead
to a busy loop as the call to sleep() might be interrupted by SIGCHILD.

So check the return value of sleep() and sleep again if it is not zero.

13 years agoMerge commit 'meins/master'
Andre Noll [Tue, 25 May 2010 07:23:44 +0000 (09:23 +0200)]
Merge commit 'meins/master'

13 years agofecdec_filter: Detect and ingore duplicate slices.
Andre Noll [Sun, 23 May 2010 17:21:02 +0000 (19:21 +0200)]
fecdec_filter: Detect and ingore duplicate slices.

This introduces a bit array to keep track of the slices of a FEC group
that have been received so far. This allows to quickly look up whether
the current slice is already present in the FEC group, in which case we
simply ignore it.

This avoids errors of the kind

unregister_task: unregistering fecdec (slot 0) (invalid index vector)

which have been observed with the UDP transport.

The patch also cleans up add_slice() a bit: It replaces the calls to para_malloc()
and memset() by a simple call to para_calloc() and initializes slice_num earlier
so that it can be used throughout the function.

13 years agofecdec_filter: Simplify clear_group().
Andre Noll [Sun, 23 May 2010 17:02:06 +0000 (19:02 +0200)]
fecdec_filter: Simplify clear_group().

There is no point in invalidating the index and data pointers if we are about
to free them anyway.  So just set the whole thing to zero. This is easier and
does not require modifications if struct fecdec_group changes.

13 years agoMerge branch 'maint'
Andre Noll [Sun, 23 May 2010 06:34:56 +0000 (08:34 +0200)]
Merge branch 'maint'

13 years agostring: constant value
Gerrit Renker [Sun, 23 May 2010 05:43:04 +0000 (07:43 +0200)]
string: constant value

This replaces the LLONG_MAX constant with the value stolen
from limits.h (that value is only accessible when using
-std=c99). The value of 2^63-1 assumes 64-bit and can also
be computed as (1ULL << (sizeof(long long) * 8 - 1)) - 1).

13 years agoFix paraslash.ico.
Andre Noll [Fri, 21 May 2010 17:16:22 +0000 (19:16 +0200)]
Fix paraslash.ico.

Somehow this broke quite some time ago. The command

convert -colors 16 paraslash.png paraslash.ico

converts the png to an .ico File that is displayed nicely at least
with firefox. Of course, this should be generated on the fly, but
for now it's simpler to just check it in.

13 years agobash_completion: Fix sender completion.
Andre Noll [Wed, 19 May 2010 05:14:35 +0000 (07:14 +0200)]
bash_completion: Fix sender completion.

Commit 6d1b1feadb2e7221874b7be205c51e0fe56d0519 changed the output of
the si command but missed to update the completion script accordingly.

13 years agoMerge remote branch 'fml/master'
Andre Noll [Thu, 13 May 2010 18:13:02 +0000 (20:13 +0200)]
Merge remote branch 'fml/master'

13 years agoNEWS update.
Andre Noll [Thu, 13 May 2010 11:11:59 +0000 (13:11 +0200)]
NEWS update.

13 years agoMerge branch 't/nonblock_api'
Andre Noll [Thu, 13 May 2010 11:08:59 +0000 (13:08 +0200)]
Merge branch 't/nonblock_api'

13 years agoNEWS update.
Andre Noll [Thu, 13 May 2010 11:03:30 +0000 (13:03 +0200)]
NEWS update.

13 years agoMerge branch 't/doc'
Andre Noll [Thu, 13 May 2010 11:02:15 +0000 (13:02 +0200)]
Merge branch 't/doc'

13 years agoMerge branch 'maint'
Andre Noll [Wed, 12 May 2010 22:37:37 +0000 (00:37 +0200)]
Merge branch 'maint'

13 years agooss: Fix double free bug on open failure.
Andre Noll [Wed, 12 May 2010 21:22:37 +0000 (23:22 +0200)]
oss: Fix double free bug on open failure.

If setting the oss parameters (sample format, sample rate, channel
count) fails, we end up freeing the private_oss_data struct twice.

13 years agoRC4: Allocate 8 extra bytes for send buffer.
Andre Noll [Tue, 11 May 2010 07:00:29 +0000 (09:00 +0200)]
RC4: Allocate 8 extra bytes for send buffer.

valgrind on Mac OS complains. Apparently openssl writes some bytes
more than the length of the output buffer.