| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
There was a known deadlocking bug in the notify library: when the
other thread set notify->pending after the according check in
notify_wait(), the latter thread was deadlocked. Resolve this by
synchronizing all accesses to notify->pending with the notify object's
mutex. Since notify_signal_sync() was never used, we can remove it.
As a consequence, we don't need notify_enter() and notify_leave()
anymore; eliminate them, too.
|
|
|
|
| |
SongList has been superseded by struct songvec.
|
|
|
|
|
|
|
|
| |
During debugging, I found a deadlock between flushAudioBuffer() and
the audio_output_task(): audio_output_task() didn't notice that there
is a command, and flushAudioBuffer() waited forever in notify_wait().
I am not sure yet what is the real cause; work around this for now by
waking up non-finished audio outputs in every iteration.
|
|
|
|
|
|
| |
Due to a merge error, I broke the function handleUpdate(). It did not
do anything for the global update, and it did not send a proper
response to the client. This patch fixes both bugs.
|
|
|
|
|
|
|
| |
To check whether a device is really on or off, we should rather check
audio_output.open, instead of managing another variable. Wrap
audio_output.open in the inline function audio_output_is_open() and
use it instead of DEVICE_ON and DEVICE_OFF.
|
|
|
|
|
|
|
| |
Send an output buffer to all output plugins at the same time, instead
of waiting for each of them separately. Make several functions
non-blocking, and introduce the new function audio_output_wait_all()
to synchronize with all audio output threads.
|
|
|
|
| |
Why send tags to a device which isn't enabled?
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
We have eliminated direct accesses to the audio_output struct from
the all output plugins. Make it opaque for them, and move its real
declaration to output_internal.h, similar to decoder_internal.h.
Pass the opaque structure to plugin.init() only, which will return the
plugin's data pointer on success, and NULL on failure. This data
pointer will be passed to all other methods instead of the
audio_output struct.
|
|
|
|
|
|
| |
The JACK output plugin needs to reset its "opened" flag when the JACK
server fails. To prevent it from accessing the audio_output struct
directly introduce the API function audio_output_closed().
|
|
|
|
|
|
| |
Reduce direct accesses to the audio_output struct from the plugins:
this time, eliminate all accesses to audio_output.name. The name is
required by some plugins for log messages.
|
|
|
|
|
| |
Since the output plugin returns a value indicating success or error,
we can have the output core code assign the "open" flag.
|
|
|
|
|
|
|
| |
Pass the globally configured audio_format as a const pointer to
plugin.init(). plugin.open() gets a writable pointer which contains
the audio_format requested by the plugin. Its initial value is either
the configured audio_format or the input file's audio_format.
|
|
|
|
|
|
| |
To keep I/O nastiness and latencies away from the core, move the audio
output code to a separate thread, one per output. The thread is
created on demand, and currently runs until mpd exits.
|
|
|
|
|
| |
With the macro NOTIFY_INITIALIZER, you can statically initialize a
notify object.
|
|
|
|
| |
Destroy the mutex when it is not used anymore.
|
|
|
|
|
| |
When a mutex cannot be created, there must be something very wrong.
Induce panic and abort MPD in this case.
|
|
|
|
|
| |
"struct notify" is the same as the "Notify" typedef. It can be
forward-declared and has a lower case name.
|
|
|
|
|
|
| |
With patch 8d2830b3, I broke "addid": it did not return the id of the
new song, because of a typo in the return condition (== instead of
!=).
|
|
|
|
|
| |
chunk_length can be converted to a local variable, because it is
always reset to 0 after it was used.
|
|
|
|
|
|
|
| |
Since flacSendChunk() is a trivial function and is only used in one
location, move the code there. The advantage is that calling
decoder_data() directly returns the decoder_command value, so we can
eliminate one decoder_get_command() call.
|
|
|
|
|
|
|
|
| |
Support for bit rates except 16 bits (and 8 bits on little endian) has
always been broken. Since we added optimized functions for 8, 16,
24/32 bits, we can remove the generic flac_convert() function.
Instead of removing it, convert it to a wrapper function for
flac_convert_*().
|
|
|
|
|
| |
Same optimization for 8 and 32 bit files, like the previous patch for
16 bit. Along the way, this patch adds 24 bit FLAC support!
|
|
|
|
|
|
| |
flac_convert_16() runs a lot faster than the generic (and quite buggy)
function flac_convert(). flac_convert_16() is only used for
non-stereo files, since there is already flac_convert_stereo16().
|
|
|
|
|
|
| |
By mistake, I casted the sample value to uint16_t, which is wrong.
This patch simplifies the code by using a int16_t pointer instead of
casting to int16_t* every time.
|
|
|
|
|
|
|
| |
There is still a lot of duplicated code in flac_plugin.c and
oggflac_plugin.c. Move code from flac_plugin.c to _flac_common.c, and
use the new function flac_common_write() also in oggflac_plugin.c,
porting lots of optimizations over to it.
|
|
|
|
|
| |
The previous patch on this topic was incomplete: it still added
data->chunk_length when calling flac_convert(). Remove this, too.
|
|
|
|
|
|
| |
The inline function audio_format_sample_size() calculates how many
bytes each sample consumes. This function already takes into account
that 24 bit samples are 4 bytes long, not 3.
|
|
|
|
|
|
|
| |
Instead of letting ALSA block for us (and potentially allowing
something stupid on certain hardware or drivers), we do the
sleeping ourselves. We calculate the sleep to be a fraction of
period_time to avoid oversleeping (and thus audible skipping).
|
|
|
|
| |
Potentially broken free() implementations don't like it
|
|
|
|
|
| |
Use freeList() instead of free() to free all elements in
the list.
|
|
|
|
|
|
| |
open(2) should only interrupt on "slow" devices, afaik...
[mk: still using fopen()]
|
| |
|
|
|
|
|
|
| |
Any pruned files will be noticed during update and pruned
from the live database, so this inefficient function can
go away and never come back.
|
|
|
|
|
|
|
|
|
| |
A lot of the preparation was needed (and done in previous
months) in making update thread-safe, but here it is.
This was the first thing I made work inside a thread when I
started mpd-uclinux many years ago, and also the last thing I've
done in mainline mpd to work inside a thread, go figure.
|
|
|
|
| |
Converted some more functions and their callers to enum update_return.
|
|
|
|
| |
This way we avoid having to document -1, 0, 1
|
|
|
|
|
|
| |
Pruning is very expensive and we won't need it in the future
anyways. This brings startup back to previous speeds (before
songvec changes).
|
|
|
|
|
|
|
|
|
| |
pthreads with our existing signal blocking/handling is broken,
for now just sleep a bit in the child to prevent the CHLD handler
from being called too early. Also, improve error reporting when
handling SIGCHLD by storing the status to be called in the main
task (which can be logged, since we can't do logging inside the
sig handler).
|
|
|
|
|
|
|
| |
Our linked-list implementation is wasteful and the
SongList isn't modified enough to benefit from being a linked
list. So use a more compact array of song pointers which
saves ~200K on a library with ~9K songs (on x86-32).
|
|
|
|
|
|
|
|
|
|
|
|
| |
It hasn't been used in many years
commit 3a89afdd80f228139554372a83a9d74486acf691
Author: Warren Dukes <warren.dukes@gmail.com>
Date: Sat Nov 20 20:28:32 2004 +0000
remove --update-db option
(SVN r2719)
|
|
|
|
|
| |
LOC reduction and less noise makes things easier for
tired old folks to follow.
|
|
|
|
|
|
|
| |
This allows us to avoid the nasty repetition in strncmp(foo,
bar, strlen(foo)). We'll miss out on the compiler optimizing
strlen() into sizeof() - 1 for string literals for this; but we
don't use this it for performance-critical functions anyways...
|
| |
|
|
|
|
| |
Noticed-by: Courtney Cavin
|
|
|
|
|
|
|
| |
This should save a few thousand ops. Not worth it to malloc
for such a small (3-words on 32-bit ARM and x86) structures.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
|
| |
|
|
|
|
|
| |
It is legal to call wakeup_main_task() from within the main thread,
e.g. from within a signal handler. Remove the assertion.
|
|
|
|
| |
Remove duplicated code.
|