Commit Graph

13835 Commits

Author SHA1 Message Date
Max Kellermann 5d12f52873 output/alsa: clear error after reopening device
When a playback error has occurred, MPD would never recover until one
restarts MPD.
2018-11-14 13:20:54 +01:00
Max Kellermann a8bf8ede01 event/Thread: reduce the RTIO timer slack to 10us
MPD's default is 100ms, which is too long for the real-time I/O
thread.  The OutputThread has 100us, but the real-time I/O thread
might have tighter deadlines.

This change has currently no effect (I believe), because nobody uses
timers on the RTIO thread.
2018-11-14 12:11:57 +01:00
Max Kellermann 8682183bc3 LogInit: default to journal if MPD was started as systemd service 2018-11-14 12:07:22 +01:00
Max Kellermann 94c31d0da9 doc/mpdconf.example: no, logging is not disabled without `log_file` 2018-11-14 12:07:22 +01:00
Max Kellermann 464a4cbeec python/build/libs.py: upgrade FFmpeg to 4.1 2018-11-14 11:50:51 +01:00
Max Kellermann 9f0cbf418a python/build/libs.py: upgrade CURL to 7.62.0 2018-11-14 11:50:51 +01:00
Max Kellermann b477f86c92 output/alsa: don't lock the mutex in CancelInternal()
CancelInternal() doesn't need to be protected because it is called
synchronously from Cancel().
2018-11-14 11:50:51 +01:00
Max Kellermann 020371f145 output/alsa: wake up the client thread after generating silence
Fixes a theoretical race condition which could occur in Drain() (but
was extremely unlikely).
2018-11-14 11:48:55 +01:00
Max Kellermann ccafe3f3cf output/alsa: don't generate silence if ALSA-PCM buffer has enough data
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
e08598e7e2) 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-14 11:17:59 +01:00
Max Kellermann 3830748de5 output/alsa: clear the `period_buffer` in LockCaughtError()
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-14 10:24:08 +01:00
Max Kellermann 1a43f5145d output/alsa: throw on snd_pcm_writei() error while draining
This implements real error handling, and avoids calling
CancelInternal() from this code path.
2018-11-14 10:08:29 +01:00
Max Kellermann 7f143a83c1 output/alsa: fix wrong use of `errno`
alsa-lib doesn't set errno, it returns errors as negative integers.
2018-11-14 10:07:23 +01:00
Max Kellermann 6ccc254179 output/alsa: throw after snd_pcm_drain() error 2018-11-14 10:04:10 +01:00
Max Kellermann 7db2450447 output/alsa: refactor the drain EAGAIN workaround 2018-11-14 10:00:50 +01:00
Max Kellermann 6c2a6a65e0 output/alsa: remove snd_pcm_state() check from DrainInternal()
This check was added 9 years ago in commit
4dc25d3908 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).
2018-11-14 09:48:24 +01:00
Max Kellermann 4247a757b3 output/alsa: call snd_pcm_prepare() if draining is requested early
This fixes a corner case which has probably never occurred and
probably never will: if Cancel() is called, and then Play() followed
by Drain(), the plugin should really play that data.  However
currently, this never happens, because snd_pcm_prepare() is never
called.
2018-11-14 09:43:14 +01:00
Max Kellermann 57e34823d8 increment version number to 0.21.3 2018-11-12 13:59:17 +01:00
Max Kellermann 3c93decdf0 release v0.21.2 2018-11-12 13:33:04 +01:00
Max Kellermann 89e7a5018d doc/protocol.rst: explain song positions vs ids 2018-11-12 13:19:10 +01:00
Max Kellermann 7235b46e5e doc/protocol.rst: rename "current playlist" to "queue" 2018-11-12 13:12:29 +01:00
Max Kellermann 0852226a48 doc/protocol.rst: deprecated `close` and `kill` 2018-11-12 13:03:09 +01:00
Max Kellermann e20d215abf doc/protocol.rst: more markup 2018-11-12 13:01:43 +01:00
Max Kellermann e4b9b67e24 doc/protocol.rst: deprecation 2018-11-12 12:57:53 +01:00
Max Kellermann 685b78828d doc/protocol.rst: mention that unknown lines may be omitted 2018-11-12 12:57:45 +01:00
Max Kellermann 060908d5c4 song/Filter: add operator "contains"
Closes #410
2018-11-12 12:49:01 +01:00
Max Kellermann 0b0f4c61f1 doc/protocol.rst: remove documentation about `==` matching substrings
I added this sentence in commit
5271e81ebe, but this was merely
documented the legacy status quo, which has always been undocumented
for old-style filters.

But for new filters, using "==" for sub strings was a surprising
"feature", which I removed in commit
ac0852b4e3.
2018-11-12 12:45:40 +01:00
Max Kellermann 228bf7eb09 output/thread: cancel the AudioOutputSource() instead of closing it
This fixes the assertion failure due to calling
AudioOutputSource::Close() twice.
2018-11-12 12:24:25 +01:00
Max Kellermann 5eaf2b8fc3 output/control: always close the `AudioOutputSource` in `RELEASE`
Fixes a crash bug with `always_on` outputs which occurs because the
`AudioOutputSource` still has a pointer to an outdated `MusicChunk`.

Fixes #415
2018-11-12 12:21:59 +01:00
Max Kellermann e097fef79e output/control: add command `RELEASE`
With the new command, the decision to pause or close the output moves
into the output thread.
2018-11-12 12:09:37 +01:00
Max Kellermann 9a813cd3b1 output/Thread: update comment 2018-11-12 12:09:02 +01:00
Max Kellermann 1c60c8e014 output/Filtered: catch Drain() exceptions in CloseOutput() 2018-11-12 12:05:54 +01:00
Max Kellermann eddda95900 output/interface: document that Drain() may throw 2018-11-12 12:04:42 +01:00
Max Kellermann 72184dccfc song/StringFilter: support regular expressions with "=~" and "!~"
This feature requires `libpcre`.
2018-11-11 12:55:35 +01:00
Max Kellermann fee75dc766 {output,mixer}/alsa: use snd_pcm_poll_descriptors_revents()
This call was missing, causing very high CPU usage when the ALSA
output plugin was used with dmix.

Closes #391
2018-11-11 12:37:29 +01:00
Max Kellermann ba5c856f15 events/MultiSocketMonitor: add method ForEachResult() 2018-11-11 12:37:28 +01:00
Max Kellermann 12308a0f55 lib/alsa/NonBlock: move the functions into a class managing the state 2018-11-11 12:37:25 +01:00
Max Kellermann a958abde2f Merge branch 'fix_362' of git://github.com/miccoli/MPD 2018-11-11 12:37:13 +01:00
Max Kellermann 583208db7e output/httpd: fix nullptr dereference crash bug
When `metadata_sent` is `false`, the plugin assumes there is metadata
which must be sent, even if no metadata page was passed to the plugin.
Initializing it to `true` avoids dereferencing this `nullptr`.

Fixes #412
2018-11-08 09:37:18 +01:00
Max Kellermann 7b5ba15170 song/Filter: move code to ParseStringFilter() 2018-11-08 00:02:10 +01:00
Max Kellermann d5e0d49f86 song/{Tag,Uri}SongFilter: pass `StringFilter&&` to constructor 2018-11-07 23:57:42 +01:00
Max Kellermann 73b22d82aa song/StringFilter: move `negated` flag from containing class 2018-11-07 23:47:31 +01:00
Max Kellermann db51cc4e02 lib/zlib/meson.build: add zlib_dep to `declare_dependency`
Fixes potential compiler error when zlib is installed in a
non-standard directory.
2018-11-07 23:32:23 +01:00
Max Kellermann be8a52a914 NEWS: mention the ENABLE_ZLIB fix 2018-11-07 23:26:33 +01:00
Max Kellermann ad597a8ff0 lib/zlib/meson.build: define ENABLE_ZLIB
Fixes #414
2018-11-07 23:24:58 +01:00
Max Kellermann b1fe105904 output/Source: reset current_chunk in Open()
If the output is already open, the `current_chunk` pointer may be
bogus and out of sync with `SharedPipeConsumer::chunk`, leading to an
assertion failure in `SharedPipeConsumer::Consume()`.

Fixes #411
2018-11-07 00:17:48 +01:00
Max Kellermann 451b142e3a player/Thread: finish decoder startup before checking the buffer
This fixes a valgrind warning because `buffer_before_play`
initialization needs to know the audio format from the decoder.
2018-11-06 23:52:26 +01:00
Max Kellermann 2833625266 doc/user.rst: more markup 2018-11-06 22:38:34 +01:00
Max Kellermann 0464028872 doc/user.rst: add information about debug build 2018-11-06 22:38:24 +01:00
Max Kellermann 98985c03b0 check.h: remove obsolete ENABLE_LARGEFILE check
Meson always enables large file support on the compiler command line,
thus config.h doesn't need to be included anymore.  We'll remove the
whole `check.h` header soon.

Closes #409
2018-11-05 21:25:59 +01:00
Max Kellermann 793fd8c479 decoder/ffmpeg: eliminate GetSampleFormat() 2018-11-04 22:36:17 +01:00