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.
Andre Noll [Sun, 11 Mar 2007 17:11:37 +0000 (18:11 +0100)]
aac_afh.c: free the inbuffer already in aac_get_file_info()
No need to wait for this until the audio file gets closed. This
patch also fixes two occurences of a bug where the length of the
input buffer was not set correctly.
Andre Noll [Sun, 11 Mar 2007 16:34:00 +0000 (17:34 +0100)]
introduce struct audio_format_info
This further simplifies the audio format handlers. The chunk_table
and the header info is now contained in that struct which allows
to move the cleanup on eof from the audio format handlers to the
virtual streaming system.
Andre Noll [Sat, 10 Mar 2007 19:31:00 +0000 (20:31 +0100)]
ogg_afh.c: Switch to ogg vorbis callbacks
This allows to call ov_clear() already during ogg_get_file_info() which
in turn simplifies ogg_close_audio_file().
This is a preparation for moving the close function of the audio
format handlers to the virtual streaming system as they all do
essentially the same now.
Andre Noll [Sun, 4 Mar 2007 22:54:17 +0000 (23:54 +0100)]
simplify ogg_compute_chunk_table()
it rewinds the input file on entry and on exit. Do this in the caller instead
which allows to get rid of the file parameter in ogg_compute_chunk_table().
Andre Noll [Sun, 4 Mar 2007 22:22:43 +0000 (23:22 +0100)]
simplify vss_read_chunk()
All its parameters are known globally within vss.c, so omit them.
Also, return an int instead of the pointer to the inbuffer which is
also known to the caller.
This patch also introduces para_fseek() in fd.c which is used by
mp3.c and vss.c and changes the mp3 audio format handler so that it
uses the new function and always check the return value.
Andre Noll [Sun, 4 Mar 2007 20:07:33 +0000 (21:07 +0100)]
unify all audio format handlers
This changes the ogg vorbis audio format handler such that its read_chunk and
reposition_stream functions coincide with those of the other audio format
handlers.
Andre Noll [Sun, 4 Mar 2007 19:18:34 +0000 (20:18 +0100)]
unify aac and mp3 audio format handlers
This makes the mp3 audio format handler use a chunk table just like
m4a and ogg vorbis already do. Moreover, the aac and mp3 audio format
handlers now have identical read_chunk and reposition_stream handlers.
Next step is to tweak the ogg vorbis audio format handler so that
it also fits into this scheme. In the end, this allows to move
read_chunk() and reposition_stream() from the audio format handlers
one layer up to the virtual streaming system and to kill the function
pointers in struct audio_format.
The advantage of this change that it avoids duplicated/similar code, and
that new audio format handlers can added easier.
Andre Noll [Fri, 2 Mar 2007 09:14:31 +0000 (10:14 +0100)]
osx_write.c: Kill sleep() on buffer underruns
This was a leftover from the mpg123 patch for mac os which does
more harm than good. It could cause para_write/para_audiod to
block under certain circumstances.
Andre Noll [Thu, 1 Mar 2007 19:42:32 +0000 (20:42 +0100)]
filter.c: Register tasks in proper order
The order is important as it determines the order in which
the pre_select functions are going to be called by the scheduler.
In the previous code, the scheduler called stdin->pre_select _before_
filter_chain->pre_select() which gave rise to the following scenario
(note that there's no filter_chain->post_select()):
stdin->pre_select(): set stdin for reading
filter_chain->pre_select(): nothing to do
stdin->post_select(): read buffer
stdin->pre_select(): do _not_ set stdin for reading as stdin buffer is full
For para_filter, after the last there are no fds set which causes the
scheduler to use the default timeout of 1s. This had the effect that
decoding of aac files started only after a few seconds.
With the roles of interchanged tasks the scenario is as follows:
filter_chain->pre_select(): nothing to do
stdin->pre_select(): set stdin for reading
stdin->post_select(): read buffer
filter_chain->pre_select(): convert buffer
stdin->pre_select(): set stdin _again_ as stdin buffer is not full
Alternative fix might be to use filter_pre_select() also for post_select.
Andre Noll [Thu, 15 Feb 2007 17:42:24 +0000 (18:42 +0100)]
Makefile.in: only build and install man pages for supported binaries
This makes it possible again to install from the git repo even if not
all binaries can be build, e.g. Mac OS which always lacks para_fade
(reverts a858de7cf9437cf9a3569eb4bc297c5b0e768994).
Also, don't refuse to install and don't complain if $VARDIR
(/var/paraslash) can not be created, as this is non-fatal.
Andre Noll [Sun, 11 Feb 2007 22:45:52 +0000 (23:45 +0100)]
recv_common: fix memory leak and invalid free in error path
As split_args() returns pointers that point within the given string,
it is wrong to free the individual pieces. However, the array of
substrings must be freed. parse_receiver_args() got both of these
wrong :(
Andre Noll [Sun, 11 Feb 2007 21:37:49 +0000 (22:37 +0100)]
fix a memory leak in the RSA key handling
RSA keys must be freed by using openssl's RSA_free() rather than the
usual free(). This leak turns out to be more serious as the amount
of leaked memory increased by about 300 bytes every time para_server
reread the user list (i.e. the hup command was executed or para_server
received SIGHUP).
Andre Noll [Sun, 11 Feb 2007 20:57:49 +0000 (21:57 +0100)]
simplify lookup_user()
It's easier to just pass the name of the user to be looked up. This
fixes a memory leak btw. because u.name was strdupped and never freed.
That leak wasn't serious though as is happened in the child process.