Andre Noll [Tue, 13 Nov 2007 19:13:02 +0000 (20:13 +0100)]
Fix tv_divide().
The old code contained an integer overflow which caused the mp3 audio
format handler to compute the chunk of large mp3 files incorrectly.
Moreover, the code was more complicated than necessary. So replace it
by a simple calculation which just transforms the given struct timeval
into its number of microseconds, does the division and transforms
the quotient back to a struct timeval.
Thanks to Gerrit Renker for pointing out the problem.
Andre Noll [Fri, 14 Sep 2007 09:16:27 +0000 (11:16 +0200)]
rc4: Round up output buffer size.
valgrind indicated that RC4() writes beyond the end of the output buffer which
was was of the same size than the input buffer. Workaround this by rounding up
the output buffer size to a multiple of 8.
Andre Noll [Thu, 13 Sep 2007 19:57:33 +0000 (21:57 +0200)]
ogg_afh.c: Fix a memory leak.
In a non-ogg file is passed to the ogg audio format handler, such that the
initial ogg_sync_pageout() fails, the old code leaked the memory which was
allocated for the stream_in and the stream_out pointers.
Andre Noll [Tue, 4 Sep 2007 20:16:06 +0000 (22:16 +0200)]
audiod: Fix a memory leak.
If the config file doesn't exist, configfile_exists() returnes NULL.
The old code leaked a pointer to the config file in this case.
This function is only called once at startup, so the leak is benign.
Morover, kill the static variable and the check if (!config_file) which
is always true.
Andre Noll [Sun, 12 Aug 2007 21:26:27 +0000 (23:26 +0200)]
dccp_send.c: Implement chunk queuing for dccp.
As Gerrit mentioned, it might be a good idea to use chunk
queueing also for dccp. This patch uses the new cq_xxx()
abstractions in the same way as the http sender.
Andre Noll [Sun, 12 Aug 2007 16:36:53 +0000 (18:36 +0200)]
Abstract out chunk_queue code.
This moves the chunk handling code to separate functions cq_foo(). They
take pointers to a chunk queue, which makes them orthogonal to the rest of
http_send.c.
Andre Noll [Wed, 8 Aug 2007 22:00:45 +0000 (00:00 +0200)]
Rewrite chunk queueing.
Since paraslash-0.2.16 the audio file is mmapped, so it is no longer neccessary
to make a copy of the chunk data in case a chunk can not be sent immediately
because the write would block. Just remember the chunk number and the number of
bytes of that chunk which were sent (non-zero in case of short writes).
The chunk data can then be retrieved by the new vss_get_chunk() function.
Andre Noll [Mon, 6 Aug 2007 14:09:28 +0000 (16:09 +0200)]
dccp sender: Keep polling until an entry becomes free (Gerrit Renker).
If write() on the dccp fd fails with EAGAIN, the current code retries
100 times and then gives up, returning -E_DCCP_WRITE which causes a
shutdown of the dccp connection.
CCID3 has a sending wait queue which fills up and is emptied
asynchronously. The EAGAIN case means that there is currently no space
in the wait queue, but this can change at any moment and is thus not
an error condition. So keep polling until an entry becomes free.
Andre Noll [Sat, 7 Jul 2007 17:11:45 +0000 (19:11 +0200)]
mysql_selector.c: introduce the myslq lock
This fixes a race condition in para_server:
parent child
real_query
real_query
mysql_store_result
This could cause para_server to hang in case the child process issued
a query which does not yield a result. It's hard to hit though. Fix is
to take the lock before the call to real_query, and release it after
mysql_store_result().
The patch also fixes a format string bug which was introduced by the patch
that switched to my_ulonglong for suitable variables in mysql_selector.c.
These need "%lli".
Andre Noll [Sun, 10 Jun 2007 23:45:51 +0000 (01:45 +0200)]
clean up error.h
It contained quite some unused error codes. This patch gets rid of
them and thus saves some space in the resulting binaries.
More importantly, there were two instances where a source file used
an error value of another source file (which is ok), but the object
file of that other source file would not get linked into the resulting
binary (which is not ok):
- aac_afh.c used E_AACDEC_INIT, which is not contained in
para_server
- http_recv.c used E_OVERRUN which is defined only if ortp
support was compiled in.
The patch also fixes another bug in the ogg vorbis audio format handler
where (the positive value) E_STREAM_PAGEIN was returned instead of
-E_STREAM_PAGEIN in case ogg_stream_pagein() failed.
Andre Noll [Mon, 21 May 2007 20:53:23 +0000 (22:53 +0200)]
error.h: move E_BAD_USER from audiod_command to command error list
Dooh. This caused a segfault in the server's child if an unkown user
connected. Fortunately, this happened right before the process exited
anyway, so it's not a security issue.
Andre Noll [Fri, 30 Mar 2007 15:14:04 +0000 (17:14 +0200)]
fix compress filter for big endian machines
This was broken since day one as it depended on little-endianness. Fix
it by checking the byte sex in configure and let the decoders
produce host endian 16 bit audio output by using the new
write_int16_host_endian() inline function in filter.h
This allows to omit the ugly byte-swapping in osx_write we've had
before.