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.
Andre Noll [Sat, 24 Mar 2007 21:20:29 +0000 (22:20 +0100)]
ogg_afh.c: store bitrate, frequency and channels in struct audio_file info
This patch also contains some other improvements:
- make sure that we never write beyond the end of the chunk table
- get rid of some unneeded includes
- kill pointless raw_total variable
- get rid of time_total, vi_sampling_rate and vi_bitrate and use
the corresponding members of struct audio_file_info directly
Andre Noll [Sat, 24 Mar 2007 17:14:57 +0000 (18:14 +0100)]
afh: add additional fields channels, frequency, and bitrate to struct audio_format
The idea is that these quantieties are computed by each audio format handler
anyway. So create a common place for them to store that info. This way it
may be used by vss and by afs.
Andre Noll [Thu, 22 Mar 2007 15:15:42 +0000 (16:15 +0100)]
vss.c: Don't try to mmap empty files
as this causes mmap() to return MAP_FAILED, i.e. para_mmap() calls
exit() so para_server dies, which clearly is inapproriate. Instead,
skip the audio file and try the next one if size == 0.
Andre Noll [Mon, 12 Mar 2007 19:38:43 +0000 (20:38 +0100)]
first draft of the mmap patch series
The purpose of these changes to para_server is to not call
read()/fseek() in the audio format handlers and in vss.c but to use
mmap() instead which should result in less code and should also be
faster and less error-prone.
This first patch implements the basic infrastructure for mmap but
keeps the file pointer so that changes may be merged step by step and
changes the ogg vorbis audio format handler to use the new mapping
of the audio file.
Subsequent patches will change the other audio format handlers and
the virtual streaming system to also use mmap instead of read()/fseek().
Andre Noll [Sun, 11 Mar 2007 17:40:08 +0000 (18:40 +0100)]
kill close_audio_file handler from struct audio format.
All audio format handlers just did fclose(), so do this from vss.c
and kill the handler. This also allows to get rid of the global
infile variable in all audio format handlers.