Update NBAIO to use the new audio HAL abstraction layer
Moved the HAL access abstraction layer to a separate library so it
can be used both by audioflinger and libnbaio.
Bug: 30222631
Test: manual with Loopback app, Hangouts, YouTube
Change-Id: Id622c2f1aa8f55a775d34f369a596c2c4d29d5be
diff --git a/services/audioflinger/DeviceHalInterface.h b/include/media/audiohal/DeviceHalInterface.h
similarity index 100%
rename from services/audioflinger/DeviceHalInterface.h
rename to include/media/audiohal/DeviceHalInterface.h
diff --git a/services/audioflinger/DevicesFactoryHalInterface.h b/include/media/audiohal/DevicesFactoryHalInterface.h
similarity index 96%
rename from services/audioflinger/DevicesFactoryHalInterface.h
rename to include/media/audiohal/DevicesFactoryHalInterface.h
index 70c8260..823a0da 100644
--- a/services/audioflinger/DevicesFactoryHalInterface.h
+++ b/include/media/audiohal/DevicesFactoryHalInterface.h
@@ -17,11 +17,10 @@
#ifndef ANDROID_HARDWARE_DEVICES_FACTORY_HAL_INTERFACE_H
#define ANDROID_HARDWARE_DEVICES_FACTORY_HAL_INTERFACE_H
+#include <media/audiohal/DeviceHalInterface.h>
#include <utils/Errors.h>
#include <utils/RefBase.h>
-#include "DeviceHalInterface.h"
-
namespace android {
class DevicesFactoryHalInterface : public RefBase
diff --git a/services/audioflinger/EffectHalInterface.h b/include/media/audiohal/EffectHalInterface.h
similarity index 100%
rename from services/audioflinger/EffectHalInterface.h
rename to include/media/audiohal/EffectHalInterface.h
diff --git a/services/audioflinger/EffectsFactoryHalInterface.h b/include/media/audiohal/EffectsFactoryHalInterface.h
similarity index 97%
rename from services/audioflinger/EffectsFactoryHalInterface.h
rename to include/media/audiohal/EffectsFactoryHalInterface.h
index 9a08f68..1588dab 100644
--- a/services/audioflinger/EffectsFactoryHalInterface.h
+++ b/include/media/audiohal/EffectsFactoryHalInterface.h
@@ -18,11 +18,10 @@
#define ANDROID_HARDWARE_EFFECTS_FACTORY_HAL_INTERFACE_H
#include <hardware/audio_effect.h>
+#include <media/audiohal/EffectHalInterface.h>
#include <utils/Errors.h>
#include <utils/RefBase.h>
-#include "EffectHalInterface.h"
-
namespace android {
class EffectsFactoryHalInterface : public RefBase
diff --git a/services/audioflinger/StreamHalInterface.h b/include/media/audiohal/StreamHalInterface.h
similarity index 98%
rename from services/audioflinger/StreamHalInterface.h
rename to include/media/audiohal/StreamHalInterface.h
index 0339069..5a7b4b6 100644
--- a/services/audioflinger/StreamHalInterface.h
+++ b/include/media/audiohal/StreamHalInterface.h
@@ -17,13 +17,12 @@
#ifndef ANDROID_HARDWARE_STREAM_HAL_INTERFACE_H
#define ANDROID_HARDWARE_STREAM_HAL_INTERFACE_H
-#include <hardware/audio_effect.h>
+#include <hardware/audio.h>
+#include <media/audiohal/EffectHalInterface.h>
#include <utils/Errors.h>
#include <utils/RefBase.h>
#include <utils/String8.h>
-#include "EffectHalInterface.h"
-
namespace android {
class StreamHalInterface : public virtual RefBase
diff --git a/include/media/nbaio/AudioStreamInSource.h b/include/media/nbaio/AudioStreamInSource.h
index a6e7992..2efff4a 100644
--- a/include/media/nbaio/AudioStreamInSource.h
+++ b/include/media/nbaio/AudioStreamInSource.h
@@ -22,11 +22,13 @@
namespace android {
+class StreamInHalInterface;
+
// not multi-thread safe
class AudioStreamInSource : public NBAIO_Source {
public:
- AudioStreamInSource(audio_stream_in *stream);
+ AudioStreamInSource(sp<StreamInHalInterface> stream);
virtual ~AudioStreamInSource();
// NBAIO_Port interface
@@ -50,11 +52,11 @@
// NBAIO_Sink end
#if 0 // until necessary
- audio_stream_in *stream() const { return mStream; }
+ sp<StreamInHalInterface> stream() const { return mStream; }
#endif
private:
- audio_stream_in * const mStream;
+ sp<StreamInHalInterface> mStream;
size_t mStreamBufferSizeBytes; // as reported by get_buffer_size()
int64_t mFramesOverrun;
int64_t mOverruns;
diff --git a/include/media/nbaio/AudioStreamOutSink.h b/include/media/nbaio/AudioStreamOutSink.h
index e86b018..3c59da2 100644
--- a/include/media/nbaio/AudioStreamOutSink.h
+++ b/include/media/nbaio/AudioStreamOutSink.h
@@ -22,11 +22,13 @@
namespace android {
+class StreamOutHalInterface;
+
// not multi-thread safe
class AudioStreamOutSink : public NBAIO_Sink {
public:
- AudioStreamOutSink(audio_stream_out *stream);
+ AudioStreamOutSink(sp<StreamOutHalInterface> stream);
virtual ~AudioStreamOutSink();
// NBAIO_Port interface
@@ -52,11 +54,11 @@
// NBAIO_Sink end
#if 0 // until necessary
- audio_stream_out *stream() const { return mStream; }
+ sp<StreamOutHalInterface> stream() const { return mStream; }
#endif
private:
- audio_stream_out * const mStream;
+ sp<StreamOutHalInterface> mStream;
size_t mStreamBufferSizeBytes; // as reported by get_buffer_size()
};
diff --git a/media/libaudiohal/Android.mk b/media/libaudiohal/Android.mk
new file mode 100644
index 0000000..ba20c79
--- /dev/null
+++ b/media/libaudiohal/Android.mk
@@ -0,0 +1,23 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+ DeviceHalLocal.cpp \
+ DevicesFactoryHalLocal.cpp \
+ EffectHalLocal.cpp \
+ EffectsFactoryHalLocal.cpp \
+ StreamHalLocal.cpp
+
+LOCAL_MODULE := libaudiohal
+
+LOCAL_SHARED_LIBRARIES := \
+ libcutils \
+ libhardware \
+ liblog \
+ libeffects \
+ libutils
+
+LOCAL_CFLAGS := -Werror -Wall
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/services/audioflinger/DeviceHalLocal.cpp b/media/libaudiohal/DeviceHalLocal.cpp
similarity index 98%
rename from services/audioflinger/DeviceHalLocal.cpp
rename to media/libaudiohal/DeviceHalLocal.cpp
index 160eb4a..c5df8c8 100644
--- a/services/audioflinger/DeviceHalLocal.cpp
+++ b/media/libaudiohal/DeviceHalLocal.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#define LOG_TAG "AudioFlinger::DeviceHalLocal"
+#define LOG_TAG "DeviceHalLocal"
//#define LOG_NDEBUG 0
#include <utils/Log.h>
diff --git a/services/audioflinger/DeviceHalLocal.h b/media/libaudiohal/DeviceHalLocal.h
similarity index 98%
rename from services/audioflinger/DeviceHalLocal.h
rename to media/libaudiohal/DeviceHalLocal.h
index 1f808cf..6c15eb7 100644
--- a/services/audioflinger/DeviceHalLocal.h
+++ b/media/libaudiohal/DeviceHalLocal.h
@@ -17,7 +17,7 @@
#ifndef ANDROID_HARDWARE_DEVICE_HAL_LOCAL_H
#define ANDROID_HARDWARE_DEVICE_HAL_LOCAL_H
-#include "DeviceHalInterface.h"
+#include <media/audiohal/DeviceHalInterface.h>
namespace android {
diff --git a/services/audioflinger/DevicesFactoryHalLocal.cpp b/media/libaudiohal/DevicesFactoryHalLocal.cpp
similarity index 96%
rename from services/audioflinger/DevicesFactoryHalLocal.cpp
rename to media/libaudiohal/DevicesFactoryHalLocal.cpp
index 437be25..cd9a9e7 100644
--- a/services/audioflinger/DevicesFactoryHalLocal.cpp
+++ b/media/libaudiohal/DevicesFactoryHalLocal.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#define LOG_TAG "AudioFlinger::DevicesFactoryHalLocal"
+#define LOG_TAG "DevicesFactoryHalLocal"
//#define LOG_NDEBUG 0
#include <string.h>
diff --git a/services/audioflinger/DevicesFactoryHalLocal.h b/media/libaudiohal/DevicesFactoryHalLocal.h
similarity index 95%
rename from services/audioflinger/DevicesFactoryHalLocal.h
rename to media/libaudiohal/DevicesFactoryHalLocal.h
index 55d422c..690cd34 100644
--- a/services/audioflinger/DevicesFactoryHalLocal.h
+++ b/media/libaudiohal/DevicesFactoryHalLocal.h
@@ -17,11 +17,11 @@
#ifndef ANDROID_HARDWARE_DEVICES_FACTORY_HAL_LOCAL_H
#define ANDROID_HARDWARE_DEVICES_FACTORY_HAL_LOCAL_H
+#include <media/audiohal/DevicesFactoryHalInterface.h>
#include <utils/Errors.h>
#include <utils/RefBase.h>
#include "DeviceHalLocal.h"
-#include "DevicesFactoryHalInterface.h"
namespace android {
diff --git a/services/audioflinger/EffectHalLocal.cpp b/media/libaudiohal/EffectHalLocal.cpp
similarity index 96%
rename from services/audioflinger/EffectHalLocal.cpp
rename to media/libaudiohal/EffectHalLocal.cpp
index aae1921..56a365c 100644
--- a/services/audioflinger/EffectHalLocal.cpp
+++ b/media/libaudiohal/EffectHalLocal.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#define LOG_TAG "AudioFlinger::EffectHalLocal"
+#define LOG_TAG "EffectHalLocal"
//#define LOG_NDEBUG 0
#include <media/EffectsFactoryApi.h>
diff --git a/services/audioflinger/EffectHalLocal.h b/media/libaudiohal/EffectHalLocal.h
similarity index 97%
rename from services/audioflinger/EffectHalLocal.h
rename to media/libaudiohal/EffectHalLocal.h
index 73ba6d5..2777e46 100644
--- a/services/audioflinger/EffectHalLocal.h
+++ b/media/libaudiohal/EffectHalLocal.h
@@ -17,7 +17,7 @@
#ifndef ANDROID_HARDWARE_EFFECT_HAL_LOCAL_H
#define ANDROID_HARDWARE_EFFECT_HAL_LOCAL_H
-#include "EffectHalInterface.h"
+#include <media/audiohal/EffectHalInterface.h>
namespace android {
diff --git a/services/audioflinger/EffectsFactoryHalLocal.cpp b/media/libaudiohal/EffectsFactoryHalLocal.cpp
similarity index 100%
rename from services/audioflinger/EffectsFactoryHalLocal.cpp
rename to media/libaudiohal/EffectsFactoryHalLocal.cpp
diff --git a/services/audioflinger/EffectsFactoryHalLocal.h b/media/libaudiohal/EffectsFactoryHalLocal.h
similarity index 96%
rename from services/audioflinger/EffectsFactoryHalLocal.h
rename to media/libaudiohal/EffectsFactoryHalLocal.h
index 9f6b5ce..d5b81be 100644
--- a/services/audioflinger/EffectsFactoryHalLocal.h
+++ b/media/libaudiohal/EffectsFactoryHalLocal.h
@@ -17,7 +17,7 @@
#ifndef ANDROID_HARDWARE_EFFECTS_FACTORY_HAL_LOCAL_H
#define ANDROID_HARDWARE_EFFECTS_FACTORY_HAL_LOCAL_H
-#include "EffectsFactoryHalInterface.h"
+#include <media/audiohal/EffectsFactoryHalInterface.h>
namespace android {
diff --git a/services/audioflinger/StreamHalLocal.cpp b/media/libaudiohal/StreamHalLocal.cpp
similarity index 98%
rename from services/audioflinger/StreamHalLocal.cpp
rename to media/libaudiohal/StreamHalLocal.cpp
index cdd714b..cd97cc8 100644
--- a/services/audioflinger/StreamHalLocal.cpp
+++ b/media/libaudiohal/StreamHalLocal.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#define LOG_TAG "AudioFlinger::StreamHalLocal"
+#define LOG_TAG "StreamHalLocal"
//#define LOG_NDEBUG 0
#include <utils/Log.h>
diff --git a/services/audioflinger/StreamHalLocal.h b/media/libaudiohal/StreamHalLocal.h
similarity index 95%
rename from services/audioflinger/StreamHalLocal.h
rename to media/libaudiohal/StreamHalLocal.h
index d8c30d3..7144e65 100644
--- a/services/audioflinger/StreamHalLocal.h
+++ b/media/libaudiohal/StreamHalLocal.h
@@ -17,7 +17,7 @@
#ifndef ANDROID_HARDWARE_STREAM_HAL_LOCAL_H
#define ANDROID_HARDWARE_STREAM_HAL_LOCAL_H
-#include "StreamHalInterface.h"
+#include <media/audiohal/StreamHalInterface.h>
namespace android {
@@ -115,9 +115,6 @@
// Return a recent count of the number of audio frames presented to an external observer.
virtual status_t getPresentationPosition(uint64_t *frames, struct timespec *timestamp);
- // FIXME: Remove after NBAIO is converted.
- audio_stream_out_t *getStream() const { return mStream; }
-
private:
audio_stream_out_t *mStream;
wp<StreamOutHalInterfaceCallback> mCallback;
@@ -150,9 +147,6 @@
// the clock time associated with that frame count.
virtual status_t getCapturePosition(int64_t *frames, int64_t *time);
- // FIXME: Remove after NBAIO is converted.
- audio_stream_in_t *getStream() const { return mStream; }
-
private:
audio_stream_in_t *mStream;
diff --git a/media/libnbaio/Android.mk b/media/libnbaio/Android.mk
index e2f416b..fe916d1 100644
--- a/media/libnbaio/Android.mk
+++ b/media/libnbaio/Android.mk
@@ -23,6 +23,7 @@
LOCAL_MODULE := libnbaio
LOCAL_SHARED_LIBRARIES := \
+ libaudiohal \
libaudioutils \
libbinder \
libcutils \
diff --git a/media/libnbaio/AudioStreamInSource.cpp b/media/libnbaio/AudioStreamInSource.cpp
index 2dc3050..1054b68 100644
--- a/media/libnbaio/AudioStreamInSource.cpp
+++ b/media/libnbaio/AudioStreamInSource.cpp
@@ -19,33 +19,38 @@
#include <cutils/compiler.h>
#include <utils/Log.h>
+#include <media/audiohal/StreamHalInterface.h>
#include <media/nbaio/AudioStreamInSource.h>
namespace android {
-AudioStreamInSource::AudioStreamInSource(audio_stream_in *stream) :
+AudioStreamInSource::AudioStreamInSource(sp<StreamInHalInterface> stream) :
NBAIO_Source(),
mStream(stream),
mStreamBufferSizeBytes(0),
mFramesOverrun(0),
mOverruns(0)
{
- ALOG_ASSERT(stream != NULL);
+ ALOG_ASSERT(stream != 0);
}
AudioStreamInSource::~AudioStreamInSource()
{
+ mStream.clear();
}
ssize_t AudioStreamInSource::negotiate(const NBAIO_Format offers[], size_t numOffers,
NBAIO_Format counterOffers[], size_t& numCounterOffers)
{
if (!Format_isValid(mFormat)) {
- mStreamBufferSizeBytes = mStream->common.get_buffer_size(&mStream->common);
- audio_format_t streamFormat = mStream->common.get_format(&mStream->common);
- uint32_t sampleRate = mStream->common.get_sample_rate(&mStream->common);
- audio_channel_mask_t channelMask =
- (audio_channel_mask_t) mStream->common.get_channels(&mStream->common);
+ status_t result;
+ result = mStream->getBufferSize(&mStreamBufferSizeBytes);
+ if (result != OK) return result;
+ audio_format_t streamFormat;
+ uint32_t sampleRate;
+ audio_channel_mask_t channelMask;
+ result = mStream->getAudioProperties(&sampleRate, &channelMask, &streamFormat);
+ if (result != OK) return result;
mFormat = Format_from_SR_C(sampleRate,
audio_channel_count_from_in_mask(channelMask), streamFormat);
mFrameSize = Format_frameSize(mFormat);
@@ -55,11 +60,14 @@
int64_t AudioStreamInSource::framesOverrun()
{
- uint32_t framesOverrun = mStream->get_input_frames_lost(mStream);
- if (framesOverrun > 0) {
+ uint32_t framesOverrun;
+ status_t result = mStream->getInputFramesLost(&framesOverrun);
+ if (result == OK && framesOverrun > 0) {
mFramesOverrun += framesOverrun;
// FIXME only increment for contiguous ranges
++mOverruns;
+ } else if (result != OK) {
+ ALOGE("Error when retrieving lost frames count from HAL: %d", result);
}
return mFramesOverrun;
}
@@ -69,12 +77,14 @@
if (CC_UNLIKELY(!Format_isValid(mFormat))) {
return NEGOTIATE;
}
- ssize_t bytesRead = mStream->read(mStream, buffer, count * mFrameSize);
- if (bytesRead > 0) {
+ size_t bytesRead;
+ status_t result = mStream->read(buffer, count * mFrameSize, &bytesRead);
+ if (result == OK && bytesRead > 0) {
size_t framesRead = bytesRead / mFrameSize;
mFramesRead += framesRead;
return framesRead;
} else {
+ ALOGE_IF(result != OK, "Error while reading data from HAL: %d", result);
return bytesRead;
}
}
diff --git a/media/libnbaio/AudioStreamOutSink.cpp b/media/libnbaio/AudioStreamOutSink.cpp
index ee44678..cbff87d 100644
--- a/media/libnbaio/AudioStreamOutSink.cpp
+++ b/media/libnbaio/AudioStreamOutSink.cpp
@@ -18,31 +18,36 @@
//#define LOG_NDEBUG 0
#include <utils/Log.h>
+#include <media/audiohal/StreamHalInterface.h>
#include <media/nbaio/AudioStreamOutSink.h>
namespace android {
-AudioStreamOutSink::AudioStreamOutSink(audio_stream_out *stream) :
+AudioStreamOutSink::AudioStreamOutSink(sp<StreamOutHalInterface> stream) :
NBAIO_Sink(),
mStream(stream),
mStreamBufferSizeBytes(0)
{
- ALOG_ASSERT(stream != NULL);
+ ALOG_ASSERT(stream != 0);
}
AudioStreamOutSink::~AudioStreamOutSink()
{
+ mStream.clear();
}
ssize_t AudioStreamOutSink::negotiate(const NBAIO_Format offers[], size_t numOffers,
NBAIO_Format counterOffers[], size_t& numCounterOffers)
{
if (!Format_isValid(mFormat)) {
- mStreamBufferSizeBytes = mStream->common.get_buffer_size(&mStream->common);
- audio_format_t streamFormat = mStream->common.get_format(&mStream->common);
- uint32_t sampleRate = mStream->common.get_sample_rate(&mStream->common);
- audio_channel_mask_t channelMask =
- (audio_channel_mask_t) mStream->common.get_channels(&mStream->common);
+ status_t result;
+ result = mStream->getBufferSize(&mStreamBufferSizeBytes);
+ if (result != OK) return result;
+ audio_format_t streamFormat;
+ uint32_t sampleRate;
+ audio_channel_mask_t channelMask;
+ result = mStream->getAudioProperties(&sampleRate, &channelMask, &streamFormat);
+ if (result != OK) return result;
mFormat = Format_from_SR_C(sampleRate,
audio_channel_count_from_out_mask(channelMask), streamFormat);
mFrameSize = Format_frameSize(mFormat);
@@ -56,25 +61,24 @@
return NEGOTIATE;
}
ALOG_ASSERT(Format_isValid(mFormat));
- ssize_t ret = mStream->write(mStream, buffer, count * mFrameSize);
- if (ret > 0) {
- ret /= mFrameSize;
- mFramesWritten += ret;
+ size_t written;
+ status_t ret = mStream->write(buffer, count * mFrameSize, &written);
+ if (ret == OK && written > 0) {
+ written /= mFrameSize;
+ mFramesWritten += written;
+ return written;
} else {
// FIXME verify HAL implementations are returning the correct error codes e.g. WOULD_BLOCK
+ ALOGE_IF(ret != OK, "Error while writing data to HAL: %d", ret);
+ return ret;
}
- return ret;
}
status_t AudioStreamOutSink::getTimestamp(ExtendedTimestamp ×tamp)
{
- if (mStream->get_presentation_position == NULL) {
- return INVALID_OPERATION;
- }
-
uint64_t position64;
struct timespec time;
- if (mStream->get_presentation_position(mStream, &position64, &time) != OK) {
+ if (mStream->getPresentationPosition(&position64, &time) != OK) {
return INVALID_OPERATION;
}
timestamp.mPosition[ExtendedTimestamp::LOCATION_KERNEL] = position64;
diff --git a/services/audioflinger/Android.mk b/services/audioflinger/Android.mk
index c89b732..0fd8cdd 100644
--- a/services/audioflinger/Android.mk
+++ b/services/audioflinger/Android.mk
@@ -27,11 +27,6 @@
AudioHwDevice.cpp \
AudioStreamOut.cpp \
SpdifStreamOut.cpp \
- StreamHalLocal.cpp \
- DeviceHalLocal.cpp \
- DevicesFactoryHalLocal.cpp \
- EffectHalLocal.cpp \
- EffectsFactoryHalLocal.cpp \
Effects.cpp \
AudioMixer.cpp.arm \
BufferProviders.cpp \
@@ -45,6 +40,7 @@
$(call include-path-for, audio-utils)
LOCAL_SHARED_LIBRARIES := \
+ libaudiohal \
libaudioresampler \
libaudiospdif \
libaudioutils \
@@ -55,9 +51,6 @@
libmedia \
libmediautils \
libnbaio \
- libhardware \
- libhardware_legacy \
- libeffects \
libpowermanager \
libserviceutility \
libsonic \
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 81f59de..6dfae52 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -31,6 +31,9 @@
#include <utils/Log.h>
#include <utils/Trace.h>
#include <binder/Parcel.h>
+#include <media/audiohal/DeviceHalInterface.h>
+#include <media/audiohal/DevicesFactoryHalInterface.h>
+#include <media/audiohal/EffectsFactoryHalInterface.h>
#include <memunreachable/memunreachable.h>
#include <utils/String16.h>
#include <utils/threads.h>
@@ -44,9 +47,6 @@
#include "AudioMixer.h"
#include "AudioFlinger.h"
-#include "DeviceHalInterface.h"
-#include "DevicesFactoryHalInterface.h"
-#include "EffectsFactoryHalInterface.h"
#include "ServiceUtilities.h"
#include <media/AudioResamplerPublic.h>
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index bf8aaf7..d64e8db 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -46,6 +46,7 @@
#include <hardware/audio.h>
#include <hardware/audio_policy.h>
+#include <media/audiohal/StreamHalInterface.h>
#include <media/AudioBufferProvider.h>
#include <media/ExtendedAudioBufferProvider.h>
@@ -58,7 +59,6 @@
#include "SpdifStreamOut.h"
#include "AudioHwDevice.h"
#include "LinearMap.h"
-#include "StreamHalInterface.h"
#include <powermanager/IPowerManager.h>
diff --git a/services/audioflinger/AudioHwDevice.h b/services/audioflinger/AudioHwDevice.h
index 54e1d59..995ac13 100644
--- a/services/audioflinger/AudioHwDevice.h
+++ b/services/audioflinger/AudioHwDevice.h
@@ -23,11 +23,10 @@
#include <sys/types.h>
#include <hardware/audio.h>
+#include <media/audiohal/DeviceHalInterface.h>
#include <utils/Errors.h>
#include <system/audio.h>
-#include "DeviceHalInterface.h"
-
namespace android {
class AudioStreamOut;
diff --git a/services/audioflinger/AudioStreamOut.cpp b/services/audioflinger/AudioStreamOut.cpp
index 5a07b7f..3b8bc32 100644
--- a/services/audioflinger/AudioStreamOut.cpp
+++ b/services/audioflinger/AudioStreamOut.cpp
@@ -19,13 +19,12 @@
//#define LOG_NDEBUG 0
#include <hardware/audio.h>
+#include <media/audiohal/DeviceHalInterface.h>
+#include <media/audiohal/StreamHalInterface.h>
#include <utils/Log.h>
#include "AudioHwDevice.h"
#include "AudioStreamOut.h"
-#include "DeviceHalInterface.h"
-#include "StreamHalInterface.h"
-
namespace android {
diff --git a/services/audioflinger/BufferProviders.cpp b/services/audioflinger/BufferProviders.cpp
index 204fa17..f3b817c 100644
--- a/services/audioflinger/BufferProviders.cpp
+++ b/services/audioflinger/BufferProviders.cpp
@@ -20,14 +20,14 @@
#include <audio_effects/effect_downmix.h>
#include <audio_utils/primitives.h>
#include <audio_utils/format.h>
+#include <media/audiohal/EffectHalInterface.h>
+#include <media/audiohal/EffectsFactoryHalInterface.h>
#include <media/AudioResamplerPublic.h>
#include <utils/Log.h>
#include "Configuration.h"
#include "BufferProviders.h"
-#include "EffectHalInterface.h"
-#include "EffectsFactoryHalInterface.h"
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp
index d4035d6..c523ec5 100644
--- a/services/audioflinger/Effects.cpp
+++ b/services/audioflinger/Effects.cpp
@@ -24,11 +24,10 @@
#include <audio_effects/effect_visualizer.h>
#include <audio_utils/primitives.h>
#include <private/media/AudioEffectShared.h>
-#include <media/EffectsFactoryApi.h>
+#include <media/audiohal/EffectHalInterface.h>
+#include <media/audiohal/EffectsFactoryHalInterface.h>
#include "AudioFlinger.h"
-#include "EffectHalInterface.h"
-#include "EffectsFactoryHalInterface.h"
#include "ServiceUtilities.h"
// ----------------------------------------------------------------------------
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 7675a12..3b05c48 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -73,9 +73,6 @@
#include "AutoPark.h"
-// FIXME: Remove after NBAIO is converted
-#include "StreamHalLocal.h"
-
// ----------------------------------------------------------------------------
// Note: the following macro is used for extremely verbose logging message. In
@@ -3618,8 +3615,7 @@
return;
}
// create an NBAIO sink for the HAL output stream, and negotiate
- mOutputSink = new AudioStreamOutSink(
- static_cast<StreamOutHalLocal*>(output->stream.get())->getStream());
+ mOutputSink = new AudioStreamOutSink(output->stream);
size_t numCounterOffers = 0;
const NBAIO_Format offers[1] = {Format_from_SR_C(mSampleRate, mChannelCount, mFormat)};
#if !LOG_NDEBUG
@@ -5926,8 +5922,7 @@
readInputParameters_l();
// create an NBAIO source for the HAL input stream, and negotiate
- mInputSource = new AudioStreamInSource(
- static_cast<StreamInHalLocal*>(input->stream.get())->getStream());
+ mInputSource = new AudioStreamInSource(input->stream);
size_t numCounterOffers = 0;
const NBAIO_Format offers[1] = {Format_from_SR_C(mSampleRate, mChannelCount, mFormat)};
#if !LOG_NDEBUG
diff --git a/services/audioflinger/tests/Android.mk b/services/audioflinger/tests/Android.mk
index bf94f71..75fc6f5 100644
--- a/services/audioflinger/tests/Android.mk
+++ b/services/audioflinger/tests/Android.mk
@@ -35,9 +35,7 @@
LOCAL_SRC_FILES:= \
test-mixer.cpp \
../AudioMixer.cpp.arm \
- ../BufferProviders.cpp \
- ../EffectHalLocal.cpp \
- ../EffectsFactoryHalLocal.cpp
+ ../BufferProviders.cpp
LOCAL_C_INCLUDES := \
$(call include-path-for, audio-effects) \
@@ -49,6 +47,7 @@
libsndfile
LOCAL_SHARED_LIBRARIES := \
+ libaudiohal \
libeffects \
libnbaio \
libaudioresampler \