From ab7b38d4b9c6673dc4adfaed7956984ec6bc8c9e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 13 Sep 2014 11:14:41 +0200 Subject: configure.ac: prepare for 0.18.15 --- NEWS | 2 ++ configure.ac | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 89d833071..b15161b23 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +ver 0.18.15 (not yet released) + ver 0.18.14 (2014/09/11) * protocol - fix range parser bug on certain 32 bit architectures diff --git a/configure.ac b/configure.ac index a81b0aff1..9c8d72e1f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ(2.60) -AC_INIT(mpd, 0.18.14, mpd-devel@musicpd.org) +AC_INIT(mpd, 0.18.15, mpd-devel@musicpd.org) VERSION_MAJOR=0 VERSION_MINOR=18 -- cgit v1.2.3 From e304d0f8ee404ef7e1223a324012d4fb4049185d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 13 Sep 2014 11:26:17 +0200 Subject: thread/Posix{Cond,Mutex}: don't ues PTHREAD_*_INITIALIZER on NetBSD On NetBSD, PTHREAD_MUTEX_INITIALIZER and PTHREAD_COND_INITIALIZER are not compatible with C++11 "constexpr" (see Mantis ticket 0004110). As a workaround, don't ues "constexpr", and use the functions pthread_mutex_init(), pthread_mutex_destroy(), pthread_cond_init() and pthread_cond_destroy() instead. This adds some runtime overhead, but is portable to POSIX implementations that have awkward initializer macros. --- NEWS | 1 + src/notify.hxx | 2 +- src/thread/PosixCond.hxx | 14 ++++++++++++++ src/thread/PosixMutex.hxx | 14 ++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index b15161b23..499b3ac0c 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,5 @@ ver 0.18.15 (not yet released) +* work around build failure on NetBSD ver 0.18.14 (2014/09/11) * protocol diff --git a/src/notify.hxx b/src/notify.hxx index 6b9e95368..1024dd8d9 100644 --- a/src/notify.hxx +++ b/src/notify.hxx @@ -28,7 +28,7 @@ struct notify { Cond cond; bool pending; -#ifndef WIN32 +#if !defined(WIN32) && !defined(__NetBSD__) constexpr #endif notify():pending(false) {} diff --git a/src/thread/PosixCond.hxx b/src/thread/PosixCond.hxx index 6f98d3ad0..c2797649a 100644 --- a/src/thread/PosixCond.hxx +++ b/src/thread/PosixCond.hxx @@ -41,7 +41,21 @@ class PosixCond { pthread_cond_t cond; public: +#ifdef __NetBSD__ + /* NetBSD's PTHREAD_COND_INITIALIZER is not compatible with + "constexpr" */ + PosixCond() { + pthread_cond_init(&cond, nullptr); + } + + ~PosixCond() { + pthread_cond_destroy(&cond); + } +#else + /* optimized constexpr constructor for sane POSIX + implementations */ constexpr PosixCond():cond(PTHREAD_COND_INITIALIZER) {} +#endif PosixCond(const PosixCond &other) = delete; PosixCond &operator=(const PosixCond &other) = delete; diff --git a/src/thread/PosixMutex.hxx b/src/thread/PosixMutex.hxx index d50764af4..445c0ace2 100644 --- a/src/thread/PosixMutex.hxx +++ b/src/thread/PosixMutex.hxx @@ -41,7 +41,21 @@ class PosixMutex { pthread_mutex_t mutex; public: +#ifdef __NetBSD__ + /* NetBSD's PTHREAD_MUTEX_INITIALIZER is not compatible with + "constexpr" */ + PosixMutex() { + pthread_mutex_init(&mutex, nullptr); + } + + ~PosixMutex() { + pthread_mutex_destroy(&mutex); + } +#else + /* optimized constexpr constructor for sane POSIX + implementations */ constexpr PosixMutex():mutex(PTHREAD_MUTEX_INITIALIZER) {} +#endif PosixMutex(const PosixMutex &other) = delete; PosixMutex &operator=(const PosixMutex &other) = delete; -- cgit v1.2.3 From a0ef27a0cd97d53f89def5ed5c94250b92cbd587 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Tue, 16 Sep 2014 12:54:16 +0200 Subject: command/list: reset used size after the list has been processed --- NEWS | 2 ++ src/command/CommandListBuilder.cxx | 1 + 2 files changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 499b3ac0c..dcb3c6da1 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.18.15 (not yet released) +* command + - list: reset used size after the list has been processed * work around build failure on NetBSD ver 0.18.14 (2014/09/11) diff --git a/src/command/CommandListBuilder.cxx b/src/command/CommandListBuilder.cxx index cc10f7205..4e0a8bd2a 100644 --- a/src/command/CommandListBuilder.cxx +++ b/src/command/CommandListBuilder.cxx @@ -27,6 +27,7 @@ void CommandListBuilder::Reset() { list.clear(); + size = 0; mode = Mode::DISABLED; } -- cgit v1.2.3 From b6fa22bd84b6f60bb73bec99a1182832b761542b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 18 Sep 2014 13:50:23 +0200 Subject: OutputThread: retain negative mix ratio Fixes MixRamp breakage. --- NEWS | 1 + src/OutputThread.cxx | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index dcb3c6da1..80d5da21c 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ ver 0.18.15 (not yet released) * command - list: reset used size after the list has been processed +* fix MixRamp * work around build failure on NetBSD ver 0.18.14 (2014/09/11) diff --git a/src/OutputThread.cxx b/src/OutputThread.cxx index 30d3ba30f..b96ba4efd 100644 --- a/src/OutputThread.cxx +++ b/src/OutputThread.cxx @@ -385,11 +385,20 @@ ao_filter_chunk(struct audio_output *ao, const struct music_chunk *chunk, if (length > other_length) length = other_length; + float mix_ratio = chunk->mix_ratio; + if (mix_ratio >= 0) + /* reverse the mix ratio (because the + arguments to pcm_mix() are reversed), but + only if the mix ratio is non-negative; a + negative mix ratio is a MixRamp special + case */ + mix_ratio = 1.0 - mix_ratio; + void *dest = ao->cross_fade_buffer.Get(other_length); memcpy(dest, other_data, other_length); if (!pcm_mix(dest, data, length, ao->in_audio_format.format, - 1.0 - chunk->mix_ratio)) { + mix_ratio)) { FormatError(output_domain, "Cannot cross-fade format %s", sample_format_to_string(ao->in_audio_format.format)); -- cgit v1.2.3 From e93975cb466db335f4c9739669fb22ad4ecf0b08 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 24 Sep 2014 21:40:18 +0200 Subject: test/test_protocol: add missing unistd.h include --- test/test_protocol.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/test_protocol.cxx b/test/test_protocol.cxx index d7ea7cd87..e80e4fe6d 100644 --- a/test/test_protocol.cxx +++ b/test/test_protocol.cxx @@ -8,6 +8,8 @@ #include #include +#include + static enum ack last_error = ack(-1); void -- cgit v1.2.3