Loading media/libaudiohal/Android.mk +17 −12 Original line number Diff line number Diff line Loading @@ -5,28 +5,35 @@ include $(CLEAR_VARS) LOCAL_SHARED_LIBRARIES := \ libcutils \ liblog \ libutils libutils \ libhardware LOCAL_SRC_FILES := \ DeviceHalLocal.cpp \ DevicesFactoryHalHybrid.cpp \ DevicesFactoryHalLocal.cpp \ StreamHalLocal.cpp LOCAL_CFLAGS := -Wall -Werror ifeq ($(USE_LEGACY_LOCAL_AUDIO_HAL), true) # Use audiohal directly w/o hwbinder middleware. # This is for performance comparison and debugging only. LOCAL_SRC_FILES := \ DeviceHalLocal.cpp \ DevicesFactoryHalLocal.cpp \ LOCAL_SRC_FILES += \ EffectBufferHalLocal.cpp \ EffectHalLocal.cpp \ EffectsFactoryHalLocal.cpp \ StreamHalLocal.cpp EffectHalLocal.cpp LOCAL_SHARED_LIBRARIES += \ libeffects \ libhardware libeffects LOCAL_CFLAGS += -DUSE_LEGACY_LOCAL_AUDIO_HAL else # if !USE_LEGACY_LOCAL_AUDIO_HAL LOCAL_SRC_FILES := \ LOCAL_SRC_FILES += \ ConversionHelperHidl.cpp \ HalDeathHandlerHidl.cpp \ DeviceHalHidl.cpp \ Loading Loading @@ -60,6 +67,4 @@ LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include LOCAL_MODULE := libaudiohal LOCAL_CFLAGS := -Wall -Werror include $(BUILD_SHARED_LIBRARY) media/libaudiohal/DevicesFactoryHalHidl.cpp +0 −5 Original line number Diff line number Diff line Loading @@ -33,11 +33,6 @@ using ::android::hardware::Return; namespace android { // static sp<DevicesFactoryHalInterface> DevicesFactoryHalInterface::create() { return new DevicesFactoryHalHidl(); } DevicesFactoryHalHidl::DevicesFactoryHalHidl() { mDevicesFactory = IDevicesFactory::getService(); if (mDevicesFactory != 0) { Loading media/libaudiohal/DevicesFactoryHalHidl.h +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ class DevicesFactoryHalHidl : public DevicesFactoryHalInterface virtual status_t openDevice(const char *name, sp<DeviceHalInterface> *device); private: friend class DevicesFactoryHalInterface; friend class DevicesFactoryHalHybrid; sp<IDevicesFactory> mDevicesFactory; Loading media/libaudiohal/DevicesFactoryHalHybrid.cpp 0 → 100644 +54 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "DevicesFactoryHalHybrid" //#define LOG_NDEBUG 0 #include "DevicesFactoryHalHybrid.h" #include "DevicesFactoryHalLocal.h" #ifndef USE_LEGACY_LOCAL_AUDIO_HAL #include "DevicesFactoryHalHidl.h" #endif namespace android { // static sp<DevicesFactoryHalInterface> DevicesFactoryHalInterface::create() { return new DevicesFactoryHalHybrid(); } DevicesFactoryHalHybrid::DevicesFactoryHalHybrid() : mLocalFactory(new DevicesFactoryHalLocal()), mHidlFactory( #ifdef USE_LEGACY_LOCAL_AUDIO_HAL nullptr #else new DevicesFactoryHalHidl() #endif ) { } DevicesFactoryHalHybrid::~DevicesFactoryHalHybrid() { } status_t DevicesFactoryHalHybrid::openDevice(const char *name, sp<DeviceHalInterface> *device) { if (mHidlFactory != 0 && strcmp(AUDIO_HARDWARE_MODULE_ID_A2DP, name) != 0) { return mHidlFactory->openDevice(name, device); } return mLocalFactory->openDevice(name, device); } } // namespace android media/libaudiohal/DevicesFactoryHalHybrid.h 0 → 100644 +47 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_HARDWARE_DEVICES_FACTORY_HAL_HYBRID_H #define ANDROID_HARDWARE_DEVICES_FACTORY_HAL_HYBRID_H #include <media/audiohal/DevicesFactoryHalInterface.h> #include <utils/Errors.h> #include <utils/RefBase.h> namespace android { class DevicesFactoryHalHybrid : public DevicesFactoryHalInterface { public: // Opens a device with the specified name. To close the device, it is // necessary to release references to the returned object. virtual status_t openDevice(const char *name, sp<DeviceHalInterface> *device); private: friend class DevicesFactoryHalInterface; // Can not be constructed directly by clients. DevicesFactoryHalHybrid(); virtual ~DevicesFactoryHalHybrid(); sp<DevicesFactoryHalInterface> mLocalFactory; sp<DevicesFactoryHalInterface> mHidlFactory; }; } // namespace android #endif // ANDROID_HARDWARE_DEVICES_FACTORY_HAL_HYBRID_H Loading
media/libaudiohal/Android.mk +17 −12 Original line number Diff line number Diff line Loading @@ -5,28 +5,35 @@ include $(CLEAR_VARS) LOCAL_SHARED_LIBRARIES := \ libcutils \ liblog \ libutils libutils \ libhardware LOCAL_SRC_FILES := \ DeviceHalLocal.cpp \ DevicesFactoryHalHybrid.cpp \ DevicesFactoryHalLocal.cpp \ StreamHalLocal.cpp LOCAL_CFLAGS := -Wall -Werror ifeq ($(USE_LEGACY_LOCAL_AUDIO_HAL), true) # Use audiohal directly w/o hwbinder middleware. # This is for performance comparison and debugging only. LOCAL_SRC_FILES := \ DeviceHalLocal.cpp \ DevicesFactoryHalLocal.cpp \ LOCAL_SRC_FILES += \ EffectBufferHalLocal.cpp \ EffectHalLocal.cpp \ EffectsFactoryHalLocal.cpp \ StreamHalLocal.cpp EffectHalLocal.cpp LOCAL_SHARED_LIBRARIES += \ libeffects \ libhardware libeffects LOCAL_CFLAGS += -DUSE_LEGACY_LOCAL_AUDIO_HAL else # if !USE_LEGACY_LOCAL_AUDIO_HAL LOCAL_SRC_FILES := \ LOCAL_SRC_FILES += \ ConversionHelperHidl.cpp \ HalDeathHandlerHidl.cpp \ DeviceHalHidl.cpp \ Loading Loading @@ -60,6 +67,4 @@ LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include LOCAL_MODULE := libaudiohal LOCAL_CFLAGS := -Wall -Werror include $(BUILD_SHARED_LIBRARY)
media/libaudiohal/DevicesFactoryHalHidl.cpp +0 −5 Original line number Diff line number Diff line Loading @@ -33,11 +33,6 @@ using ::android::hardware::Return; namespace android { // static sp<DevicesFactoryHalInterface> DevicesFactoryHalInterface::create() { return new DevicesFactoryHalHidl(); } DevicesFactoryHalHidl::DevicesFactoryHalHidl() { mDevicesFactory = IDevicesFactory::getService(); if (mDevicesFactory != 0) { Loading
media/libaudiohal/DevicesFactoryHalHidl.h +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ class DevicesFactoryHalHidl : public DevicesFactoryHalInterface virtual status_t openDevice(const char *name, sp<DeviceHalInterface> *device); private: friend class DevicesFactoryHalInterface; friend class DevicesFactoryHalHybrid; sp<IDevicesFactory> mDevicesFactory; Loading
media/libaudiohal/DevicesFactoryHalHybrid.cpp 0 → 100644 +54 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "DevicesFactoryHalHybrid" //#define LOG_NDEBUG 0 #include "DevicesFactoryHalHybrid.h" #include "DevicesFactoryHalLocal.h" #ifndef USE_LEGACY_LOCAL_AUDIO_HAL #include "DevicesFactoryHalHidl.h" #endif namespace android { // static sp<DevicesFactoryHalInterface> DevicesFactoryHalInterface::create() { return new DevicesFactoryHalHybrid(); } DevicesFactoryHalHybrid::DevicesFactoryHalHybrid() : mLocalFactory(new DevicesFactoryHalLocal()), mHidlFactory( #ifdef USE_LEGACY_LOCAL_AUDIO_HAL nullptr #else new DevicesFactoryHalHidl() #endif ) { } DevicesFactoryHalHybrid::~DevicesFactoryHalHybrid() { } status_t DevicesFactoryHalHybrid::openDevice(const char *name, sp<DeviceHalInterface> *device) { if (mHidlFactory != 0 && strcmp(AUDIO_HARDWARE_MODULE_ID_A2DP, name) != 0) { return mHidlFactory->openDevice(name, device); } return mLocalFactory->openDevice(name, device); } } // namespace android
media/libaudiohal/DevicesFactoryHalHybrid.h 0 → 100644 +47 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_HARDWARE_DEVICES_FACTORY_HAL_HYBRID_H #define ANDROID_HARDWARE_DEVICES_FACTORY_HAL_HYBRID_H #include <media/audiohal/DevicesFactoryHalInterface.h> #include <utils/Errors.h> #include <utils/RefBase.h> namespace android { class DevicesFactoryHalHybrid : public DevicesFactoryHalInterface { public: // Opens a device with the specified name. To close the device, it is // necessary to release references to the returned object. virtual status_t openDevice(const char *name, sp<DeviceHalInterface> *device); private: friend class DevicesFactoryHalInterface; // Can not be constructed directly by clients. DevicesFactoryHalHybrid(); virtual ~DevicesFactoryHalHybrid(); sp<DevicesFactoryHalInterface> mLocalFactory; sp<DevicesFactoryHalInterface> mHidlFactory; }; } // namespace android #endif // ANDROID_HARDWARE_DEVICES_FACTORY_HAL_HYBRID_H