On Tue, 22 Apr 2014, Bryan Linton wrote: > On 2014-04-21 09:55:22, Bryan Linton <[email protected]> wrote: > > On 2014-04-18 15:57:06, David Coppa <[email protected]> wrote: > >> On Tue, 25 Mar 2014, Landry Breuil wrote: > >> > >>> So, after playing flawlessly for 3 hours, it stopped again. Looked at > >>> the mpdstate file, time had a regular value, but mpd didnt save it yet. > >>> pkill -9 mpd to really force-stop it, at that point it saved the mpdstate > >>> with time: -2147483648 > >>> restarted mpd.. mpc still says the currently played track is the one > >>> which was playing before getting stuck. Mpd will only play one track > >>> before > >>> getting stuck. > >>> Kill mpd, set time to 0 in mpdstate, restart mpd. works fine. > >> > >> Maybe this is better... Can you try it? > >> > > > > Been running this for three days now. There was one hiccup that I > > thought was similar to what had been happening previously, but I > > have not been able to duplicate it since restarting mpd. > > > > I'd like to run with it for a bit longer to make certain it's > > still pretty stable, but other than that one hiccup, it's been > > running without any issues so far. > > > > ...And I just had the same bug that was mentioned previously > surface again. > > Whatever changed between 0.18.9 and 0.18.10, it is much less > buggy with 0.18.10 than it was with 0.18.9, but it still has a bug > that didn't exist in 0.17.6 (the current version in ports), so I > would recommend against this update going in for the time being > at least.
So, this should work w/o problems now... "Our" bug has been marked as resolved and closed upstream. Please test! Ciao, David Index: Makefile =================================================================== RCS file: /cvs/ports/audio/mpd/Makefile,v retrieving revision 1.56 diff -u -p -u -p -r1.56 Makefile --- Makefile 5 Nov 2013 07:08:52 -0000 1.56 +++ Makefile 29 Apr 2014 09:40:36 -0000 @@ -1,7 +1,7 @@ # $OpenBSD: Makefile,v 1.56 2013/11/05 07:08:52 dcoppa Exp $ COMMENT = Music Player Daemon -DISTNAME = mpd-0.17.6 +DISTNAME = mpd-0.18.10 CATEGORIES = audio HOMEPAGE = http://www.musicpd.org/ MAINTAINER = David Coppa <[email protected]> @@ -12,11 +12,13 @@ PERMIT_PACKAGE_CDROM = Yes WANTLIB = FLAC ao audiofile c cdio cdio_cdda cdio_paranoia \ curl glib-2.0 gthread-2.0 id3tag m mad \ mikmod ogg pthread samplerate sndfile sndio \ - stdc++ z + bz2 mpdclient opus z -MASTER_SITES = http://www.musicpd.org/download/mpd/0.17/ +MASTER_SITES = http://www.musicpd.org/download/mpd/stable/ -MODULES = devel/gettext +MODULES = devel/gettext gcc4 +MODGCC4_ARCHS = i386 amd64 powerpc sparc64 +MODGCC4_LANGS = c++ LIB_DEPENDS = devel/libaudiofile \ audio/libao \ @@ -26,6 +28,8 @@ LIB_DEPENDS = devel/libaudiofile \ audio/libid3tag \ audio/libmad \ audio/libmikmod \ + audio/opus \ + audio/libmpdclient \ net/curl \ devel/glib2 @@ -36,6 +40,7 @@ CONFIGURE_STYLE = gnu CONFIGURE_ARGS += --bindir=${PREFIX}/sbin \ --disable-alsa \ --disable-ffmpeg \ + --disable-fluidsynth \ --disable-gme \ --disable-inotify \ --disable-jack \ @@ -44,11 +49,11 @@ CONFIGURE_ARGS += --bindir=${PREFIX}/sbi --disable-modplug \ --disable-mpg123 \ --disable-oss \ + --disable-openal \ --disable-pulse \ --disable-roar \ --disable-sidplay \ --disable-soundcloud \ - --disable-soup \ --disable-sqlite \ --disable-systemd-daemon \ --disable-twolame-encoder \ @@ -81,7 +86,7 @@ LIB_DEPENDS += audio/tremor WANTLIB += vorbisidec .else WANTLIB += theora vorbis vorbisfile vorbisenc speex mp3lame \ - shout faad mp4ff mpcdec + shout faad mpcdec LIB_DEPENDS += audio/libvorbis \ audio/speex \ audio/lame \ @@ -92,7 +97,6 @@ CONFIGURE_ARGS += --enable-aac \ --enable-shout \ --enable-vorbis-encoder .endif - post-install: ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/mpd Index: distinfo =================================================================== RCS file: /cvs/ports/audio/mpd/distinfo,v retrieving revision 1.19 diff -u -p -u -p -r1.19 distinfo --- distinfo 5 Nov 2013 07:08:52 -0000 1.19 +++ distinfo 29 Apr 2014 09:40:36 -0000 @@ -1,2 +1,2 @@ -SHA256 (mpd-0.17.6.tar.gz) = GngCYHDXN+eDamGruWPNI9VmQN8aaLqCPpAn23vChMs= -SIZE (mpd-0.17.6.tar.gz) = 763311 +SHA256 (mpd-0.18.10.tar.gz) = ZoTtAYhbngbXPsIvZHPLCxfVmRa1ZrRqvjoc1Pnflsg= +SIZE (mpd-0.18.10.tar.gz) = 804169 Index: patches/patch-Makefile_in =================================================================== RCS file: /cvs/ports/audio/mpd/patches/patch-Makefile_in,v retrieving revision 1.8 diff -u -p -u -p -r1.8 patch-Makefile_in --- patches/patch-Makefile_in 5 Oct 2012 08:29:39 -0000 1.8 +++ patches/patch-Makefile_in 29 Apr 2014 09:40:36 -0000 @@ -1,7 +1,7 @@ $OpenBSD: patch-Makefile_in,v 1.8 2012/10/05 08:29:39 dcoppa Exp $ ---- Makefile.in.orig Sun Sep 30 12:23:42 2012 -+++ Makefile.in Tue Oct 2 14:31:28 2012 -@@ -2433,7 +2433,7 @@ SPARSE_SRC = $(addprefix $(top_srcdir)/,$(filter %.c,$ +--- Makefile.in.orig Tue Feb 18 18:39:35 2014 ++++ Makefile.in Tue Mar 18 22:19:40 2014 +@@ -3209,7 +3209,7 @@ SPARSE_SRC = $(addprefix $(top_srcdir)/,$(filter %.c,$ # Documentation # man_MANS = doc/mpd.1 doc/mpd.conf.5 Index: patches/patch-configure =================================================================== RCS file: /cvs/ports/audio/mpd/patches/patch-configure,v retrieving revision 1.19 diff -u -p -u -p -r1.19 patch-configure --- patches/patch-configure 19 Sep 2013 15:02:16 -0000 1.19 +++ patches/patch-configure 29 Apr 2014 09:40:36 -0000 @@ -2,18 +2,18 @@ $OpenBSD: patch-configure,v 1.19 2013/09 Don't reset CPPFLAGS...stupid configure. ---- configure.orig Sun Aug 4 14:22:05 2013 -+++ configure Thu Sep 19 16:58:31 2013 -@@ -9862,7 +9862,7 @@ if test x$enable_aac = xyes; then +--- configure.orig Thu Mar 6 13:12:27 2014 ++++ configure Fri Apr 18 15:27:27 2014 +@@ -10326,7 +10326,7 @@ if test x$enable_aac = xyes; then oldcppflags=$CPPFLAGS - CFLAGS="$CFLAGS $FAAD_CFLAGS -I." + CFLAGS="$CFLAGS $FAAD_CFLAGS" LIBS="$LIBS $FAAD_LIBS" - CPPFLAGS=$CFLAGS + CPPFLAGS="$CPPFLAGS $CFLAGS" ac_fn_c_check_header_mongrel "$LINENO" "faad.h" "ac_cv_header_faad_h" "$ac_includes_default" if test "x$ac_cv_header_faad_h" = xyes; then : -@@ -10126,7 +10126,7 @@ if test x$enable_aac = xyes; then +@@ -10452,7 +10452,7 @@ if test x$enable_aac = xyes; then oldcppflags=$CPPFLAGS CFLAGS="$CFLAGS $FAAD_CFLAGS -Werror" LIBS="$LIBS $FAAD_LIBS" @@ -22,12 +22,3 @@ Don't reset CPPFLAGS...stupid configure. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken libfaad headers" >&5 $as_echo_n "checking for broken libfaad headers... " >&6; } -@@ -10172,7 +10172,7 @@ if test x$enable_aac = xyes; then - oldcppflags=$CPPFLAGS - CFLAGS="$CFLAGS $FAAD_CFLAGS" - LIBS="$LIBS $FAAD_LIBS $MP4FF_LIBS" -- CPPFLAGS=$CFLAGS -+ CPPFLAGS="$CPPFLAGS $CFLAGS" - - ac_fn_c_check_header_mongrel "$LINENO" "mp4ff.h" "ac_cv_header_mp4ff_h" "$ac_includes_default" - if test "x$ac_cv_header_mp4ff_h" = xyes; then : Index: patches/patch-doc_mpdconf_example =================================================================== RCS file: /cvs/ports/audio/mpd/patches/patch-doc_mpdconf_example,v retrieving revision 1.11 diff -u -p -u -p -r1.11 patch-doc_mpdconf_example --- patches/patch-doc_mpdconf_example 19 Sep 2013 15:02:16 -0000 1.11 +++ patches/patch-doc_mpdconf_example 29 Apr 2014 09:40:36 -0000 @@ -1,6 +1,6 @@ $OpenBSD: patch-doc_mpdconf_example,v 1.11 2013/09/19 15:02:16 dcoppa Exp $ ---- doc/mpdconf.example.orig Thu Aug 1 09:15:41 2013 -+++ doc/mpdconf.example Thu Sep 19 16:58:31 2013 +--- doc/mpdconf.example.orig Wed Dec 11 20:51:53 2013 ++++ doc/mpdconf.example Tue Mar 18 22:19:40 2014 @@ -10,14 +10,14 @@ # be disabled and audio files will only be accepted over ipc socket (using # file:// protocol) or streaming files over an accepted protocol. @@ -69,7 +69,7 @@ $OpenBSD: patch-doc_mpdconf_example,v 1. # This setting is the TCP port that is desired for the daemon to get assigned # to. # -@@ -320,6 +322,14 @@ input { +@@ -324,6 +326,14 @@ input { # name "My Null Output" # mixer_type "none" # optional #} @@ -82,5 +82,5 @@ $OpenBSD: patch-doc_mpdconf_example,v 1. + mixer_type "software" +} # - # This setting will change all decoded audio to be converted to the specified - # format before being passed to the audio outputs. By default, this setting is + # If MPD has been compiled with libsamplerate support, this setting specifies + # the sample rate converter to use. Possible values can be found in the Index: patches/patch-src_event_DeferredMonitor_cxx =================================================================== RCS file: patches/patch-src_event_DeferredMonitor_cxx diff -N patches/patch-src_event_DeferredMonitor_cxx --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_event_DeferredMonitor_cxx 29 Apr 2014 09:40:36 -0000 @@ -0,0 +1,66 @@ +$OpenBSD$ + +commit 0efb67b51e0d9d34c65bbdbd9df567a8a991cc4c +Author: Max Kellermann <[email protected]> +Date: Sat Apr 26 22:11:23 2014 +0200 + +DeferredMonitor: fix race condition when using GLib event loop + +Turns out the lock-free code using atomics was not thread-safe. The +given callback could be invoked by GLib before the source_id attribute +was assigned. This commit changes the DeferredMonitor class to use +a Mutex to block the event loop until source_id is assigned. This +bug does not exist in the 0.19 branch because it does not use the +GLib main loop anymore. + +--- src/event/DeferredMonitor.cxx.orig Wed Dec 11 20:51:53 2013 ++++ src/event/DeferredMonitor.cxx Tue Apr 29 11:32:48 2014 +@@ -27,9 +27,11 @@ DeferredMonitor::Cancel() + #ifdef USE_EPOLL + pending = false; + #else +- const auto id = source_id.exchange(0); +- if (id != 0) +- g_source_remove(id); ++ const ScopeLock protect(mutex); ++ if (source_id != 0) { ++ g_source_remove(source_id); ++ source_id = 0; ++ } + #endif + } + +@@ -40,10 +42,9 @@ DeferredMonitor::Schedule() + if (!pending.exchange(true)) + fd.Write(); + #else +- const unsigned id = loop.AddIdle(Callback, this); +- const auto old_id = source_id.exchange(id); +- if (old_id != 0) +- g_source_remove(old_id); ++ const ScopeLock protect(mutex); ++ if (source_id == 0) ++ source_id = loop.AddIdle(Callback, this); + #endif + } + +@@ -65,9 +66,16 @@ DeferredMonitor::OnSocketReady(unsigned) + void + DeferredMonitor::Run() + { +- const auto id = source_id.exchange(0); +- if (id != 0) +- RunDeferred(); ++ { ++ const ScopeLock protect(mutex); ++ if (source_id == 0) ++ /* cancelled */ ++ return; ++ ++ source_id = 0; ++ } ++ ++ RunDeferred(); + } + + gboolean Index: patches/patch-src_event_DeferredMonitor_hxx =================================================================== RCS file: patches/patch-src_event_DeferredMonitor_hxx diff -N patches/patch-src_event_DeferredMonitor_hxx --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_event_DeferredMonitor_hxx 29 Apr 2014 09:40:36 -0000 @@ -0,0 +1,36 @@ +$OpenBSD$ + +commit 0efb67b51e0d9d34c65bbdbd9df567a8a991cc4c +Author: Max Kellermann <[email protected]> +Date: Sat Apr 26 22:11:23 2014 +0200 + +DeferredMonitor: fix race condition when using GLib event loop + +Turns out the lock-free code using atomics was not thread-safe. The +given callback could be invoked by GLib before the source_id attribute +was assigned. This commit changes the DeferredMonitor class to use +a Mutex to block the event loop until source_id is assigned. This +bug does not exist in the 0.19 branch because it does not use the +GLib main loop anymore. + +--- src/event/DeferredMonitor.hxx.orig Wed Dec 11 20:51:53 2013 ++++ src/event/DeferredMonitor.hxx Tue Apr 29 11:32:48 2014 +@@ -27,6 +27,7 @@ + #include "SocketMonitor.hxx" + #include "WakeFD.hxx" + #else ++#include "thread/Mutex.hxx" + #include <glib.h> + #endif + +@@ -48,7 +49,9 @@ class DeferredMonitor + #else + EventLoop &loop; + +- std::atomic<guint> source_id; ++ Mutex mutex; ++ ++ guint source_id; + #endif + + public: Index: patches/patch-src_system_ByteOrder_hxx =================================================================== RCS file: patches/patch-src_system_ByteOrder_hxx diff -N patches/patch-src_system_ByteOrder_hxx --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_system_ByteOrder_hxx 29 Apr 2014 09:40:36 -0000 @@ -0,0 +1,12 @@ +$OpenBSD$ +--- src/system/ByteOrder.hxx.orig Tue Mar 18 23:12:51 2014 ++++ src/system/ByteOrder.hxx Tue Mar 18 22:57:46 2014 +@@ -42,7 +42,7 @@ + # define IS_BIG_ENDIAN true + #else + /* generic compile-time check */ +-# include <endian.h> ++# include <sys/endian.h> + # if __BYTE_ORDER == __LITTLE_ENDIAN + # define IS_LITTLE_ENDIAN true + # define IS_BIG_ENDIAN false
Index: Makefile =================================================================== RCS file: /cvs/ports/audio/mpd/Makefile,v retrieving revision 1.56 diff -u -p -u -p -r1.56 Makefile --- Makefile 5 Nov 2013 07:08:52 -0000 1.56 +++ Makefile 29 Apr 2014 09:40:36 -0000 @@ -1,7 +1,7 @@ # $OpenBSD: Makefile,v 1.56 2013/11/05 07:08:52 dcoppa Exp $ COMMENT = Music Player Daemon -DISTNAME = mpd-0.17.6 +DISTNAME = mpd-0.18.10 CATEGORIES = audio HOMEPAGE = http://www.musicpd.org/ MAINTAINER = David Coppa <[email protected]> @@ -12,11 +12,13 @@ PERMIT_PACKAGE_CDROM = Yes WANTLIB = FLAC ao audiofile c cdio cdio_cdda cdio_paranoia \ curl glib-2.0 gthread-2.0 id3tag m mad \ mikmod ogg pthread samplerate sndfile sndio \ - stdc++ z + bz2 mpdclient opus z -MASTER_SITES = http://www.musicpd.org/download/mpd/0.17/ +MASTER_SITES = http://www.musicpd.org/download/mpd/stable/ -MODULES = devel/gettext +MODULES = devel/gettext gcc4 +MODGCC4_ARCHS = i386 amd64 powerpc sparc64 +MODGCC4_LANGS = c++ LIB_DEPENDS = devel/libaudiofile \ audio/libao \ @@ -26,6 +28,8 @@ LIB_DEPENDS = devel/libaudiofile \ audio/libid3tag \ audio/libmad \ audio/libmikmod \ + audio/opus \ + audio/libmpdclient \ net/curl \ devel/glib2 @@ -36,6 +40,7 @@ CONFIGURE_STYLE = gnu CONFIGURE_ARGS += --bindir=${PREFIX}/sbin \ --disable-alsa \ --disable-ffmpeg \ + --disable-fluidsynth \ --disable-gme \ --disable-inotify \ --disable-jack \ @@ -44,11 +49,11 @@ CONFIGURE_ARGS += --bindir=${PREFIX}/sbi --disable-modplug \ --disable-mpg123 \ --disable-oss \ + --disable-openal \ --disable-pulse \ --disable-roar \ --disable-sidplay \ --disable-soundcloud \ - --disable-soup \ --disable-sqlite \ --disable-systemd-daemon \ --disable-twolame-encoder \ @@ -81,7 +86,7 @@ LIB_DEPENDS += audio/tremor WANTLIB += vorbisidec .else WANTLIB += theora vorbis vorbisfile vorbisenc speex mp3lame \ - shout faad mp4ff mpcdec + shout faad mpcdec LIB_DEPENDS += audio/libvorbis \ audio/speex \ audio/lame \ @@ -92,7 +97,6 @@ CONFIGURE_ARGS += --enable-aac \ --enable-shout \ --enable-vorbis-encoder .endif - post-install: ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/mpd Index: distinfo =================================================================== RCS file: /cvs/ports/audio/mpd/distinfo,v retrieving revision 1.19 diff -u -p -u -p -r1.19 distinfo --- distinfo 5 Nov 2013 07:08:52 -0000 1.19 +++ distinfo 29 Apr 2014 09:40:36 -0000 @@ -1,2 +1,2 @@ -SHA256 (mpd-0.17.6.tar.gz) = GngCYHDXN+eDamGruWPNI9VmQN8aaLqCPpAn23vChMs= -SIZE (mpd-0.17.6.tar.gz) = 763311 +SHA256 (mpd-0.18.10.tar.gz) = ZoTtAYhbngbXPsIvZHPLCxfVmRa1ZrRqvjoc1Pnflsg= +SIZE (mpd-0.18.10.tar.gz) = 804169 Index: patches/patch-Makefile_in =================================================================== RCS file: /cvs/ports/audio/mpd/patches/patch-Makefile_in,v retrieving revision 1.8 diff -u -p -u -p -r1.8 patch-Makefile_in --- patches/patch-Makefile_in 5 Oct 2012 08:29:39 -0000 1.8 +++ patches/patch-Makefile_in 29 Apr 2014 09:40:36 -0000 @@ -1,7 +1,7 @@ $OpenBSD: patch-Makefile_in,v 1.8 2012/10/05 08:29:39 dcoppa Exp $ ---- Makefile.in.orig Sun Sep 30 12:23:42 2012 -+++ Makefile.in Tue Oct 2 14:31:28 2012 -@@ -2433,7 +2433,7 @@ SPARSE_SRC = $(addprefix $(top_srcdir)/,$(filter %.c,$ +--- Makefile.in.orig Tue Feb 18 18:39:35 2014 ++++ Makefile.in Tue Mar 18 22:19:40 2014 +@@ -3209,7 +3209,7 @@ SPARSE_SRC = $(addprefix $(top_srcdir)/,$(filter %.c,$ # Documentation # man_MANS = doc/mpd.1 doc/mpd.conf.5 Index: patches/patch-configure =================================================================== RCS file: /cvs/ports/audio/mpd/patches/patch-configure,v retrieving revision 1.19 diff -u -p -u -p -r1.19 patch-configure --- patches/patch-configure 19 Sep 2013 15:02:16 -0000 1.19 +++ patches/patch-configure 29 Apr 2014 09:40:36 -0000 @@ -2,18 +2,18 @@ $OpenBSD: patch-configure,v 1.19 2013/09 Don't reset CPPFLAGS...stupid configure. ---- configure.orig Sun Aug 4 14:22:05 2013 -+++ configure Thu Sep 19 16:58:31 2013 -@@ -9862,7 +9862,7 @@ if test x$enable_aac = xyes; then +--- configure.orig Thu Mar 6 13:12:27 2014 ++++ configure Fri Apr 18 15:27:27 2014 +@@ -10326,7 +10326,7 @@ if test x$enable_aac = xyes; then oldcppflags=$CPPFLAGS - CFLAGS="$CFLAGS $FAAD_CFLAGS -I." + CFLAGS="$CFLAGS $FAAD_CFLAGS" LIBS="$LIBS $FAAD_LIBS" - CPPFLAGS=$CFLAGS + CPPFLAGS="$CPPFLAGS $CFLAGS" ac_fn_c_check_header_mongrel "$LINENO" "faad.h" "ac_cv_header_faad_h" "$ac_includes_default" if test "x$ac_cv_header_faad_h" = xyes; then : -@@ -10126,7 +10126,7 @@ if test x$enable_aac = xyes; then +@@ -10452,7 +10452,7 @@ if test x$enable_aac = xyes; then oldcppflags=$CPPFLAGS CFLAGS="$CFLAGS $FAAD_CFLAGS -Werror" LIBS="$LIBS $FAAD_LIBS" @@ -22,12 +22,3 @@ Don't reset CPPFLAGS...stupid configure. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken libfaad headers" >&5 $as_echo_n "checking for broken libfaad headers... " >&6; } -@@ -10172,7 +10172,7 @@ if test x$enable_aac = xyes; then - oldcppflags=$CPPFLAGS - CFLAGS="$CFLAGS $FAAD_CFLAGS" - LIBS="$LIBS $FAAD_LIBS $MP4FF_LIBS" -- CPPFLAGS=$CFLAGS -+ CPPFLAGS="$CPPFLAGS $CFLAGS" - - ac_fn_c_check_header_mongrel "$LINENO" "mp4ff.h" "ac_cv_header_mp4ff_h" "$ac_includes_default" - if test "x$ac_cv_header_mp4ff_h" = xyes; then : Index: patches/patch-doc_mpdconf_example =================================================================== RCS file: /cvs/ports/audio/mpd/patches/patch-doc_mpdconf_example,v retrieving revision 1.11 diff -u -p -u -p -r1.11 patch-doc_mpdconf_example --- patches/patch-doc_mpdconf_example 19 Sep 2013 15:02:16 -0000 1.11 +++ patches/patch-doc_mpdconf_example 29 Apr 2014 09:40:36 -0000 @@ -1,6 +1,6 @@ $OpenBSD: patch-doc_mpdconf_example,v 1.11 2013/09/19 15:02:16 dcoppa Exp $ ---- doc/mpdconf.example.orig Thu Aug 1 09:15:41 2013 -+++ doc/mpdconf.example Thu Sep 19 16:58:31 2013 +--- doc/mpdconf.example.orig Wed Dec 11 20:51:53 2013 ++++ doc/mpdconf.example Tue Mar 18 22:19:40 2014 @@ -10,14 +10,14 @@ # be disabled and audio files will only be accepted over ipc socket (using # file:// protocol) or streaming files over an accepted protocol. @@ -69,7 +69,7 @@ $OpenBSD: patch-doc_mpdconf_example,v 1. # This setting is the TCP port that is desired for the daemon to get assigned # to. # -@@ -320,6 +322,14 @@ input { +@@ -324,6 +326,14 @@ input { # name "My Null Output" # mixer_type "none" # optional #} @@ -82,5 +82,5 @@ $OpenBSD: patch-doc_mpdconf_example,v 1. + mixer_type "software" +} # - # This setting will change all decoded audio to be converted to the specified - # format before being passed to the audio outputs. By default, this setting is + # If MPD has been compiled with libsamplerate support, this setting specifies + # the sample rate converter to use. Possible values can be found in the Index: patches/patch-src_event_DeferredMonitor_cxx =================================================================== RCS file: patches/patch-src_event_DeferredMonitor_cxx diff -N patches/patch-src_event_DeferredMonitor_cxx --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_event_DeferredMonitor_cxx 29 Apr 2014 09:40:36 -0000 @@ -0,0 +1,66 @@ +$OpenBSD$ + +commit 0efb67b51e0d9d34c65bbdbd9df567a8a991cc4c +Author: Max Kellermann <[email protected]> +Date: Sat Apr 26 22:11:23 2014 +0200 + +DeferredMonitor: fix race condition when using GLib event loop + +Turns out the lock-free code using atomics was not thread-safe. The +given callback could be invoked by GLib before the source_id attribute +was assigned. This commit changes the DeferredMonitor class to use +a Mutex to block the event loop until source_id is assigned. This +bug does not exist in the 0.19 branch because it does not use the +GLib main loop anymore. + +--- src/event/DeferredMonitor.cxx.orig Wed Dec 11 20:51:53 2013 ++++ src/event/DeferredMonitor.cxx Tue Apr 29 11:32:48 2014 +@@ -27,9 +27,11 @@ DeferredMonitor::Cancel() + #ifdef USE_EPOLL + pending = false; + #else +- const auto id = source_id.exchange(0); +- if (id != 0) +- g_source_remove(id); ++ const ScopeLock protect(mutex); ++ if (source_id != 0) { ++ g_source_remove(source_id); ++ source_id = 0; ++ } + #endif + } + +@@ -40,10 +42,9 @@ DeferredMonitor::Schedule() + if (!pending.exchange(true)) + fd.Write(); + #else +- const unsigned id = loop.AddIdle(Callback, this); +- const auto old_id = source_id.exchange(id); +- if (old_id != 0) +- g_source_remove(old_id); ++ const ScopeLock protect(mutex); ++ if (source_id == 0) ++ source_id = loop.AddIdle(Callback, this); + #endif + } + +@@ -65,9 +66,16 @@ DeferredMonitor::OnSocketReady(unsigned) + void + DeferredMonitor::Run() + { +- const auto id = source_id.exchange(0); +- if (id != 0) +- RunDeferred(); ++ { ++ const ScopeLock protect(mutex); ++ if (source_id == 0) ++ /* cancelled */ ++ return; ++ ++ source_id = 0; ++ } ++ ++ RunDeferred(); + } + + gboolean Index: patches/patch-src_event_DeferredMonitor_hxx =================================================================== RCS file: patches/patch-src_event_DeferredMonitor_hxx diff -N patches/patch-src_event_DeferredMonitor_hxx --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_event_DeferredMonitor_hxx 29 Apr 2014 09:40:36 -0000 @@ -0,0 +1,36 @@ +$OpenBSD$ + +commit 0efb67b51e0d9d34c65bbdbd9df567a8a991cc4c +Author: Max Kellermann <[email protected]> +Date: Sat Apr 26 22:11:23 2014 +0200 + +DeferredMonitor: fix race condition when using GLib event loop + +Turns out the lock-free code using atomics was not thread-safe. The +given callback could be invoked by GLib before the source_id attribute +was assigned. This commit changes the DeferredMonitor class to use +a Mutex to block the event loop until source_id is assigned. This +bug does not exist in the 0.19 branch because it does not use the +GLib main loop anymore. + +--- src/event/DeferredMonitor.hxx.orig Wed Dec 11 20:51:53 2013 ++++ src/event/DeferredMonitor.hxx Tue Apr 29 11:32:48 2014 +@@ -27,6 +27,7 @@ + #include "SocketMonitor.hxx" + #include "WakeFD.hxx" + #else ++#include "thread/Mutex.hxx" + #include <glib.h> + #endif + +@@ -48,7 +49,9 @@ class DeferredMonitor + #else + EventLoop &loop; + +- std::atomic<guint> source_id; ++ Mutex mutex; ++ ++ guint source_id; + #endif + + public: Index: patches/patch-src_system_ByteOrder_hxx =================================================================== RCS file: patches/patch-src_system_ByteOrder_hxx diff -N patches/patch-src_system_ByteOrder_hxx --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_system_ByteOrder_hxx 29 Apr 2014 09:40:36 -0000 @@ -0,0 +1,12 @@ +$OpenBSD$ +--- src/system/ByteOrder.hxx.orig Tue Mar 18 23:12:51 2014 ++++ src/system/ByteOrder.hxx Tue Mar 18 22:57:46 2014 +@@ -42,7 +42,7 @@ + # define IS_BIG_ENDIAN true + #else + /* generic compile-time check */ +-# include <endian.h> ++# include <sys/endian.h> + # if __BYTE_ORDER == __LITTLE_ENDIAN + # define IS_LITTLE_ENDIAN true + # define IS_BIG_ENDIAN false
