Commit Graph

10215 Commits

Author SHA1 Message Date
Max Kellermann
a8db9ae304 net/StaticSocketAddress: add method SetPort() 2017-05-17 12:03:45 +02:00
Max Kellermann
e6e9b2041e net/AllocatedSocketAddress: add method SetPort() 2017-05-17 09:36:01 +02:00
Max Kellermann
77c747a8fd net/SocketAddress: add method GetPort() 2017-05-17 09:28:12 +02:00
Max Kellermann
907fb257cd util/StringAPI: add StringToken(), StringIsEqualIgnoreCase(), StringCollate() 2017-05-16 23:04:27 +02:00
Max Kellermann
60bd60db03 util/String{Compare,API}: add more "noexcept" 2017-05-16 23:02:36 +02:00
Max Kellermann
0fcc28a108 util/String{Compare,API}: indent with tabs 2017-05-16 23:01:43 +02:00
Max Kellermann
ab8005f03e util/ScopeExit: include cleanup 2017-05-16 22:56:30 +02:00
Max Kellermann
5e8f578e78 util/ConcatString: return the end pointer 2017-05-16 11:56:56 +02:00
Max Kellermann
a4b1633e11 util/ConcatString: use std::copy_n() instead of memcpy() 2017-05-16 11:56:19 +02:00
Max Kellermann
fea211a109 util/Alloc: move template functions to ConcatString.hxx 2017-05-16 11:32:55 +02:00
Max Kellermann
59e4f1ee0f *: remove lots of GCC 4.8 fallback code
We can remove those C++11 and C++14 kludges because we require GCC 4.9
now.
2017-05-16 11:29:15 +02:00
Max Kellermann
86a0a42a8d util/StringView: add "noexcept" 2017-05-16 10:27:14 +02:00
Max Kellermann
662842126d util/SplitString: add "noexcept" 2017-05-16 10:23:50 +02:00
Max Kellermann
66e3801b1e util/MimeType: add "noexcept" 2017-05-16 10:23:38 +02:00
Max Kellermann
a30cf60422 util/FormatString: add "noexcept" 2017-05-16 10:22:52 +02:00
Max Kellermann
c2b8b818c7 util/DivideString: add "noexcept" 2017-05-16 10:22:36 +02:00
Max Kellermann
4284b0e2b8 util/ByteReverse: add "noexcept" 2017-05-16 10:21:59 +02:00
Max Kellermann
9def9b35b9 util/Exception: add "noexcept" 2017-05-16 10:20:17 +02:00
Max Kellermann
377a2860cc Log: add "noexcept" 2017-05-16 10:15:43 +02:00
Max Kellermann
0a3a5a7c65 Merge branch 'v0.20.x' 2017-05-16 10:09:20 +02:00
Max Kellermann
64786ec12a Main: omit "constexpr" on MIN_BUFFER_SIZE with GCC 4.x 2017-05-16 07:20:47 +02:00
Max Kellermann
b3c82f8886 output/{osx,haiku,pulse,sles}: add missing "noexcept"
Fixes build failure on OS X, closes #44.  With the other plugins,
that's not critical, because those use the AudioOutputWrapper, which
hides this problem.
2017-05-16 07:12:30 +02:00
Max Kellermann
c5996c0593 *: add "noexcept" to many, many function prototypes
See commit 71f0ed8b74
2017-05-15 23:05:45 +02:00
Max Kellermann
cde5a07981 *: remove "pure" and "const" attributes from throwing functions
See commit 788e3b31e1 for an explanation.
2017-05-15 23:02:10 +02:00
Max Kellermann
4faef28cc5 release v0.20.7
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAlkaFL0QHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEr4ID/9iAQC+7fFv06uLOm48Ufu+PgoD8uJkAwF5
 QuLQkc85g9urn+bu9N7Qs7Vypp7aLyGcJKY0jyA8wxkOj24pUC3GYk80daUt561V
 5s20FnoS/Uoman3CSJL94IfCUBxejizE6vgIIHTc5bb6U0qIsPub/8JTTE2Ih7uP
 nvFZ5uBQ+YTc7at+iIH9123eUMKkitkh8osNblovqQT9v42++Tm4ztAytRHBjwUA
 Itew5HhlvahbLKqFs/7vmICh/YX1FcOV7cV+erEWYfkH0KCI2bhSle4u2d0CBOvD
 VJlDnBCo9bM7WKcPYqJiFFFXA0CRk06wbkkkAtwF4zjp8xos7aQcq4FyQnYL8KXo
 5lijIhRwBURBd+nt8oA9kuEhBt/T75otcemJkzVaYappHTJCLjhxSGcPt8mw+nE9
 9WQzsp/MIVzg9l5g3D9S/43xM7uhvn98Tn1Qf2s8YRd2o8CZeOhW+X3RvbCvVPv2
 mOlx4sFAv8DOJ3KxMdqiJT+PmylPyJluQdqH+tMc8BdPg/kpSpYIPTuSjjRqK1yh
 ld5do0HtAAwiHtvXfk5YVFjJSpO0c8yVn6xci2Cl4k/5ZHj2UE1ln+N5vCea2BRF
 2J3HAjROwtcwY3lU1jFnEAogf24KWiFJqhhC0EqBGUdlrM8Dn37P5cEWWjROIMNK
 lPEdovokNw==
 =CdDy
 -----END PGP SIGNATURE-----

Merge tag 'v0.20.7'

release v0.20.7
2017-05-15 23:01:49 +02:00
Max Kellermann
fa2b59df4b Main: cap buffer_before_play at 80% to prevent deadlock
Closes #34
2017-05-15 22:49:31 +02:00
Max Kellermann
f41a169460 Main: enforce a reasonable minimum audio_buffer_size setting 2017-05-15 22:44:18 +02:00
Max Kellermann
f567083006 Main: refactor DEFAULT_BUFFER_SIZE to represent bytes 2017-05-15 22:40:23 +02:00
Max Kellermann
788e3b31e1 *: remove "pure" and "const" attributes from throwing functions
The "pure" and "const" attributes are not so well-defined, and a
recent clang version implements an optimization which pushes the
definition's boundary beyond what I believed it was.  clang now
assumes that functions declared "pure" cannot throw exceptions, even
if they lack the "noexcept" specification.

When compiled with this new clang version, MPD will crash randomly if
an exception happens to get thrown by such as "pure" function
(https://github.com/MusicPlayerDaemon/MPD/issues/41).

This commit removes all such misplaced "pure" and "const" attributes,
closing #41.
2017-05-08 17:25:06 +02:00
Max Kellermann
71f0ed8b74 *: add "noexcept" to many, many function prototypes
This eliminates some overhead, because the compiler doesn't need to
consider these functions throwing.
2017-05-08 14:44:49 +02:00
Max Kellermann
89b900432e output/Internal: move thread-specific stuff to AudioOutputControl
The AudioOutput struct (which is exposed to all plugins) should not be
aware that it's being controlled by another thread.
2017-04-28 22:04:30 +02:00
Max Kellermann
8bb9d0960b output/Control: add struct AudioOutputControl
Will move attributes from struct AudioOutput that are specific to the
OutputThread.  The new struct AudioOutputControl is a holder for the
AudioOutput pointer.

This prepares for making the output list more dynamic, to allow moving
outputs to between partitions.
2017-04-28 22:04:24 +02:00
Max Kellermann
59181ac5fb output/Thread: move code to BeginPause(), IteratePause() 2017-04-28 22:01:20 +02:00
Max Kellermann
2a831fa547 output/Output*: drop "Output" prefix from source file name 2017-04-28 21:42:24 +02:00
Max Kellermann
b0ce551523 decoder/pcm: support audio/L24
Closes #31
2017-04-24 20:54:13 +02:00
Max Kellermann
8b0269c264 Merge branch 'v0.20.x' 2017-04-24 20:54:04 +02:00
Max Kellermann
6b60d1e71f decoder/pcm: add missing nullptr check
Fixes a potential crash bug which is actually unreachable, because the
"pcm" plugin is never invoked when there is no (matching) MIME type.
2017-04-24 20:36:55 +02:00
Max Kellermann
d68772d45a util/{Foreign,Static}FifoBuffer: update API documentation 2017-04-24 20:19:14 +02:00
Max Kellermann
52cb425e33 util/StaticFifoBuffer: add method GetCapacity() 2017-04-24 20:18:44 +02:00
Max Kellermann
ed3220f37f util/{Foreign,Static}FifoBuffer: use C++11 initializers 2017-04-24 20:16:18 +02:00
Max Kellermann
f6e428ac22 Merge branch 'v0.20.x' 2017-04-24 11:44:27 +02:00
Max Kellermann
45fbafae94 decoder/pcm: split variable "frame_size" in "in_*" and "out_*" 2017-04-24 11:32:52 +02:00
Max Kellermann
803b73a34b pcm/PcmPack: add pcm_unpack_24be() 2017-04-24 11:32:52 +02:00
Max Kellermann
7b7fb5acd5 decoder/pcm: fix potential assertion failure in FillBuffer()
After a seek failure, the buffer may still be full, and then
FillBuffer() aborts with assertion failure.
2017-04-24 11:20:37 +02:00
Max Kellermann
b1512201ab pcm/PcmPack: remove obsolete code comment 2017-04-22 09:52:10 +02:00
Max Kellermann
424e9cbc43 pcm/PcmPack: simplify unpack_sample() 2017-04-22 09:28:54 +02:00
Max Kellermann
95b62a843a Merge branch 'add-original-year-tag' of git://github.com/tremby/MPD 2017-04-21 18:55:34 +02:00
Bart Nagel
ccb4f44caf Add support for the OriginalDate tag
See https://picard.musicbrainz.org/docs/mappings/

This tag is useful when the user would like all releases of the same
album to be sorted next to each other.
2017-04-21 09:43:26 -07:00
Max Kellermann
c788c76dc9 output/Internal: add method IsBusy() 2017-04-18 23:15:46 +02:00
Max Kellermann
2e4e1c7f48 output/Control: drop "Output" prefix from file name 2017-04-18 22:36:48 +02:00
Bart Nagel
0a7d612f41 Remove some redundant code 2017-04-18 16:10:38 +02:00
Max Kellermann
38da76bbe0 util/ScopeExit: copy enabled tag in move constructor 2017-04-12 13:11:43 +02:00
Max Kellermann
504f5f7bdd storage/FileInfo, db/simple/Directory: use 64 bit for device/inode
An ino_t is usually a 64 bit integer, and some file systems (such as
Linux's kernel NFS client) really uses the upper 32 bit.  This can
lead to false positives in the directory loop detection in
FindAncestorLoop().  Increasing these two attributes (in
StorageFileInfo and Directory) to 64 bit adds little overhead, but
makes the check a lot safer.
2017-04-06 09:58:25 +02:00
Max Kellermann
f85d4d28d1 output/alsa: work around dmix non-blocking snd_pcm_drain() bug
See code comment.  Bug was reported against MPD, but it's really an
alsa-lib bug.

 https://bugs.musicpd.org/view.php?id=4662
2017-03-29 20:36:04 +02:00
Max Kellermann
b4e4bdcda9 lib/alsa/Version: wrapper for snd_asoundlib_version() 2017-03-29 20:33:06 +02:00
Max Kellermann
dae8b78569 output/httpd: copy the Page reference; fixes use-after-free 2017-03-29 20:17:09 +02:00
Max Kellermann
e26d49efb7 release v0.20.6
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAljCzQcQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEnIXD/9ltsmg3VC81NHOmcUehFgUaLyNh8o2iEr9
 tQfdydQxfTXBIGztMoPsPz71da8BIqAgMTCTGAEpTUXIW6ViGkgsoDlR2fAOagG2
 ybHn2q3WsPERJvkGZ4xIo0ti0pLLy7wrFpmShgOKuwb6YqOgSV+rbu/CaQanxVJE
 S599vo6rV/OI4KFSYWJbfafifN/Mqmzfl/D/tB5xaMvhas60XZ6pZTp/xH8OlnML
 8qkgPmN3gJe7DPq6L3rdwKobJuS1X6NLHSp1DyGVRy68B0sd3tMmbOocMeyi1OlE
 1z/n/M+dcSUhdHAh/Pg0wrvH0UpUlJ11blSDiWB9gqr9oOvCZO+OcPCnk0QJrqq+
 qselDNWBLvVPESbxlPO4OUbV6jxPPhVgz18RYl6JaJeUFjXkuiytI/t6jsbVM3+f
 ZC1UgO+TznCuDjjMj35RP9QDkUQpuH6CK4+tyxbH7Fe4KQi02FQdtK8Q/CnESBLl
 alTLYQk7VlwL1oMgezoZfTLDbsihRrEO6Y0cp/pObUrEjQ65706UGUf61PRQGBM9
 DlEPqfuH8TMgksxDIrkt68pWjyCXhhUCA+RsyFJoMp7Xq6Gy2pZUn2yKCmTXLte/
 v5xW9FuiSvKUKlvYbfk/q3u/GTCJELf0eY3y0Eryqp6nOEZHmzz8HOF7Bs2PxM3B
 eU/fEKWxVQ==
 =21bM
 -----END PGP SIGNATURE-----

Merge tag 'v0.20.6'

release v0.20.6
2017-03-10 17:02:32 +01:00
Max Kellermann
ac8dce6599 lib/curl/Request: "ICY 200 OK" is a response boundary header 2017-03-10 16:28:02 +01:00
Max Kellermann
190d525099 lib/curl/Request: move code to IsResponseBoundaryHeader() 2017-03-10 16:24:30 +01:00
Max Kellermann
1b6666fa39 Partition: handle SYNC_WITH_PLAYER before TAG_MODIFIED
The TAG_MODIFIED handler (i.e. playlist::TagModified()) works only if
the modified song is the current song - something that is not updated
until SYNC_WITH_PLAYER is finished.  This fixes tag updates right
after a new song is started.
2017-03-10 16:11:34 +01:00
Max Kellermann
1dd01c99e8 decoder/sidplay: make compatible with libsidplayfp < 1.8
https://bugs.musicpd.org/view.php?id=4665
2017-03-10 13:48:52 +01:00
Thomas Zander
d50b30a498 Add missing include for cstdlib, otherwise free() is undefined 2017-03-07 20:02:36 +01:00
Max Kellermann
42a3a87f13 util/HugeAllocator: paranoid check for sysconf()<0
Just in case.
2017-03-01 21:50:26 +01:00
Ben Boeckel
9dfedbe619 ReusableArray: fix build error on GCC7
GCC7 outputs the following error without this change:

    src/util/ReusableArray.hxx:61:35: error: no matching function for call to ‘swap(size_t&, const size_t&)’
       std::swap(capacity, src.capacity);

which can be resolved by just using an rvalue-reference rather than a
const rvalue-reference.

Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
2017-03-01 19:38:41 +01:00
Max Kellermann
b2f2c9322b db/simple/Mount: workaround for libc++ 2017-03-01 17:31:26 +01:00
Max Kellermann
3be2051808 decoder/Thread: check ENABLE_FFMPEG, not HAVE_FFMPEG
This repairs the damage to commit 74dbaade6f done by commit
b3f5b4932c
2017-03-01 17:06:23 +01:00
Max Kellermann
ff32b0dc9b input/curl: use %lu instead of %llu
Fixes a GCC warning because %llu appears to be unsupported by the
Windows standard library.
2017-03-01 16:44:11 +01:00
Max Kellermann
c1869a11af input/curl: format Range offset as unsigned 2017-03-01 16:44:08 +01:00
Max Kellermann
e22a4fdba4 command/Error: improve libstdc++ 4.9.x detection for std::rethrow_if_nested() workaround 2017-03-01 16:38:22 +01:00
Max Kellermann
29a7b2c5b5 decoder/mpcdec: ignore empty frames
https://bugs.musicpd.org/view.php?id=4656 describes a crash due to
division by zero because frame.samples==0.  This should never happen,
but apparently can happen after seeking.  The best we can do is to
just ignore this frame.
2017-03-01 16:13:21 +01:00
Max Kellermann
e9e853b19a command/Partition: add command "partition" to switch to another partition 2017-02-25 10:26:33 +01:00
Max Kellermann
e48ea5f23a Instance: add method FindPartition() 2017-02-25 10:26:33 +01:00
Max Kellermann
a99bab935a Client: add method SetPartition() 2017-02-25 10:25:16 +01:00
Max Kellermann
3eee35e1f7 Client: convert partition to pointer
Prepare to make it mutable.
2017-02-25 10:23:23 +01:00
Max Kellermann
c7396b0675 Client: add method GetPartition(), make partition private 2017-02-25 10:20:09 +01:00
Max Kellermann
e3ee60e7af command/storage: use Instance::EmitIdle()
These events are relevant for all partitions.
2017-02-25 10:20:07 +01:00
Max Kellermann
05b8ddac4c Client: add method GetInstance() 2017-02-25 10:20:05 +01:00
Max Kellermann
668724de4e Client: replace playlist and player_control with getter methods
Prepare to convert "partition" to a mutable pointer.
2017-02-25 09:24:19 +01:00
Max Kellermann
71ce1a25dd SongPrint: remove Storage::MapToRelativeUTF8() call
This code (added 7 years ago with commit b233c145f) has been obsoleted
by the SongLoader class (added 3 years ago).
2017-02-24 13:56:13 +01:00
Max Kellermann
cd522f524d fs/Traits: allow base to end with a slash in Relative()
Fixes false negatives:

 http://foo/dav/example.ogg mismatches http://foo/dav/

.. because StringAfterPrefix() returns just "example.ogg", without
trailing slash (it existed, but was eaten already by the base
matcher).
2017-02-24 13:50:29 +01:00
Max Kellermann
ca559b1db6 input/curl: use %lu instead of %llu
Fixes a GCC warning because %llu appears to be unsupported by the
Windows standard library.
2017-02-21 12:06:56 +01:00
Max Kellermann
a8e76fb345 input/curl: format Range offset as unsigned 2017-02-21 12:06:03 +01:00
Max Kellermann
1d445d1039 SongPrint: move duplicate code into PrintRange() 2017-02-20 22:00:11 +01:00
Max Kellermann
29d03ab937 release v0.20.5
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAlirVtMQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEgbaD/9tgcgcnbiWGkNDMf0qfqfaiY80wA4HbSBT
 qbKzan/kuiPXL6xcgw8YRYdAjyaIyw//f1q0SL8/LKvVQ4CrlTEQzOQUzrAOe02n
 m35/6YKZVzziMRwuSZY4oQ4WH7SE87gthYIykRt59adznr2QNtQe53SnXd8ukGtf
 l8xlLNuIiEwIo5PZ8ObEZH1dUP1PWtfJlxQfbJ2JhZTOR/qPfrpIzSK4GVY0ZXdz
 EO6BIZyDgPfeZCPBZqiKmw4vcdIHBhG9ZgtOhX3YATV7ZSYqmjrUcjzEsoyQlOaH
 rhe/whl272TQYdj95//BnqI899NVSNRYg6XXGlCB5TXqFscoDCW6JXvVAaTfB0Yg
 vMV7ZYX8auu2i013O51yoj8/ofNmOjqbX9eui+gJx6Xb6Zr9Ttma5woYRh14NXwd
 15KObGCd1LADpiOZ2XQ8Snlu8QlZ+PXr8RpLh9uSwDe7heemMRKqDZEf3AxfP3wO
 GUOK4EHfZ5kZQHlWLA3u59Zopo1ZJjL6EJUTG3Qk+n/Wob/S2F/v5IFIdyaEFTKI
 hrcTEQ/EmXZ9vc5Iw/LnIM49pO3kZXKQ9bSrZoi0kjk2AN6XBMmJNoYv/+huc2U9
 JiCcyM8olCWcSQnPGjoHWxBGLhxNXtR+WYu/tEEq3+D2PFdkfOap3ApP1qdi+JPd
 JFps/sOkgQ==
 =4+OJ
 -----END PGP SIGNATURE-----

Merge tag 'v0.20.5'

release v0.20.5
2017-02-20 21:59:40 +01:00
Max Kellermann
bc1c927952 util/TimeFormat: suppress -Wunused on Windows 2017-02-20 21:44:01 +01:00
François Revol
46aa4d2f91 haiku: fix build
Some missing bits when converted to C++ exceptions...
2017-02-20 11:25:00 +01:00
Max Kellermann
512e81c629 output/httpd: use emplace() instead of push() 2017-02-19 20:48:17 +01:00
Max Kellermann
452666f742 output/httpd: wake up the I/O thread only if pages have been read from encoder 2017-02-19 20:46:20 +01:00
Max Kellermann
72008d951b output/httpd: no mutex lock while reading data from encoder 2017-02-19 20:45:16 +01:00
Max Kellermann
72146e7800 output/httpd: use std::lock_guard 2017-02-19 20:43:45 +01:00
Max Kellermann
f7af1bb8e2 output/httpd: cancel the DeferredMonitor in Close() 2017-02-19 20:41:34 +01:00
Max Kellermann
f88f1fca3f output/httpd: move Close() lock into the I/O thread
Fixes a potential deadlock introduced by commit 945287358b
2017-02-19 20:41:06 +01:00
Max Kellermann
26e4a40cc7 output/httpd/Page: use std::shared_ptr instead of class RefCount 2017-02-19 20:17:57 +01:00
Max Kellermann
8b1931072a output/httpd/Page: no variable size, use AllocatedArray
Using variable-size objects is not worth the trouble here.  Let's drop
this and use existing and simpler code.
2017-02-19 20:13:41 +01:00
Max Kellermann
45e15b6cc6 output/httpd/Page: make all attributes private 2017-02-19 20:13:35 +01:00
Max Kellermann
be7e52c882 output/httpd/Page: remove unused method Concat() 2017-02-19 20:13:19 +01:00
Max Kellermann
4162ce0bc5 output/httpd/Page: use uint8_t instead of unsigned char 2017-02-19 19:49:53 +01:00
Max Kellermann
7e46277016 Merge branch 'v0.20.x' 2017-02-19 19:46:18 +01:00
Max Kellermann
f3b788703e tag/Handler: improve snprintf() return value check 2017-02-19 19:34:13 +01:00
Max Kellermann
4bb83781e8 output/httpd/IcyMetaDataServer: cast length to unsigned
Fixes another buffer overflow: if the stream has a very long title or
URL, resulting in a metadata string of more than 2 kB, icy_string[0]
is a negative value, which gets casted to size_t - ouch!

 https://bugs.musicpd.org/view.php?id=4652
2017-02-19 19:28:52 +01:00
Max Kellermann
a73195b7cc output/httpd/IcyMetaDataServer: pad the string with 15 spaces
Fixes a buffer overflow due to the bad formula rounding the buffer
size up.  At the same time, remove the "+1" from the meta_length
calculation, which takes the padding into account and at the same time
implements proper rounding.
2017-02-19 19:27:37 +01:00
Max Kellermann
1bd00b8a9a output/httpd/IcyMetaDataServer: remove the int cast
Why did this cast exist??
2017-02-19 19:27:37 +01:00
Max Kellermann
3b84b99804 IdleFlags: add a "partition" event 2017-02-17 23:59:06 +01:00
Max Kellermann
1786f9b1bb command/Partition: add command "newpartition" 2017-02-17 23:53:49 +01:00
Max Kellermann
1e972174a6 output/MultipleOutputs: add method AddNullOutput() 2017-02-17 23:53:49 +01:00
Max Kellermann
77178e0590 Instance: make "partition" a std::list
With this commit, multi-player support becomes possible... it's just
not wired to the frontend yet.

This is based on massive amounts of refactoring work I did over the
past 9 years.
2017-02-17 23:22:29 +01:00
Max Kellermann
9a909d9f27 Instance: un-inline the constructor 2017-02-17 23:22:05 +01:00
Max Kellermann
90d25a40a0 Instance: use C++11 initializer 2017-02-17 23:21:55 +01:00
Max Kellermann
c335f18be7 Partition: add "name" attribute 2017-02-17 23:18:51 +01:00
Max Kellermann
7dc3e73782 command: add command "listpartitions"
The first step to multi-player support.  Not much, just a dummy
command.
2017-02-17 23:07:31 +01:00
Max Kellermann
47dffe66aa output/alsa: fix race condition on early snd_pcm_writei() error
During UnlockActivate() while the mutex is unlocked, the IOThread can
set a new error condition, and will never again wake up the
OutputThread.  This race condition can cause a deadlock in the
OutputThread.
2017-02-15 11:23:44 +01:00
Max Kellermann
6636c69a11 storage/FileInfo: convert mtime to std::chrono::system_clock::time_point 2017-02-11 23:45:15 +01:00
Max Kellermann
0ccaf4a1ff storage/FileInfo: add initializing constructor 2017-02-11 23:45:14 +01:00
Max Kellermann
5cdbad7937 db/simple/Directory: make parent and path const 2017-02-11 23:45:14 +01:00
Max Kellermann
fc0508c047 db/simple/Directory: use C++11 initializers 2017-02-11 23:45:14 +01:00
Max Kellermann
78ca5491e6 db/Interface: GetUpdateStamp() returns std::chrono::system_clock::time_point 2017-02-11 23:02:17 +01:00
Max Kellermann
4146475c73 util/ChronoUtil: new utility library for std::chrono 2017-02-11 22:23:33 +01:00
Max Kellermann
329c3ab21b fs/FileInfo: use std::chrono::system_clock 2017-02-10 23:48:21 +01:00
Max Kellermann
3b7f6641d2 TimePrint: std::chrono::system_clock support 2017-02-10 23:48:21 +01:00
Max Kellermann
781487c4dd thread/Thread: use BoundMethod 2017-02-10 22:46:09 +01:00
Max Kellermann
5ba5bc8ba1 thread/Thread: move code to Run() 2017-02-10 22:43:55 +01:00
Max Kellermann
82c66ce078 thread/Thread: Start() returns void
Since we switched to C++ exceptions, there is no code path which
returns false.
2017-02-10 22:41:29 +01:00
Max Kellermann
9324fbf921 event/Thread: remove the Mutex
We don't need to access Thread::handle early inside the EventThread,
so we don't need this trick anymore.
2017-02-10 22:29:31 +01:00
Max Kellermann
5e081de14a IOThread: move EventThread instance into struct Instance
Eliminate global variables.
2017-02-10 22:25:06 +01:00
Max Kellermann
115af4f565 event/Loop: Break() is no-op if "quit" is already set 2017-02-10 22:24:48 +01:00
Max Kellermann
822724d1aa event/Thread: auto-stop in the destructor 2017-02-10 22:24:46 +01:00
Max Kellermann
87c9856b20 input/alsa: use the EventLoop& passed to init() instead of io_thread_get() 2017-02-10 22:24:44 +01:00
Max Kellermann
835136dcd3 output/Thread: add assertion on the ao_plugin_play() result 2017-02-10 22:24:36 +01:00
Max Kellermann
4a80e9cb25 output/alsa: copy the PcmExport result to the ring_buffer
.. and not the input data.

Regression from commit b1c7649edb (integer underflow).

 https://bugs.musicpd.org/view.php?id=4639
2017-02-10 22:23:00 +01:00
Max Kellermann
de80c270bd IOThread: move code to class EventThread 2017-02-10 21:40:39 +01:00
Max Kellermann
b92bff2658 IOThread: remove unused function io_thread_inside() 2017-02-10 21:40:30 +01:00
Max Kellermann
42f1e26540 IOThread: remove unused Cond variable 2017-02-10 21:29:54 +01:00
Max Kellermann
cfd056231b output/alsa: use the EventLoop& parameter instead of io_thread_get() 2017-02-10 21:21:15 +01:00
Max Kellermann
20ae84bff9 {input,mixer}/alsa: cancel the DeferredMonitor in the destructor
Yet another potential crash bug fix.
2017-02-10 15:05:49 +01:00
Max Kellermann
b1c7649edb output/alsa: non-blocking mode
Use SND_PCM_NONBLOCK, and perform all snd_pcm_writei() calls in the
IOThread.  Use a lockless queue to copy data from the OutputThread to
the IOThread.

This rather major change aims to improve MPD's internal latency.  All
waits are now under MPD's control, instead of blocking inside
libasound2.

As a side effect, an output's filter is now decoupled from the actual
device I/O, which solves a major latency problem with the conversion
filter on slow CPUs and small period buffers.  See:

 https://bugs.musicpd.org/view.php?id=3900
2017-02-09 21:36:18 +01:00
Max Kellermann
853740f1e2 Main: use the IOThread for outputs and mixers
The main EventLoop can block for a long time while a client's command
runs, and is therefore inappropriate for internal engine I/O.  This
fixes a serious regression for at least the "httpd" output, which used
to be hard-coded for the IOThread, but now receives the main EventLoop
as an initialization parameter.

For the mixers, this doesn't make much of a difference.  They are not
latency critical.
2017-02-09 21:33:49 +01:00
Max Kellermann
14986b153a event/Loop: use std::lock_guard 2017-02-09 21:26:55 +01:00
Max Kellermann
9e503b21c1 {input,mixer}/alsa: move code to lib/alsa/NonBlock.cxx 2017-02-09 21:24:24 +01:00
Max Kellermann
67a958a326 Merge branch 'v0.20.x' 2017-02-09 21:24:20 +01:00
Max Kellermann
7372c931b3 event/Loop: make IsInsideOrNull() available in the NDEBUG build
Fixes build breakage by commit 4e5271fcdf7; and this method does make
sense in non-debug builds.
2017-02-09 21:21:49 +01:00
Max Kellermann
29e1b6e465 mixer/alsa: reset the MultiSocketMonitor in the destructor
Fixes potential crash bug.
2017-02-09 21:13:19 +01:00
Max Kellermann
eda06993f8 event/MultiSocketMonitor: add method Reset() 2017-02-09 21:12:23 +01:00
Max Kellermann
4b30ef1cf2 event/MultiSocketMonitor: use C++11 initializer 2017-02-09 21:12:23 +01:00
Max Kellermann
e92e5e8eb8 event/MultiSocketMonitor: more API documentation
Now ClearSocketList() may only be called from PrepareSockets().
Calling it before destroying the object doesn't work properly, because
it doesn't unregister the TimeoutMonitor and the IdleMonitor.  Some of
its callers need to be fixed.
2017-02-09 21:12:23 +01:00
Max Kellermann
4e5271fcdf event/Call: allow usage during shutdown
Change EventLoop::IsInside() call to EventLoop::IsInsideOrNull().
This means that BlockingCall() may be used during shutdown, after the
main EventLoop::Run() has finished.  This is important because mixers
are currently registered in the main EventLoop.
2017-02-09 21:12:23 +01:00
Max Kellermann
76a1cae5d8 {input,mixer}/alsa: fix off-by-one bug in count check
Doesn't make a practical difference - but it's more correct this way.
2017-02-09 12:46:49 +01:00
Max Kellermann
3850716522 command/Database: add "sort" parameter to "find" and "search"
Implement the second part of https://bugs.musicpd.org/view.php?id=3990
2017-02-08 11:22:08 +01:00
Max Kellermann
e9c99e0518 DetachedSong: add LightSong cast operator 2017-02-08 10:38:25 +01:00
Max Kellermann
332baa4f67 DetachedSong: don't declare empty destructor
An explicit destructor prevents usage of implicit move operators, even
if it's empty.  Therefore, declaring a defaulted destructor with GCC
attribute "noinline" does what we want without preventing those
implicit operators.
2017-02-08 10:24:45 +01:00
Max Kellermann
08879d2a20 DetachedSong: add move operator 2017-02-08 10:24:40 +01:00
Max Kellermann
1292af4768 Revert "DetachedSong: remove explicitly-defaulted copy/move constructors"
This reverts commit 67b7d46432.

Turns out I was wrong, and mentioning these does make a difference:
the implicit move constructor is not defined in the presence of a
user-declared destructor.
2017-02-08 10:21:35 +01:00
Max Kellermann
4d88a099f9 Compiler.h: add gcc_noinline 2017-02-08 10:17:21 +01:00
Max Kellermann
777e15bd78 db/DatabaseSong: make the Storage optional
Some database plugins don't use a Storage (e.g. UPnP), and with this
plugin, DatabaseDetachSong() can crash.
2017-02-08 10:05:55 +01:00
Max Kellermann
f689e28958 SongLoader: return instance, not pointer 2017-02-08 10:02:08 +01:00
Max Kellermann
d184231169 db/DatabaseSong: DatabaseDetachSong(uri) returns instance, not pointer 2017-02-08 09:59:12 +01:00
Max Kellermann
7225e919fc db/DatabaseSong: use AtScopeExit() 2017-02-08 09:58:40 +01:00
Max Kellermann
7a185f1ead queue/PlaylistUpdate: assert Database::GetSong()!=nullptr 2017-02-08 09:53:14 +01:00
Max Kellermann
c1fa5279f4 db/Interface: clarify GetSong() error handling 2017-02-08 09:50:30 +01:00
Max Kellermann
4f0fe66f69 DetachedSong: make the LightSong constructor public
Sometimes, it's useful to construct a DetachedSong from a LightSong
even without having real_uri initialized.
2017-02-08 09:45:37 +01:00
Max Kellermann
76380b2b45 DetachedSong: pass std::string&& to uri initializer
Eliminate one temporary allocation.
2017-02-08 09:42:09 +01:00
Max Kellermann
67b7d46432 DetachedSong: remove explicitly-defaulted copy/move constructors
Mentioning these doesn't make a difference.
2017-02-08 09:40:29 +01:00
Max Kellermann
29453ba196 client: add tag_mask attribute
The "tagtypes" command now has several sub commands which can be used
to edit that mask.
2017-02-08 09:06:11 +01:00
Max Kellermann
599d77643b client/Response: add method GetClient() 2017-02-08 09:06:11 +01:00
Max Kellermann
09d87d5ef1 command/Other: move some functions to ClientCommands.cxx
handle_tagtypes() is also being moved to ClientCommands.cxx, because
that command will be extended to access client-specific settings.
2017-02-08 09:06:11 +01:00
Max Kellermann
2f3f075e4f tag/Mask: wrap in class 2017-02-08 09:04:45 +01:00
Max Kellermann
17097d96b7 db/{Count,Print}: use tag_print(), eliminate duplicate code 2017-02-08 09:04:41 +01:00
Max Kellermann
a3e28c2d1a tag/Tag: move tag_name_parse() to ParseName.cxx 2017-02-08 08:57:22 +01:00
Max Kellermann
03a97d87ea tag/Tag*: rename several source files 2017-02-08 08:49:42 +01:00
Max Kellermann
8cbf099054 tag/Id3Load: update API documentation 2017-02-08 08:48:44 +01:00
Max Kellermann
07ce915c66 Merge branch 'v0.20.x' 2017-02-08 08:45:24 +01:00
Max Kellermann
53c14d97a6 lib/nfs/FileReader: remove debug line 2017-02-08 08:43:56 +01:00
Max Kellermann
69a82eec17 tag/TagId3: use AtScopeExit() for exception-safety 2017-02-06 23:32:07 +01:00
Max Kellermann
45cadef22f configure.ac: prepare for 0.20.5 2017-02-06 23:28:36 +01:00
Max Kellermann
73f58c57e8 storage/curl: use CURLOPT_POSTFIELDS instead of CURLOPT_READFUNCTION 2017-02-06 23:25:03 +01:00
Max Kellermann
43348a3e13 decoder/Control: improve locking in Start() and Seek()
Previously, both methods accessed a lot of attributes which require
mutex protection.
2017-02-05 13:37:20 +01:00
Max Kellermann
e716b1f4d7 Client: remove redundant "virtual" keywords 2017-02-03 22:27:11 +01:00
Max Kellermann
82e74a4ebd Client: make client_vprintf() static 2017-02-03 20:47:41 +01:00
Max Kellermann
16b260e371 Client: eliminate client_puts(), use Client::Write() instead 2017-02-03 20:46:53 +01:00
Max Kellermann
3102e05da4 Client: make attributes "uid" and "num" const 2017-02-03 20:41:31 +01:00
Max Kellermann
df4af2b550 release v0.20.4
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAliSTDkQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEsIQD/4iNkylzLp8mID2aFT690MFzv4TRXi2XS7v
 r3Rlx3hpGyDdzeXZeFc5zxsc9Ei8OfLcdFC/Umj9LjQanXakOxwsdhagrW9cadNX
 YLxkyVcREXalmzUvoWeRnya1LjoTdYA8llvG2tAJosXVr0o/GHZi56aHcrYnW2a6
 XD8kEk5k9beuEcBLk1rdZCTGPbVLwCFvMcpZ7j5Hd4kDGQjjw2aoEaPWchJdhLQh
 p+GRSU+A8hyTo9zy+aNO3cKvq6zqVxDLlHnIqh8XPWQoLPyWuD7ETvwERKmdmiPZ
 bSo0MR7azTlhkWbNZxjPHgZuacJDlwKvXPg1ofjn8VVcaVe5ONeX+1WP0ozUYqyU
 fmhLxMHKuwZcKo6do/jNhAVp//VBWhSwJHPA8kjBTuZHHc0HvgyTxlAgvzlrSswe
 dxc8vnvzgJfUKz5k7mf3amVg6Cu1CmNi59CkyL0NL+8N0inyMfdeQuQEYgbPoI6X
 jIRwACfXpMX75VtiDaNpnFLBjL5emE6u2bDoU2c5ezgpthaWjb0PqSmoLBBF8TNm
 k0ecXlIwCjT3pDcqmFdqgG3AJiYLTgX0rETC8PInl6toLzr2oVMVlijU3YK5PjMl
 nTvgs8TwprTWImgcBnidqRMb39p3AKs12pHfZ4Y5Iu82Bm60acZQMkv6sQh43Wyc
 +W2+T3D2IA==
 =b2Fz
 -----END PGP SIGNATURE-----

Merge tag 'v0.20.4'

release v0.20.4
2017-02-01 22:05:33 +01:00
Max Kellermann
591afa0647 lib/nfs/Connection: detect socket hangup and unregister from epoll
Fixes race condition when epoll_ctl() gets called after the socket has
been closed, which may affect a different socket created by another
thread meanwhile.
2017-02-01 21:44:20 +01:00
Max Kellermann
05eac20ffe lib/nfs/Connection: detect libnfs reconnect
When rpc_reconnect_requeue() gets called from inside nfs_service(),
the NfsInputStream can stall completely because the old socket has
been unregistered from epoll automatically, but the new one has never
been registered.  Therefore, nfs_service() will never be called again.

This kludge attempts to detect this condition by checking
nfs_which_events()==POLLOUT.

https://bugs.musicpd.org/view.php?id=4081
2017-02-01 21:36:58 +01:00
Max Kellermann
38d263ac19 output/sndio: work around a libroar C++ incompatibility
Same as in commit e02d8ad8d2, but this time for the sndio plugin
which can be emulated by libroar.
2017-02-01 19:53:23 +01:00
Thomas Zander
f71c204eef Correct method types to match Interface.hxx 2017-01-31 21:22:02 +01:00
Thomas Zander
51147203be free() require cstdlib to be included 2017-01-31 21:21:37 +01:00
Max Kellermann
a931686317 pcm/SampleFormat: workaround for GCC 4.9 "constexpr" bug
GCC 4.9 has incomplete C++14 support.  Specifically, it doesn't allow
switch/case in "constexpr" functions.
2017-01-27 11:02:58 +01:00
Max Kellermann
add953fb6e lib/curl/Global: decouple from the IOThread library 2017-01-26 09:29:49 +01:00
Max Kellermann
3854211694 input/Plugin: pass EventLoop& to init()
Eliminate dependency on io_thread_get().
2017-01-26 09:26:25 +01:00
Max Kellermann
58ac72f79d input/nfs: use NfsFileReader::GetEventLoop() 2017-01-26 09:25:56 +01:00
Max Kellermann
6d5904801e lib/nfs/FileReader: use nfs_get_event_loop()
Make sure we're using the same EventLoop as the NfsManager.
2017-01-26 09:23:49 +01:00
Max Kellermann
d4993c405e lib/nfs/Glue: add EventLoop& accessor 2017-01-26 09:23:25 +01:00
Max Kellermann
7af8e3937f lib/nfs/FileReader: use C++11 initializers 2017-01-26 09:21:57 +01:00
Max Kellermann
f8eeded528 input/async: pass EventLoop& to constructor 2017-01-25 23:18:33 +01:00
Max Kellermann
c3fa7e13cf input/Plugin: include cleanup 2017-01-25 23:18:17 +01:00
Max Kellermann
5c18b0a94d input/curl: use CurlGlobal::GetEventLoop() 2017-01-25 23:16:56 +01:00
Max Kellermann
ecbad638f1 input/async: add method GetEventLoop() 2017-01-25 23:15:52 +01:00
Max Kellermann
611ce6e756 lib/nfs/{FileReader,Glue}: pass EventLoop&
Eliminate dependency on io_thread_get().
2017-01-25 23:02:02 +01:00
Max Kellermann
4140e9b857 IOThread: make io_thread_run() static 2017-01-25 23:00:31 +01:00
Max Kellermann
8fd9d91974 output/Plugin: pass EventLoop& to init()
Eliminate dependency on io_thread_get().
2017-01-25 22:54:41 +01:00
Max Kellermann
d3f35dab1e output/ao: convert to class, make attributes private 2017-01-25 10:46:09 +01:00