Skip to content

Commit 4faef28

Browse files
committed
Merge tag 'v0.20.7'
release v0.20.7
2 parents 89b9004 + b4c9d9c commit 4faef28

File tree

289 files changed

+914
-924
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

289 files changed

+914
-924
lines changed

NEWS

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ ver 0.21 (not yet released)
99
* output
1010
- alsa: non-blocking mode
1111

12-
ver 0.20.7 (not yet released)
12+
ver 0.20.7 (2017/05/15)
1313
* database
1414
- simple: fix false positive directory loop detection with NFS
15+
* enforce a reasonable minimum audio_buffer_size setting
16+
* cap buffer_before_play at 80% to prevent deadlock
17+
* fix random crashes when compiled with clang
1518

1619
ver 0.20.6 (2017/03/10)
1720
* input

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ For basic installation instructions
1515
- [Manual](http://www.musicpd.org/doc/user/)
1616
- [Forum](http://forum.musicpd.org/)
1717
- [IRC](irc://chat.freenode.net/#mpd)
18-
- [Bug tracker](http://bugs.musicpd.org/)
18+
- [Bug tracker](https://github.com/MusicPlayerDaemon/MPD/issues/)
1919

2020
# Developers
2121

doc/developer.xml

+4-14
Original file line numberDiff line numberDiff line change
@@ -97,20 +97,20 @@ Foo(const char *abc, int xyz)
9797

9898
<para>
9999
MPD sources are managed in a git repository on <ulink
100-
url="http://git.musicpd.org/">git.musicpd.org</ulink>.
100+
url="https://github.com/MusicPlayerDaemon/">GitHub</ulink>.
101101
</para>
102102

103103
<para>
104104
Always write your code against the latest git:
105105
</para>
106106

107-
<programlisting>git clone git://git.musicpd.org/master/mpd.git</programlisting>
107+
<programlisting>git clone git://github.com/MusicPlayerDaemon/MPD</programlisting>
108108

109109
<para>
110110
If you already have a clone, update it:
111111
</para>
112112

113-
<programlisting>git pull --rebase git://git.musicpd.org/master/mpd.git master</programlisting>
113+
<programlisting>git pull --rebase git://github.com/MusicPlayerDaemon/MPD master</programlisting>
114114

115115
<para>
116116
You can do without "--rebase", but we recommend that you rebase
@@ -188,17 +188,7 @@ Foo(const char *abc, int xyz)
188188
</para>
189189

190190
<para>
191-
<command>git pull</command> requests are preferred. Regular
192-
contributors can get <ulink
193-
url="http://git.musicpd.org/account-policy.html">an account on
194-
git.musicpd.org</ulink>, but any public git repository will do.
195-
</para>
196-
197-
<para>
198-
There is <ulink url="https://github.com/MaxKellermann/MPD">a
199-
mirror of the <application>MPD</application> git repository on
200-
GitHub</ulink>, and you can use that as well to submit pull
201-
requests.
191+
<command>git pull</command> requests are preferred.
202192
</para>
203193
</chapter>
204194

doc/mpd.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ mpd.conf(5), mpc(1)
4848
.SH BUGS
4949
If you find a bug, please report it at
5050
.br
51-
<\fBhttp://bugs.musicpd.org/bug_report_page.php\fP>.
51+
<\fBhttps://github.com/MusicPlayerDaemon/MPD/issues/\fP>.
5252
.SH AUTHORS
5353
Max Kellermann <max.kellermann@gmail.com>
5454

doc/user.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1857,7 +1857,7 @@ buffer_size: 16384</programlisting>
18571857
<para>
18581858
If you believe you found a bug in
18591859
<application>MPD</application>, report it on <ulink
1860-
url="https://bugs.musicpd.org/my_view_page.php">the bug
1860+
url="https://github.com/MusicPlayerDaemon/MPD/issues/">the bug
18611861
tracker</ulink>.
18621862
</para>
18631863

src/AudioFormat.cxx

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include <stdio.h>
2525

2626
void
27-
AudioFormat::ApplyMask(AudioFormat mask)
27+
AudioFormat::ApplyMask(AudioFormat mask) noexcept
2828
{
2929
assert(IsValid());
3030
assert(mask.IsMaskValid());
@@ -42,7 +42,7 @@ AudioFormat::ApplyMask(AudioFormat mask)
4242
}
4343

4444
StringBuffer<24>
45-
ToString(const AudioFormat af)
45+
ToString(const AudioFormat af) noexcept
4646
{
4747
StringBuffer<24> buffer;
4848

src/AudioFormat.hxx

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ struct AudioFormat {
124124
return !(*this == other);
125125
}
126126

127-
void ApplyMask(AudioFormat mask);
127+
void ApplyMask(AudioFormat mask) noexcept;
128128

129129
gcc_pure
130130
AudioFormat WithMask(AudioFormat mask) const {
@@ -223,6 +223,6 @@ AudioFormat::GetTimeToSize() const
223223
*/
224224
gcc_const
225225
StringBuffer<24>
226-
ToString(AudioFormat af);
226+
ToString(AudioFormat af) noexcept;
227227

228228
#endif

src/AudioParser.hxx

-3
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
#ifndef MPD_AUDIO_PARSER_HXX
2626
#define MPD_AUDIO_PARSER_HXX
2727

28-
#include "Compiler.h"
29-
3028
struct AudioFormat;
3129

3230
/**
@@ -38,7 +36,6 @@ struct AudioFormat;
3836
* @param src the input string
3937
* @param mask if true, then "*" is allowed for any number of items
4038
*/
41-
gcc_pure
4239
AudioFormat
4340
ParseAudioFormat(const char *src, bool mask);
4441

src/DetachedSong.cxx

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,19 @@ DetachedSong::operator LightSong() const
4545
}
4646

4747
bool
48-
DetachedSong::IsRemote() const
48+
DetachedSong::IsRemote() const noexcept
4949
{
5050
return uri_has_scheme(GetRealURI());
5151
}
5252

5353
bool
54-
DetachedSong::IsAbsoluteFile() const
54+
DetachedSong::IsAbsoluteFile() const noexcept
5555
{
5656
return PathTraitsUTF8::IsAbsolute(GetRealURI());
5757
}
5858

5959
bool
60-
DetachedSong::IsInDatabase() const
60+
DetachedSong::IsInDatabase() const noexcept
6161
{
6262
/* here, we use GetURI() and not GetRealURI() because
6363
GetRealURI() is never relative */
@@ -67,7 +67,7 @@ DetachedSong::IsInDatabase() const
6767
}
6868

6969
SignedSongTime
70-
DetachedSong::GetDuration() const
70+
DetachedSong::GetDuration() const noexcept
7171
{
7272
SongTime a = start_time, b = end_time;
7373
if (!b.IsPositive()) {

src/DetachedSong.hxx

+9-9
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public:
111111
explicit operator LightSong() const;
112112

113113
gcc_pure
114-
const char *GetURI() const {
114+
const char *GetURI() const noexcept {
115115
return uri.c_str();
116116
}
117117

@@ -125,7 +125,7 @@ public:
125125
* displayed URI?
126126
*/
127127
gcc_pure
128-
bool HasRealURI() const {
128+
bool HasRealURI() const noexcept {
129129
return !real_uri.empty();
130130
}
131131

@@ -134,7 +134,7 @@ public:
134134
* GetURI().
135135
*/
136136
gcc_pure
137-
const char *GetRealURI() const {
137+
const char *GetRealURI() const noexcept {
138138
return (HasRealURI() ? real_uri : uri).c_str();
139139
}
140140

@@ -148,30 +148,30 @@ public:
148148
* song.
149149
*/
150150
gcc_pure
151-
bool IsSame(const DetachedSong &other) const {
151+
bool IsSame(const DetachedSong &other) const noexcept {
152152
return uri == other.uri &&
153153
start_time == other.start_time &&
154154
end_time == other.end_time;
155155
}
156156

157157
gcc_pure gcc_nonnull_all
158-
bool IsURI(const char *other_uri) const {
158+
bool IsURI(const char *other_uri) const noexcept {
159159
return uri == other_uri;
160160
}
161161

162162
gcc_pure
163-
bool IsRemote() const;
163+
bool IsRemote() const noexcept;
164164

165165
gcc_pure
166166
bool IsFile() const {
167167
return !IsRemote();
168168
}
169169

170170
gcc_pure
171-
bool IsAbsoluteFile() const;
171+
bool IsAbsoluteFile() const noexcept;
172172

173173
gcc_pure
174-
bool IsInDatabase() const;
174+
bool IsInDatabase() const noexcept;
175175

176176
const Tag &GetTag() const {
177177
return tag;
@@ -226,7 +226,7 @@ public:
226226
}
227227

228228
gcc_pure
229-
SignedSongTime GetDuration() const;
229+
SignedSongTime GetDuration() const noexcept;
230230

231231
/**
232232
* Update the #tag and #mtime.

src/IdleFlags.cxx

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ static const char *const idle_names[] = {
4747
};
4848

4949
const char*const*
50-
idle_get_names(void)
50+
idle_get_names() noexcept
5151
{
5252
return idle_names;
5353
}
5454

5555
unsigned
56-
idle_parse_name(const char *name)
56+
idle_parse_name(const char *name) noexcept
5757
{
5858
#if !CLANG_CHECK_VERSION(3,6)
5959
/* disabled on clang due to -Wtautological-pointer-compare */

src/IdleFlags.hxx

+3-2
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,16 @@ static constexpr unsigned IDLE_PARTITION = 0x2000;
7373
/**
7474
* Get idle names
7575
*/
76+
gcc_const
7677
const char*const*
77-
idle_get_names();
78+
idle_get_names() noexcept;
7879

7980
/**
8081
* Parse an idle name and return its mask. Returns 0 if the given
8182
* name is unknown.
8283
*/
8384
gcc_nonnull_all gcc_pure
8485
unsigned
85-
idle_parse_name(const char *name);
86+
idle_parse_name(const char *name) noexcept;
8687

8788
#endif

src/Instance.hxx

-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ struct Instance final
128128
* DatabaseError if this MPD configuration has no database (no
129129
* music_directory was configured).
130130
*/
131-
gcc_pure
132131
const Database &GetDatabaseOrThrow() const;
133132
#endif
134133

src/Main.cxx

+28-5
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,13 @@
116116

117117
#include <limits.h>
118118

119-
static constexpr unsigned DEFAULT_BUFFER_SIZE = 4096;
119+
static constexpr size_t KILOBYTE = 1024;
120+
static constexpr size_t MEGABYTE = 1024 * KILOBYTE;
121+
122+
static constexpr size_t DEFAULT_BUFFER_SIZE = 4 * MEGABYTE;
123+
static constexpr size_t MIN_BUFFER_SIZE = std::max(CHUNK_SIZE * 32,
124+
64 * KILOBYTE);
125+
120126
static constexpr unsigned DEFAULT_BUFFER_BEFORE_PLAY = 10;
121127

122128
#ifdef ANDROID
@@ -129,7 +135,6 @@ struct Config {
129135
ReplayGainConfig replay_gain;
130136
};
131137

132-
gcc_const
133138
static Config
134139
LoadConfig()
135140
{
@@ -306,12 +311,17 @@ initialize_decoder_and_player(const ReplayGainConfig &replay_gain_config)
306311
FormatFatalError("buffer size \"%s\" is not a "
307312
"positive integer, line %i",
308313
param->value.c_str(), param->line);
309-
buffer_size = tmp;
314+
buffer_size = tmp * KILOBYTE;
315+
316+
if (buffer_size < MIN_BUFFER_SIZE) {
317+
FormatWarning(config_domain, "buffer size %lu is too small, using %lu bytes instead",
318+
(unsigned long)buffer_size,
319+
(unsigned long)MIN_BUFFER_SIZE);
320+
buffer_size = MIN_BUFFER_SIZE;
321+
}
310322
} else
311323
buffer_size = DEFAULT_BUFFER_SIZE;
312324

313-
buffer_size *= 1024;
314-
315325
const unsigned buffered_chunks = buffer_size / CHUNK_SIZE;
316326

317327
if (buffered_chunks >= 1 << 15)
@@ -329,6 +339,19 @@ initialize_decoder_and_player(const ReplayGainConfig &replay_gain_config)
329339
"than 100 percent, line %i",
330340
param->value.c_str(), param->line);
331341
}
342+
343+
if (perc > 80) {
344+
/* this upper limit should avoid deadlocks
345+
which can occur because the DecoderThread
346+
cannot ever fill the music buffer to
347+
exactly 100%; a few chunks always need to
348+
be available to generate silence in
349+
Player::SendSilence() */
350+
FormatError(config_domain,
351+
"buffer_before_play is too large (%f%%), capping at 80%%; please fix your configuration",
352+
perc);
353+
perc = 80;
354+
}
332355
} else
333356
perc = DEFAULT_BUFFER_BEFORE_PLAY;
334357

src/Mapper.cxx

+5-5
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ mapper_init(AllocatedPath &&_playlist_dir)
5959
}
6060

6161
void
62-
mapper_finish()
62+
mapper_finish() noexcept
6363
{
6464
}
6565

6666
#ifdef ENABLE_DATABASE
6767

6868
AllocatedPath
69-
map_uri_fs(const char *uri)
69+
map_uri_fs(const char *uri) noexcept
7070
{
7171
assert(uri != nullptr);
7272
assert(*uri != '/');
@@ -86,7 +86,7 @@ map_uri_fs(const char *uri)
8686
}
8787

8888
std::string
89-
map_fs_to_utf8(Path path_fs)
89+
map_fs_to_utf8(Path path_fs) noexcept
9090
{
9191
if (path_fs.IsAbsolute()) {
9292
if (instance->storage == nullptr)
@@ -109,13 +109,13 @@ map_fs_to_utf8(Path path_fs)
109109
#endif
110110

111111
const AllocatedPath &
112-
map_spl_path()
112+
map_spl_path() noexcept
113113
{
114114
return playlist_dir_fs;
115115
}
116116

117117
AllocatedPath
118-
map_spl_utf8_to_fs(const char *name)
118+
map_spl_utf8_to_fs(const char *name) noexcept
119119
{
120120
if (playlist_dir_fs.IsNull())
121121
return AllocatedPath::Null();

0 commit comments

Comments
 (0)