| Commit message (Collapse) | Author | Files | Lines |
|
Merge some duplicate code into one function.
|
|
When the pause() method fails, leave the pause loop, because calling
pause() on a closed device is not allowed.
|
|
Fix a memory leak: it was not guaranteed that pcm_convert_deinit() was
called for each pcm_convert_init(). This patch always (de)initializes
the pcm_convert library when the audio_output.open flag is flipped.
|
|
Renamed audio_output struct members.
|
|
Move the "while" loop which checks for commands to the caller
ao_pause(). This simplifies the pause() method, and lets us remove
audio_output_is_pending().
|
|
Removed yet another superfluous buffer layer: return the PCM buffer
from pcm_convert() instead of copying PCM data into the
caller-supplied buffer.
|
|
Be sure that the output thread has quite before we start destructing
the output object.
|
|
Free memory allocated by libsamplerate when the output or the decoder
is closed.
|
|
GLib mandates that you initialize all GError objects with NULL prior
to passing it.
|
|
|
|
It is illegal to pass an empty audio buffer around. pcm_resample()
sometimes seems to result in 0 samples, maybe related to
libsamplerate. To work around that problem, add special checks after
both pcm_convert() invocations. Removed the pcm_resample()==0 checks
from pcm_convert().
|
|
|
|
Nobody should call playAudio() with an empty chunk. Add some
assertions on that.
|
|
Since open() and play() close the device on error, we can simply check
audio_output.open instead of audio_output.result after a call.
|
|
When one of several output devices failed, MPD tried to reopen it
quite often, wasting a lot of resources. This patch adds a delay:
wait 10 seconds before retrying. This might be changed to exponential
delays later, but for now, it makes the problem go away.
|
|
Stopping an audio output device without cancelling its buffer doesn't
make sense. Combine the two operations, which saves several cancel
calls.
|
|
When an output plugin fails to play a chunk, close it. This replaces
various manual close() calls in nearly all plugins.
|
|
Don't return 0/-1 on success/error, but true/false. Instead of int,
use bool for storing flags.
|
|
Renamed all functions which were still in CamelCase.
|
|
When there are standardized headers, use these instead of the bloated
os_compat.h.
|
|
pause() puts the audio output into pause mode: if supported, it may
perform a special action, which keeps the device open, but does not
play anything. Output plugins like "shout" might want to play silence
during pause, so their clients won't be disconnected. Plugins which
do not support pausing will simply be closed, and have to be reopened
when unpaused.
This pach includes an implementation for the shout plugin, which
sends silence chunks.
|
|
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.
|
|
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.
|
|
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.
|