Skip to content

Commit 99659e4

Browse files
committed
Merge tag 'v0.19.21'
release v0.19.21
2 parents dc05dd7 + 3bbcda9 commit 99659e4

File tree

10 files changed

+94
-24
lines changed

10 files changed

+94
-24
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ tags
3535
/mkinstalldirs
3636
/build
3737
/src/mpd
38-
/systemd/mpd.service
38+
/systemd/system/mpd.service
39+
/systemd/user/mpd.service
3940
/stamp-h1
4041

4142
/src/dsd2pcm/dsd2pcm

Makefile.am

+8-3
Original file line numberDiff line numberDiff line change
@@ -1599,8 +1599,13 @@ FILTER_LIBS = \
15991599

16001600
if HAVE_SYSTEMD
16011601
systemdsystemunit_DATA = \
1602-
systemd/mpd.socket \
1603-
systemd/mpd.service
1602+
systemd/system/mpd.socket \
1603+
systemd/system/mpd.service
1604+
endif
1605+
1606+
if HAVE_SYSTEMD_USER
1607+
systemduserunit_DATA = \
1608+
systemd/user/mpd.service
16041609
endif
16051610

16061611

@@ -2356,7 +2361,7 @@ EXTRA_DIST = $(doc_DATA) autogen.sh \
23562361
$(wildcard $(srcdir)/scripts/*.rb) \
23572362
$(man_MANS) $(DOCBOOK_FILES) doc/mpdconf.example doc/doxygen.conf \
23582363
$(wildcard $(srcdir)/doc/include/*.xml) \
2359-
systemd/mpd.socket \
2364+
systemd/system/mpd.socket \
23602365
android/AndroidManifest.xml \
23612366
android/build.py \
23622367
android/custom_rules.xml \

NEWS

+6
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ ver 0.20 (not yet released)
6262
* switch the code base to C++14
6363
- GCC 4.9 or clang 3.4 (or newer) recommended
6464

65+
ver 0.19.21 (2016/12/13)
66+
* decoder
67+
- ffmpeg: fix crash bug
68+
* fix unit test failure after recent "setprio" change
69+
* systemd: add user unit
70+
6571
ver 0.19.20 (2016/12/09)
6672
* protocol
6773
- "setprio" re-enqueues old song if priority has been raised

configure.ac

+18-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,22 @@ if test "x$with_systemdsystemunitdir" != xno; then
5252
fi
5353
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
5454

55+
AC_ARG_WITH([systemduserunitdir],
56+
AS_HELP_STRING([--with-systemduserunitdir=DIR], [Directory for systemd service files]),
57+
[], [with_systemduserunitdir=no])
58+
if test "x$with_systemduserunitdir" = xyes; then
59+
AC_MSG_CHECKING(for systemd)
60+
with_systemduserunitdir=$($PKG_CONFIG --variable=systemduserunitdir systemd)
61+
if test -z "$with_systemduserunitdir"; then
62+
AC_MSG_ERROR([Failed to detect systemd])
63+
fi
64+
AC_MSG_RESULT([$with_systemduserunitdir])
65+
fi
66+
if test "x$with_systemduserunitdir" != xno; then
67+
AC_SUBST([systemduserunitdir], [$with_systemduserunitdir])
68+
fi
69+
AM_CONDITIONAL(HAVE_SYSTEMD_USER, [test -n "$with_systemduserunitdir" -a "x$with_systemduserunitdir" != xno ])
70+
5571
dnl ---------------------------------------------------------------------------
5672
dnl Declare Variables
5773
dnl ---------------------------------------------------------------------------
@@ -1498,7 +1514,8 @@ dnl Generate files
14981514
dnl ---------------------------------------------------------------------------
14991515
AC_CONFIG_FILES(Makefile)
15001516
AC_CONFIG_FILES(doc/doxygen.conf)
1501-
AC_CONFIG_FILES(systemd/mpd.service)
1517+
AC_CONFIG_FILES(systemd/system/mpd.service)
1518+
AC_CONFIG_FILES(systemd/user/mpd.service)
15021519
AC_OUTPUT
15031520

15041521
echo 'MPD is ready for compilation, type "make" to begin.'

doc/user.xml

+28-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ apt-get install g++ \
151151
<application>systemd</application> unit files: a "service"
152152
unit and a "socket" unit. These will only be installed when
153153
<application>MPD</application> was configured with
154-
<parameter>--with-systemdsystemunitdir=/lib/systemd</parameter>.
154+
<parameter>--with-systemdsystemunitdir=/lib/systemd/system</parameter>.
155155
</para>
156156

157157
<para>
@@ -167,6 +167,33 @@ systemctl start mpd.socket</programlisting>
167167
<varname>port</varname> settings.
168168
</para>
169169
</section>
170+
171+
<section id="systemd_user">
172+
<title><filename>systemd</filename> user unit</title>
173+
174+
<para>
175+
You can launch <application>MPD</application> as a
176+
<filename>systemd</filename> user unit. The service file will
177+
only be installed when <application>MPD</application> was
178+
configured with
179+
<parameter>--with-systemduserunitdir=/usr/lib/systemd/user</parameter>
180+
or
181+
<parameter>--with-systemduserunitdir=$HOME/.local/share/systemd/user</parameter>.
182+
</para>
183+
184+
<para>
185+
Once the user unit is installed, you can start and stop
186+
<application>MPD</application> like any other service:
187+
</para>
188+
189+
<programlisting>systemctl --user start mpd</programlisting>
190+
191+
<para>
192+
To auto-start <application>MPD</application> upon login, type:
193+
</para>
194+
195+
<programlisting>systemctl --user enable mpd</programlisting>
196+
</section>
170197
</chapter>
171198

172199
<chapter id="config">

src/decoder/plugins/FfmpegDecoderPlugin.cxx

+1-3
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,8 @@ FfmpegOpenInput(AVIOContext *pb,
6868
context->pb = pb;
6969

7070
int err = avformat_open_input(&context, filename, fmt, nullptr);
71-
if (err < 0) {
72-
avformat_free_context(context);
71+
if (err < 0)
7372
throw MakeFfmpegError(err, "avformat_open_input() failed");
74-
}
7573

7674
return context;
7775
}
File renamed without changes.
File renamed without changes.

systemd/user/mpd.service.in

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[Unit]
2+
Description=Music Player Daemon
3+
Documentation=man:mpd(1) man:mpd.conf(5)
4+
After=network.target sound.target
5+
6+
[Service]
7+
Type=notify
8+
ExecStart=@prefix@/bin/mpd --no-daemon
9+
10+
# allow MPD to use real-time priority 50
11+
LimitRTPRIO=50
12+
LimitRTTIME=infinity
13+
14+
# disallow writing to /usr, /bin, /sbin, ...
15+
ProtectSystem=yes
16+
17+
# more paranoid security settings
18+
NoNewPrivileges=yes
19+
ProtectKernelTunables=yes
20+
ProtectControlGroups=yes
21+
# AF_NETLINK is required by libsmbclient, or it will exit() .. *sigh*
22+
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK
23+
RestrictNamespaces=yes
24+
25+
# Note that "ProtectKernelModules=yes" is missing in the user unit
26+
# because systemd 232 is unable to reduce its own capabilities
27+
# ("Failed at step CAPABILITIES spawning /usr/bin/mpd: Operation not
28+
# permitted")
29+
30+
[Install]
31+
WantedBy=default.target

test/test_queue_priority.cxx

-15
Original file line numberDiff line numberDiff line change
@@ -164,21 +164,6 @@ QueuePriorityTest::TestPriority()
164164

165165
check_descending_priority(&queue, current_order + 1);
166166

167-
/* priority=60 for the old prio50 item; must not be moved,
168-
because it's before the current song, and it's status
169-
hasn't changed (it was already higher before) */
170-
171-
unsigned c_order = 0;
172-
unsigned c_position = queue.OrderToPosition(c_order);
173-
CPPUNIT_ASSERT_EQUAL(50u, unsigned(queue.items[c_position].priority));
174-
queue.SetPriority(c_position, 60, current_order);
175-
176-
current_order = queue.PositionToOrder(current_position);
177-
CPPUNIT_ASSERT_EQUAL(3u, current_order);
178-
179-
c_order = queue.PositionToOrder(c_position);
180-
CPPUNIT_ASSERT_EQUAL(0u, c_order);
181-
182167
/* move the prio=20 item back */
183168

184169
a_order = queue.PositionToOrder(a_position);

0 commit comments

Comments
 (0)