Merge branch 'v0.18.x'

This commit is contained in:
Max Kellermann 2014-09-24 21:49:20 +02:00
commit 9270485723
7 changed files with 48 additions and 8 deletions

6
NEWS
View File

@ -71,6 +71,12 @@ ver 0.19 (not yet released)
* install systemd unit for socket activation
* Android port
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)
* protocol
- fix range parser bug on certain 32 bit architectures

View File

@ -27,6 +27,7 @@ void
CommandListBuilder::Reset()
{
list.clear();
size = 0;
mode = Mode::DISABLED;
}

View File

@ -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) {}

View File

@ -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));

View File

@ -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;

View File

@ -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;

View File

@ -8,6 +8,8 @@
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h>
#include <unistd.h>
static enum ack last_error = ack(-1);
void