Commit Graph

15694 Commits

Author SHA1 Message Date
Max Kellermann
01a04baf7b util/DivideString: remove unused library 2025-03-10 18:35:20 +01:00
Max Kellermann
46b461df42 playlist/pls: migrate the line parser to use std::string_view 2025-03-10 18:35:20 +01:00
Max Kellermann
898e0a2bc4 test/playlist: unit tests for the playlist plugins
Only "pls" for now.
2025-03-10 18:35:20 +01:00
Max Kellermann
2d3271859f input/memory: new implementation (for unit tests) 2025-03-10 18:17:33 +01:00
Max Kellermann
b6672004bc util/StringCompare: add SkipPrefixIgnoreCase() 2025-03-10 18:17:33 +01:00
Max Kellermann
eafca183a6 input/meson.build: add libinput_basic.a
This is the middle ground between libinput_api.a (the raw API) and
libinput_glue.a (dependencies on all plugins).
2025-03-10 17:13:51 +01:00
Max Kellermann
59f9e0ca70 input/meson.build: do not compile ProxyInputStream.cxx twice 2025-03-10 17:11:12 +01:00
Max Kellermann
800a03f0dc playlist/plugins/meson.build: add missing dependencies 2025-03-10 14:33:41 +01:00
Max Kellermann
55c11448ff util/NumberParser: add ParseIntegerTo()
An version of the function without the `std::optional` overhead.
2025-03-10 14:04:50 +01:00
Max Kellermann
e9c1ea684b util/NumberParser: add std::from_chars() wrapper taking std::string_view 2025-03-10 14:04:50 +01:00
Max Kellermann
103487e8ad event/InotifyEvent: add method IsDefined() 2025-03-10 14:04:50 +01:00
Max Kellermann
4cefb30dd9 decoder/flac: ignore FLAC__STREAM_DECODER_END_OF_LINK (FLAC 1.5)
Fixes -Wswitch compiler warning when building with FLAC 1.5.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/2219
2025-02-28 10:32:47 +01:00
Jochen Sprickerhof
d822685c53 config/File: support resetting repeatable params
This allows resetting bind_to_address to override the default value in a
included config.
2025-02-21 13:52:44 +01:00
Max Kellermann
85014b5fa2 event/Loop: move code to Wait() 2025-02-13 16:54:36 +01:00
Max Kellermann
aff929dbd6 event/Loop: rename Wait() to Poll()
Preparing to have another Wait() method wrapping Poll() and io_uring.
2025-02-13 16:53:49 +01:00
Max Kellermann
dda85e02bf io/Open: add TryOpen(struct open_how), Open(struct open_how) 2025-02-13 16:09:12 +01:00
Max Kellermann
5b393052ee event/Loop: pass timeout=nullptr to io_uring if there is no timer 2025-02-13 16:04:07 +01:00
Max Kellermann
624da8ce5b event/Loop: use io_uring_prep_poll_multishot() on the epoll fd
This wraps epoll and io_uring the other way: previously, we had the
io_uring file descriptor registered in epoll and when it became ready,
we could query its completion ring.  The problem is that the poll
wakeups cause considerable overhead in the Linux kernel, see
https://lore.kernel.org/io-uring/20250128133927.3989681-9-max.kellermann@ionos.com/

By wrapping epoll inside io_uring using
io_uring_prep_poll_multishot(), the "outer" loop is io_uring and
inside it, we have epoll.  This adds another system call for epoll,
but that will go away as soon as most operations are going through
io_uring.  Previously, io_uring had this extra system call.
2025-02-13 16:02:40 +01:00
Max Kellermann
bca9e3e347 io/uring/Queue: dispatch all completions in SubmitAndWaitDispatchOneCompletion()
io_uring_submit_and_wait_timeout() can return multiple completions,
even if we wait for only one.  We should dispatch them all or we miss
wakeups.
2025-02-13 14:53:30 +01:00
Max Kellermann
2276ebd70f io/uring/Queue: add DispatchCompletions() overload using io_uring_for_each_cqe() 2025-02-13 14:53:24 +01:00
Max Kellermann
a9bee1c64b io/uring/Ring: add io_uring_for_each_cqe() wrapper 2025-02-13 14:53:17 +01:00
Max Kellermann
c8e88408b2 io/uring/Ring: ignore EINTR 2025-02-13 14:53:11 +01:00
Max Kellermann
45644759fe io/uring/CancellableOperation: invoke OnUringCompletion() in destructor
This is important for operations that have complex cancellation
procedures (e.g. if they need to free buffers).  They might leave an
Operation instance in the queue.
2025-02-13 14:52:52 +01:00
Max Kellermann
e014d31972 io/uring/Ring: add io_uring_submit_and_wait_timeout() wrapper 2025-02-13 14:52:37 +01:00
Max Kellermann
b7655d38f7 io/uring/Queue: support IORING_CQE_F_MORE 2025-02-13 14:52:30 +01:00
Max Kellermann
268f737ac4 meson.build: suppress -Wmissing-field-initializers
There's nothing wrong with initializing only some fields.
2025-02-13 14:21:38 +01:00
Max Kellermann
80ff0a062a system/EpollFD: add method GetFileDescriptor() 2025-02-13 14:19:28 +01:00
Camille Scholtz
b8289ae923 input/meson.build: Add missing dependency 2025-02-03 23:07:58 +01:00
Max Kellermann
6b92b7adb9 util/PacketBigEndian: add operator| 2025-02-01 19:30:17 +01:00
Max Kellermann
00a352ffcd event/Loop: explicit io_uring initialization
Log the io_uring initialization error at MPD startup.
2025-02-01 19:20:50 +01:00
Max Kellermann
63cc07b8a7 event/Loop: add method SetThread()
Require to call it before calling Run(); remove the setter from Run().
This gives class EventThread more control over when it is initialized.
2025-02-01 19:19:59 +01:00
Max Kellermann
b2bf95009b event/Thread: use inline initializers 2025-02-01 18:24:02 +01:00
gd
7fb195bc0b android: Context.cxx - in GetExternalFilesDir removed assert type != nullptr
May be null for the root of the files directory.
2025-02-01 18:08:52 +01:00
Camille Scholtz
e3cf9bb0a1 Fix deamon mode on macos 2025-02-01 18:05:49 +01:00
Camille Scholtz
509786cbf1 Revert "remove macOS support"
This reverts commit 518ce0187a.
2025-02-01 18:05:13 +01:00
gd
f15b6a43d3 Logging: curl - write debug output through MPD log instead of curl writing directly to stderr.
The output gets the standard MPD log format with domain curl and a timestamp.
Using CURLOPT_DEBUGFUNCTION that is only called when CURLOPT_VERBOSE is in effect
when MPD log level is verbose.
2025-02-01 08:53:38 +02:00
Max Kellermann
63ad12bb89 storage/nfs: MapUTF8("") returns the full URL including parameters
Closes https://github.com/MusicPlayerDaemon/MPD/issues/2154
2025-01-30 20:04:19 +01:00
Max Kellermann
7c4ddb5943 input/uring: initialize uring_input_queue lazily
The BlockingCall() in InitUringInputPlugin() did not work because the
EventThread was not yet started.  This was never noticed until commit
e309941646 which enabled `IORING_SETUP_SINGLE_ISSUER`, and suddenly
the kernel refused to accept io_uring_submit() calls from the
io_thread because io_uring_setup() had been called from the main
thread.
2025-01-30 20:00:57 +01:00
Max Kellermann
3cf5354e3f Revert "Main: start IO threads before initializing the rest"
This reverts commit abc8420697.  This
was a bad idea, too, because it broke daemonization.
2025-01-30 19:58:15 +01:00
Max Kellermann
838398103c Revert "event/Thread: start the thread in the constructor"
This reverts commit b49cfe96f4.  It was
a bad idea because it broke signal handlers.  I need to find a better
way to fix io_uring intialization.
2025-01-30 19:58:15 +01:00
Max Kellermann
30bd70939a lib/nfs/Connection: remove unnecessary include 2025-01-30 17:24:20 +01:00
Max Kellermann
275cd9d1d0 lib/nfs/Connection: give up connection after NFS4ERR_EXPIRED
Once a NFS request fails with NFS4ERR_EXPIRED, the whole connection is
broken and we need to open a new one.  I wish libnfs would report this
to us as a connection-level error, but instead only the one request
fails; therefore this workaround is an ugly kludge.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/2175
2025-01-30 17:23:39 +01:00
Max Kellermann
5b001957c7 input/async: skip resume and seek if there is a pending error
The resume/seek was received asynchronously and meanwhile an error
might have occurred that needs to be handled.

This fixes another NFS-related crash bug.
2025-01-30 16:47:51 +01:00
Max Kellermann
d1e5c90c3b decoder/flac: do not seek when DecoderCommand::STOP is received
libFLAC tries to keep on seeking a stream even after a (fatal) read
error has occurred.  Let the DecoderClient decide whether proceeding
is possible.

This fixes a crash bug when playing a file over NFS and the NFS
connection fails.
2025-01-30 16:46:04 +01:00
Max Kellermann
715ef846b6 input/Plugin: pass URI as std::string_view 2025-01-30 13:38:30 +01:00
Max Kellermann
aee49d1c1c input/cdio: pass std::string_view to parse_cdio_uri() 2025-01-30 13:17:47 +01:00
Max Kellermann
459390cd56 input/alsa: use std::string_view in class SourceSpec 2025-01-30 13:03:52 +01:00
Max Kellermann
7ca8dedb35 pcm/AudioParser: use std::string_view 2025-01-30 12:27:20 +01:00
Max Kellermann
f6cee35896 fs/Traits: add IsAbsolute(string_view) 2025-01-30 11:55:44 +01:00
gd
66ee03741d Logging: enable log timestamp to stdout logging
When running with stdout output to debug the server
or misbehaving clients, it is useful to have the timestamp
to detect timing issues and response times.
Especially when opening and playing online sources that
block the connection thread sometime for a significantly
long time that makes the client-server unresponsive
and cause timeouts in clients.
2025-01-30 11:33:21 +01:00