diff options
author | Max Kellermann <max@duempel.org> | 2014-09-24 21:49:20 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-09-24 21:49:20 +0200 |
commit | 92704857231423f662152495d5521301195dfd17 (patch) | |
tree | fdc2e8102018456790652f3c96953ce23147ce56 /src | |
parent | cbdaf4827fedd4159de07a648899d88ca9a884af (diff) | |
parent | e93975cb466db335f4c9739669fb22ad4ecf0b08 (diff) | |
download | mpd-92704857231423f662152495d5521301195dfd17.tar.gz mpd-92704857231423f662152495d5521301195dfd17.tar.xz mpd-92704857231423f662152495d5521301195dfd17.zip |
Merge branch 'v0.18.x'
Diffstat (limited to '')
-rw-r--r-- | src/command/CommandListBuilder.cxx | 1 | ||||
-rw-r--r-- | src/notify.hxx | 2 | ||||
-rw-r--r-- | src/output/OutputThread.cxx | 11 | ||||
-rw-r--r-- | src/thread/PosixCond.hxx | 17 | ||||
-rw-r--r-- | src/thread/PosixMutex.hxx | 17 |
5 files changed, 40 insertions, 8 deletions
diff --git a/src/command/CommandListBuilder.cxx b/src/command/CommandListBuilder.cxx index 1dcbf2946..477c246ff 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; } diff --git a/src/notify.hxx b/src/notify.hxx index ebd12e5c6..3e62a0103 100644 --- a/src/notify.hxx +++ b/src/notify.hxx @@ -28,7 +28,7 @@ struct notify { Cond cond; bool pending; -#if !defined(WIN32) && !defined(__BIONIC__) +#if !defined(WIN32) && !defined(__NetBSD__) && !defined(__BIONIC__) constexpr #endif notify():pending(false) {} diff --git a/src/output/OutputThread.cxx b/src/output/OutputThread.cxx index 98e43cffd..e46425097 100644 --- a/src/output/OutputThread.cxx +++ b/src/output/OutputThread.cxx @@ -371,11 +371,20 @@ ao_filter_chunk(AudioOutput *ao, const MusicChunk *chunk) if (data.size > other_data.size) data.size = other_data.size; + 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_data.size); memcpy(dest, other_data.data, other_data.size); if (!pcm_mix(ao->cross_fade_dither, dest, data.data, data.size, 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)); diff --git a/src/thread/PosixCond.hxx b/src/thread/PosixCond.hxx index e0d6623dd..b3fe204e1 100644 --- a/src/thread/PosixCond.hxx +++ b/src/thread/PosixCond.hxx @@ -41,10 +41,21 @@ class PosixCond { pthread_cond_t cond; public: -#ifndef __BIONIC__ - constexpr +#if defined(__NetBSD__) || defined(__BIONIC__) + /* 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():cond(PTHREAD_COND_INITIALIZER) {} PosixCond(const PosixCond &other) = delete; PosixCond &operator=(const PosixCond &other) = delete; diff --git a/src/thread/PosixMutex.hxx b/src/thread/PosixMutex.hxx index 9d1674dd4..5805158d5 100644 --- a/src/thread/PosixMutex.hxx +++ b/src/thread/PosixMutex.hxx @@ -41,10 +41,21 @@ class PosixMutex { pthread_mutex_t mutex; public: -#ifndef __BIONIC__ - constexpr +#if defined(__NetBSD__) || defined(__BIONIC__) + /* 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():mutex(PTHREAD_MUTEX_INITIALIZER) {} PosixMutex(const PosixMutex &other) = delete; PosixMutex &operator=(const PosixMutex &other) = delete; |