summaryrefslogtreecommitdiff
path: root/src/output
AgeCommit message (Collapse)Author
2019-11-06output/shout: declare metadata as UTF-8Max Kellermann
Apparently, Icecast defaults to ISO-8859-1 for MP3: http://icecast.org/docs/icecast-2.4.0/config-file.html#mountsettings This change forces Icecast to UTF-8 without having to configure it in Icecast's configuration file.
2019-10-29output/Jack: mark ports as terminalNiklas Haas
This is the correct thing to do for ports from which a signal ultimately "originates", such as is the case with mpd.
2019-08-22output/solaris: include sys/stropts.h only on SolarisMax Kellermann
This header had been available for a long time on Linux, but was removed in glibc 2.30. This commit moves the `#include` line inside the `#ifdef __sun` block and adds a fake declaration of `I_FLUSH` for the Linux build. Closes https://github.com/MusicPlayerDaemon/MPD/issues/630
2019-08-21output/Thread: add missing `return` in exception handlerMax Kellermann
2019-08-13output/Thread: fix typo in commentMax Kellermann
2019-08-06output/jack: use jack_free() for Windows compatibilityMax Kellermann
2019-08-06output/jack: use std::atomic_bool for "shutdown" and "pause"Max Kellermann
Without this, the compiler may optimize accesses away.
2019-08-06output/jack: use SIZE_MAX instead of (size_t)-1Max Kellermann
2019-08-02Fix JACK plugin outputting only to left channelDiomendius
The JACK output plugin would not correctly upmix mono input files when exactly 2 output ports were configured. This fixes that.
2019-06-28output/alsa: log when generating silence due to slow decoderMax Kellermann
MPD used to do that when this code lived in the player thread, but it was removed by commit 98a7c62d7a4f716d90af6d78e18d1a3b10bc54b3; and the replacement code in the ALSA output plugin didn't have it.
2019-06-28output/alsa: schedule a timer to generate silenceMax Kellermann
Without this timer, DispatchSockets() may disable the MultiSocketMonitor and if Play() doesn't get called soon, it never gets a chance to generate silence. However if Play() gets called, generating silence isn't necessary anymore... Resulting from this misdesign (added by commit ccafe3f3cf3 in 0.21.3), the silence generator didn't work reliably.
2019-06-28output/alsa: add a new flag "waiting" for xrun managementMax Kellermann
In DispatchSockets(), when there was not enough data, but enough for current playback, the method would disable the "active" flag so the next Play() call would re-enable the MultiSocketMonitor. This was an abuse of the flag which could result in a crash in Cancel(), because that method asserts that the period_buffer is empty, which it may be not. The solution is to add anther flag called "waiting" which shares some behavior with the old flag.
2019-06-28output/alsa: Cancel() also affects "active" (documentation)Max Kellermann
2019-06-28output/alsa: fix comment typoMax Kellermann
2019-06-28output/alsa: fix comment typoMax Kellermann
2019-06-28output/alsa: always redo DrainInternal() after writingMax Kellermann
Draining isn't finished just because the period_buffer has run empty. It is only finished after snd_pcm_drain() has succeeded.
2019-06-28output/alsa: check PCM state before calling snd_pcm_drain()Max Kellermann
Apparently, if snd_pcm_drain() returns EAGAIN, it does not actually want to be called again; the next call will snd_pcm_drain() will also return EAGAIN, forever, even though the PCM state has meanwhile switched to SND_PCM_STATE_SETUP. This causes a busy loop; to fix this, we should always check snd_pcm_state() to see if draining is really required.
2019-06-17output/oss: return early if PcmExport::Export() returns empty arrayMax Kellermann
This can happen if the DoP converter doesn't get enough source samples for one destination quad. This isn't a critical bug, because the OSS plugin doesn't support DoP yet, but it's good to be prepared.
2019-06-05output/httpd: reject some well-known request pathscathugger
Return `404 not found` for some common well-known paths, as clients requesting them usually do that automatically and don't expect endless audio stram. Closes #572
2019-06-05output/httpd: use strncmp instead of memcmpcathugger
memcmp use may result in out of bounds access
2019-06-05output/httpd: fix indentMax Kellermann
2019-04-04output/httpd: close client connection on errorMax Kellermann
This missing piece probably never really hurt, because HttpdClient::OnSocketClosed() would be called right after a socket error, but it's better to be explicit about closing on error.
2019-04-03output/httpd: add missing mutex lockMax Kellermann
2019-04-03output/httpd: add more API documentation about lockingMax Kellermann
2019-03-29Haiku: remove redundant calls to delete_sem()François Revol
Fixes #184. Semaphores are kernel-managed objects, calling delete_sem() twice is not more dangerous than calling close() twice on an fd though, it would just return an error.
2019-03-17output/sles: enable power saving modeMax Kellermann
2019-03-17output/plugins/OSXOutputPlugin: add boost meson dependencyJacob Vosmaer
2019-03-16output/pulse: use pa_channel_map_init_extend() instead of _auto()Max Kellermann
Unlike pa_channel_map_init_auto(), pa_channel_map_init_extend() does not fail if there is no valid mapping for the given channel count, but instead maps additional "AUX" channels. Closes https://github.com/MusicPlayerDaemon/MPD/issues/493
2019-01-25[OSXOutput] Throw an error when device not foundYue Wang
Currently it falls back to system default device (either internal speaker or headphone) when device not found. I believe it is a better to fail in this case, to make it better aligned with platforms (such as alsa).
2019-01-21output/shout: evaluate `tls` option only if TLS is enabled in libshoutMax Kellermann
Fixes build failure after commit 0cea67ee706d73acbd07a48e5d3b758ba016c1a8
2019-01-19shout output plugin: add support for TLSJakob Ovrum
2018-12-28output/httpd/Page: remove obsolete API documentationMax Kellermann
2018-12-28output/httpd/Page: add `noexcept`Max Kellermann
2018-12-28output/httpd/IcyMetaDataServer: add `noexcept`Max Kellermann
2018-12-28output/httpd: add `noexcept`Max Kellermann
2018-12-28remove libwrap supportMax Kellermann
libwrap is an obscure artefact from a past long ago, when source IP address meant something. And its API is "interesting"; it requires the application to expose two global variables `allow_severity` and `deny_severity`. This led to bug #437. I don't want to declare those variables; instead, I'd like to remove libwrap support. Closes #437
2018-12-14change HTTP Version to a valid versionHyShai
2018-11-19check.h: remove obsolete headerMax Kellermann
Since we switched from autotools to Meson in commit 94592c14062d5afc9482d11baa401648082022c0, we don't need to include `config.h` early to properly enable large file support. Meson passes the required macros on the compiler command line instead of defining them in `config.h`. This means we can include `config.h` at any time, whenever we want to check its macros, and there are no ordering constraints.
2018-11-16output/alsa: don't call snd_pcm_drain() if nothing was writtenMax Kellermann
Works around a problem where MPD goes into a busy loop because snd_pcm_drain() always returns `-EAGAIN` without making any progress (fixes #425). This problem was triggered by snd_pcm_drain() after snd_pcm_cancel() and snd_pcm_prepare(), but without submitting any data with snd_pcm_writei(). I believe this is a kernel bug: in non-blocking mode, the kernel's snd_pcm_drain() function returns early. In this mode, it only checks whether snd_pcm_drain_done() has been called already, but snd_pcm_drain_done() is never called if no data was submitted. In blocking mode, the following `for` loop detects this condition, so snd_pcm_drain_done() is not necessary, but without this extra check, we get `-EAGAIN` forever.
2018-11-14output/alsa: drain the whole `ring_buffer`, not just one periodMax Kellermann
This fixes a problem which caused a failure with snd_pcm_writei() because snd_pcm_drain() had already been called in the previous iteration. This commit makes sure that snd_pcm_drain() is only called after the final snd_pcm_writei() call. This fixes discarded samples at the end of playback.
2018-11-14output/alsa: clear error after reopening deviceMax Kellermann
When a playback error has occurred, MPD would never recover until one restarts MPD.
2018-11-14output/alsa: don't lock the mutex in CancelInternal()Max Kellermann
CancelInternal() doesn't need to be protected because it is called synchronously from Cancel().
2018-11-14output/alsa: wake up the client thread after generating silenceMax Kellermann
Fixes a theoretical race condition which could occur in Drain() (but was extremely unlikely).
2018-11-14output/alsa: don't generate silence if ALSA-PCM buffer has enough dataMax Kellermann
If our `ring_buffer` is smaller than the ALSA-PCM buffer (if the latter has more than the 4 periods we allocate), it can happen that the start threshold is crossed and ALSA switches to `SND_PCM_STATE_RUNNING`, but the `ring_buffer` is empty. In this case, MPDD will generate silence, even though the ALSA-PCM buffer has enough data. This causes stuttering (#420). This commit amends an older workaround for a similar problem (commit e08598e7e2526b65fd8790a49794c1d4d00945d0) by adding a snd_pcm_avail() check, and only generate silence if there is less than one period of data in the ALSA-PCM buffer. Fixes #420
2018-11-14output/alsa: clear the `period_buffer` in LockCaughtError()Max Kellermann
The method Cancel() assumes that the `period_buffer` must be empty when `active==false`, but that is not the case when Play() fails. Of course the assertion in Cancel() is not 100% correct, but I decided to rather fix this in LockCaughtError() because the `period_buffer` should only be accessed from within the RTIO thread, and this is the only code path where `active` can be set to `false` with a non-empty `period_buffer`. Fixes #423
2018-11-14output/alsa: throw on snd_pcm_writei() error while drainingMax Kellermann
This implements real error handling, and avoids calling CancelInternal() from this code path.
2018-11-14output/alsa: fix wrong use of `errno`Max Kellermann
alsa-lib doesn't set errno, it returns errors as negative integers.
2018-11-14output/alsa: throw after snd_pcm_drain() errorMax Kellermann
2018-11-14output/alsa: refactor the drain EAGAIN workaroundMax Kellermann
2018-11-14output/alsa: remove snd_pcm_state() check from DrainInternal()Max Kellermann
This check was added 9 years ago in commit 4dc25d3908648cc781fe43e54243bb64aec4b2cb to work around a dmix bug which I assume has been fixed long ago. Removing this fixes another corner case: if draining is requested before the start threshold is reached, the PCM is still in SND_PCM_STATE_PREPARED but not yet SND_PCM_STATE_RUNNING, which means the submitted data will never be played. This corner case is realistic when playing songs shorter than the ALSA buffer (if the buffer is very large).