summaryrefslogtreecommitdiffstats
path: root/services/audioflinger
diff options
context:
space:
mode:
Diffstat (limited to 'services/audioflinger')
-rw-r--r--services/audioflinger/Android.mk13
-rw-r--r--services/audioflinger/AudioFlinger.cpp2
-rw-r--r--services/audioflinger/AudioMixer.h12
-rw-r--r--services/audioflinger/AudioResampler.cpp5
-rw-r--r--services/audioflinger/AudioResampler.h4
-rw-r--r--services/audioflinger/AudioResamplerFirGen.h10
-rw-r--r--services/audioflinger/AudioResamplerSinc.cpp5
-rw-r--r--services/audioflinger/StateQueue.cpp2
-rw-r--r--services/audioflinger/Threads.cpp2
-rw-r--r--services/audioflinger/tests/Android.mk23
10 files changed, 38 insertions, 40 deletions
diff --git a/services/audioflinger/Android.mk b/services/audioflinger/Android.mk
index 697fb37..f3290c6 100644
--- a/services/audioflinger/Android.mk
+++ b/services/audioflinger/Android.mk
@@ -23,6 +23,12 @@ include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
+# Clang++ aborts on AudioMixer.cpp,
+# b/18373866, "do not know how to split this operator."
+ifeq ($(filter $(TARGET_ARCH),arm arm64),$(TARGET_ARCH))
+ LOCAL_CLANG := false
+endif
+
LOCAL_SRC_FILES:= \
AudioFlinger.cpp \
Threads.cpp \
@@ -68,13 +74,6 @@ LOCAL_SRC_FILES += FastCapture.cpp FastCaptureState.cpp
LOCAL_CFLAGS += -DSTATE_QUEUE_INSTANTIATIONS='"StateQueueInstantiations.cpp"'
-# Define ANDROID_SMP appropriately. Used to get inline tracing fast-path.
-ifeq ($(TARGET_CPU_SMP),true)
- LOCAL_CFLAGS += -DANDROID_SMP=1
-else
- LOCAL_CFLAGS += -DANDROID_SMP=0
-endif
-
LOCAL_CFLAGS += -fvisibility=hidden
include $(BUILD_SHARED_LIBRARY)
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 8acfc07..71e6f83 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1211,7 +1211,7 @@ void AudioFlinger::registerClient(const sp<IAudioFlingerClient>& client)
mNotificationClients.add(pid, notificationClient);
- sp<IBinder> binder = client->asBinder();
+ sp<IBinder> binder = IInterface::asBinder(client);
binder->linkToDeath(notificationClient);
clientAdded = true;
}
diff --git a/services/audioflinger/AudioMixer.h b/services/audioflinger/AudioMixer.h
index 3b972bb..f4f142b 100644
--- a/services/audioflinger/AudioMixer.h
+++ b/services/audioflinger/AudioMixer.h
@@ -21,15 +21,15 @@
#include <stdint.h>
#include <sys/types.h>
+#include <hardware/audio_effect.h>
+#include <media/AudioBufferProvider.h>
+#include <media/nbaio/NBLog.h>
+#include <system/audio.h>
+#include <utils/Compat.h>
#include <utils/threads.h>
-#include <media/AudioBufferProvider.h>
#include "AudioResampler.h"
-#include <hardware/audio_effect.h>
-#include <system/audio.h>
-#include <media/nbaio/NBLog.h>
-
// FIXME This is actually unity gain, which might not be max in future, expressed in U.12
#define MAX_GAIN_INT AudioMixer::UNITY_GAIN_INT
@@ -58,7 +58,7 @@ public:
static const uint32_t MAX_NUM_CHANNELS_TO_DOWNMIX = AUDIO_CHANNEL_COUNT_MAX;
static const uint16_t UNITY_GAIN_INT = 0x1000;
- static const float UNITY_GAIN_FLOAT = 1.0f;
+ static const CONSTEXPR float UNITY_GAIN_FLOAT = 1.0f;
enum { // names
diff --git a/services/audioflinger/AudioResampler.cpp b/services/audioflinger/AudioResampler.cpp
index 1f7a613..46e3d6c 100644
--- a/services/audioflinger/AudioResampler.cpp
+++ b/services/audioflinger/AudioResampler.cpp
@@ -29,14 +29,11 @@
#include "AudioResamplerDyn.h"
#ifdef __arm__
-#include <machine/cpu-features.h>
+ #define ASM_ARM_RESAMP1 // enable asm optimisation for ResamplerOrder1
#endif
namespace android {
-#ifdef __ARM_HAVE_HALFWORD_MULTIPLY // optimized asm option
- #define ASM_ARM_RESAMP1 // enable asm optimisation for ResamplerOrder1
-#endif // __ARM_HAVE_HALFWORD_MULTIPLY
// ----------------------------------------------------------------------------
class AudioResamplerOrder1 : public AudioResampler {
diff --git a/services/audioflinger/AudioResampler.h b/services/audioflinger/AudioResampler.h
index cdc6d92..069d946 100644
--- a/services/audioflinger/AudioResampler.h
+++ b/services/audioflinger/AudioResampler.h
@@ -19,7 +19,9 @@
#include <stdint.h>
#include <sys/types.h>
+
#include <cutils/compiler.h>
+#include <utils/Compat.h>
#include <media/AudioBufferProvider.h>
#include <system/audio.h>
@@ -47,7 +49,7 @@ public:
DYN_HIGH_QUALITY=7,
};
- static const float UNITY_GAIN_FLOAT = 1.0f;
+ static const CONSTEXPR float UNITY_GAIN_FLOAT = 1.0f;
static AudioResampler* create(audio_format_t format, int inChannelCount,
int32_t sampleRate, src_quality quality=DEFAULT_QUALITY);
diff --git a/services/audioflinger/AudioResamplerFirGen.h b/services/audioflinger/AudioResamplerFirGen.h
index d024b2f..f3718b6 100644
--- a/services/audioflinger/AudioResamplerFirGen.h
+++ b/services/audioflinger/AudioResamplerFirGen.h
@@ -17,6 +17,8 @@
#ifndef ANDROID_AUDIO_RESAMPLER_FIR_GEN_H
#define ANDROID_AUDIO_RESAMPLER_FIR_GEN_H
+#include "utils/Compat.h"
+
namespace android {
/*
@@ -187,22 +189,22 @@ static inline int64_t toint(double x, int64_t maxval) {
template <int N>
struct I0Term {
- static const double value = I0Term<N-1>::value / (4. * N * N);
+ static const CONSTEXPR double value = I0Term<N-1>::value / (4. * N * N);
};
template <>
struct I0Term<0> {
- static const double value = 1.;
+ static const CONSTEXPR double value = 1.;
};
template <int N>
struct I0ATerm {
- static const double value = I0ATerm<N-1>::value * (2.*N-1.) * (2.*N-1.) / (8. * N);
+ static const CONSTEXPR double value = I0ATerm<N-1>::value * (2.*N-1.) * (2.*N-1.) / (8. * N);
};
template <>
struct I0ATerm<0> { // 1/sqrt(2*PI);
- static const double value = 0.398942280401432677939946059934381868475858631164934657665925;
+ static const CONSTEXPR double value = 0.398942280401432677939946059934381868475858631164934657665925;
};
#if USE_HORNERS_METHOD
diff --git a/services/audioflinger/AudioResamplerSinc.cpp b/services/audioflinger/AudioResamplerSinc.cpp
index d03e578..e6fb76c 100644
--- a/services/audioflinger/AudioResamplerSinc.cpp
+++ b/services/audioflinger/AudioResamplerSinc.cpp
@@ -31,7 +31,10 @@
#include "AudioResamplerSinc.h"
-
+#if defined(__clang__) && !__has_builtin(__builtin_assume_aligned)
+#define __builtin_assume_aligned(p, a) \
+ (((uintptr_t(p) % (a)) == 0) ? (p) : (__builtin_unreachable(), (p)))
+#endif
#if defined(__arm__) && !defined(__thumb__)
#define USE_INLINE_ASSEMBLY (true)
diff --git a/services/audioflinger/StateQueue.cpp b/services/audioflinger/StateQueue.cpp
index 40d7bcd..9d4188f 100644
--- a/services/audioflinger/StateQueue.cpp
+++ b/services/audioflinger/StateQueue.cpp
@@ -48,7 +48,7 @@ template<typename T> StateQueue<T>::StateQueue() :
, mObserverDump(&mObserverDummyDump), mMutatorDump(&mMutatorDummyDump)
#endif
{
- atomic_init(&mNext, 0);
+ atomic_init(&mNext, static_cast<uintptr_t>(0));
}
template<typename T> StateQueue<T>::~StateQueue()
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 87f636c..b20b238 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -338,7 +338,7 @@ AudioFlinger::ThreadBase::~ThreadBase()
// do not lock the mutex in destructor
releaseWakeLock_l();
if (mPowerManager != 0) {
- sp<IBinder> binder = mPowerManager->asBinder();
+ sp<IBinder> binder = IInterface::asBinder(mPowerManager);
binder->unlinkToDeath(mDeathRecipient);
}
}
diff --git a/services/audioflinger/tests/Android.mk b/services/audioflinger/tests/Android.mk
index 7bba05b..8604ef5 100644
--- a/services/audioflinger/tests/Android.mk
+++ b/services/audioflinger/tests/Android.mk
@@ -10,19 +10,10 @@ LOCAL_SHARED_LIBRARIES := \
liblog \
libutils \
libcutils \
- libstlport \
libaudioutils \
libaudioresampler
-LOCAL_STATIC_LIBRARIES := \
- libgtest \
- libgtest_main
-
LOCAL_C_INCLUDES := \
- bionic \
- bionic/libstdc++/include \
- external/gtest/include \
- external/stlport/stlport \
$(call include-path-for, audio-utils) \
frameworks/av/services/audioflinger
@@ -32,21 +23,24 @@ LOCAL_SRC_FILES := \
LOCAL_MODULE := resampler_tests
LOCAL_MODULE_TAGS := tests
-include $(BUILD_EXECUTABLE)
+include $(BUILD_NATIVE_TEST)
#
# audio mixer test tool
#
include $(CLEAR_VARS)
+# Clang++ aborts on AudioMixer.cpp,
+# b/18373866, "do not know how to split this operator."
+ifeq ($(filter $(TARGET_ARCH),arm arm64),$(TARGET_ARCH))
+ LOCAL_CLANG := false
+endif
+
LOCAL_SRC_FILES:= \
test-mixer.cpp \
../AudioMixer.cpp.arm \
LOCAL_C_INCLUDES := \
- bionic \
- bionic/libstdc++/include \
- external/stlport/stlport \
$(call include-path-for, audio-effects) \
$(call include-path-for, audio-utils) \
frameworks/av/services/audioflinger
@@ -55,7 +49,6 @@ LOCAL_STATIC_LIBRARIES := \
libsndfile
LOCAL_SHARED_LIBRARIES := \
- libstlport \
libeffects \
libnbaio \
libcommon_time_client \
@@ -70,4 +63,6 @@ LOCAL_MODULE:= test-mixer
LOCAL_MODULE_TAGS := optional
+LOCAL_CXX_STL := libc++
+
include $(BUILD_EXECUTABLE)