Merge "Don't send short URB packet when sending MtpDataPacket." into nyc-mr2-dev
am: e3ebcffe41
Change-Id: Id8290878d7bc7f9ed5a70dd2b04471597467b787
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..53f8bec
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,20 @@
+ndk_headers {
+ name: "libcamera2ndk_headers",
+ from: "include/camera/ndk/",
+ to: "camera",
+ srcs: ["include/camera/ndk/**/*.h"],
+ license: "NOTICE",
+}
+
+ndk_headers {
+ name: "libmediandk_headers",
+ from: "include/ndk/",
+ to: "media",
+ srcs: ["include/ndk/**/*.h"],
+ license: "NOTICE",
+}
+
+subdirs = [
+ "camera/ndk",
+ "media/*",
+]
diff --git a/camera/Android.mk b/camera/Android.mk
index 1a3382f..c9c98e9 100644
--- a/camera/Android.mk
+++ b/camera/Android.mk
@@ -58,8 +58,6 @@
libutils \
liblog \
libbinder \
- libhardware \
- libui \
libgui \
libcamera_metadata \
diff --git a/camera/CameraBase.cpp b/camera/CameraBase.cpp
index 194e1d3..68e73f2 100644
--- a/camera/CameraBase.cpp
+++ b/camera/CameraBase.cpp
@@ -138,7 +138,7 @@
c->mStatus = NO_ERROR;
} else {
ALOGW("An error occurred while connecting to camera %d: %s", cameraId,
- (cs != nullptr) ? "Service not available" : ret.toString8().string());
+ (cs == nullptr) ? "Service not available" : ret.toString8().string());
c.clear();
}
return c;
diff --git a/camera/CameraUtils.cpp b/camera/CameraUtils.cpp
index 1676be1..67fc116 100644
--- a/camera/CameraUtils.cpp
+++ b/camera/CameraUtils.cpp
@@ -45,7 +45,7 @@
}
camera_metadata_ro_entry_t entryFacing = staticInfo.find(ANDROID_LENS_FACING);
- if (entry.count == 0) {
+ if (entryFacing.count == 0) {
ALOGE("%s: Can't find android.lens.facing in static metadata!", __FUNCTION__);
return INVALID_OPERATION;
}
diff --git a/camera/ICamera.cpp b/camera/ICamera.cpp
index 0680d7c..2bf956d 100644
--- a/camera/ICamera.cpp
+++ b/camera/ICamera.cpp
@@ -60,7 +60,7 @@
class BpCamera: public BpInterface<ICamera>
{
public:
- BpCamera(const sp<IBinder>& impl)
+ explicit BpCamera(const sp<IBinder>& impl)
: BpInterface<ICamera>(impl)
{
}
diff --git a/camera/ICameraClient.cpp b/camera/ICameraClient.cpp
index 68cbfb8..1b6fac4 100644
--- a/camera/ICameraClient.cpp
+++ b/camera/ICameraClient.cpp
@@ -37,7 +37,7 @@
class BpCameraClient: public BpInterface<ICameraClient>
{
public:
- BpCameraClient(const sp<IBinder>& impl)
+ explicit BpCameraClient(const sp<IBinder>& impl)
: BpInterface<ICameraClient>(impl)
{
}
diff --git a/camera/ICameraRecordingProxy.cpp b/camera/ICameraRecordingProxy.cpp
index 63c4b1d..c9f8b5c 100644
--- a/camera/ICameraRecordingProxy.cpp
+++ b/camera/ICameraRecordingProxy.cpp
@@ -38,7 +38,7 @@
class BpCameraRecordingProxy: public BpInterface<ICameraRecordingProxy>
{
public:
- BpCameraRecordingProxy(const sp<IBinder>& impl)
+ explicit BpCameraRecordingProxy(const sp<IBinder>& impl)
: BpInterface<ICameraRecordingProxy>(impl)
{
}
diff --git a/camera/ICameraRecordingProxyListener.cpp b/camera/ICameraRecordingProxyListener.cpp
index fa4dfd8..8529d3e 100644
--- a/camera/ICameraRecordingProxyListener.cpp
+++ b/camera/ICameraRecordingProxyListener.cpp
@@ -33,7 +33,7 @@
class BpCameraRecordingProxyListener: public BpInterface<ICameraRecordingProxyListener>
{
public:
- BpCameraRecordingProxyListener(const sp<IBinder>& impl)
+ explicit BpCameraRecordingProxyListener(const sp<IBinder>& impl)
: BpInterface<ICameraRecordingProxyListener>(impl)
{
}
diff --git a/camera/ICameraServiceProxy.cpp b/camera/ICameraServiceProxy.cpp
index 694e9c3..a9d0836 100644
--- a/camera/ICameraServiceProxy.cpp
+++ b/camera/ICameraServiceProxy.cpp
@@ -26,7 +26,8 @@
class BpCameraServiceProxy: public BpInterface<ICameraServiceProxy> {
public:
- BpCameraServiceProxy(const sp<IBinder>& impl) : BpInterface<ICameraServiceProxy>(impl) {}
+ explicit BpCameraServiceProxy(const sp<IBinder>& impl)
+ : BpInterface<ICameraServiceProxy>(impl) {}
virtual void pingForUserUpdate() {
Parcel data;
diff --git a/camera/VendorTagDescriptor.cpp b/camera/VendorTagDescriptor.cpp
index 02ece14..f3b3dbb 100644
--- a/camera/VendorTagDescriptor.cpp
+++ b/camera/VendorTagDescriptor.cpp
@@ -192,7 +192,7 @@
// Set up reverse mapping
for (size_t i = 0; i < static_cast<size_t>(tagCount); ++i) {
uint32_t tag = allTags[i];
- String8 sectionString = mSections[mTagToSectionMap.valueFor(tag)];
+ const String8& sectionString = mSections[mTagToSectionMap.valueFor(tag)];
ssize_t reverseIndex = -1;
if ((reverseIndex = mReverseMapping.indexOfKey(sectionString)) < 0) {
@@ -284,7 +284,7 @@
return &mSections;
}
-status_t VendorTagDescriptor::lookupTag(String8 name, String8 section, /*out*/uint32_t* tag) const {
+status_t VendorTagDescriptor::lookupTag(const String8& name, const String8& section, /*out*/uint32_t* tag) const {
ssize_t index = mReverseMapping.indexOfKey(section);
if (index < 0) {
ALOGE("%s: Section '%s' does not exist.", __FUNCTION__, section.string());
diff --git a/camera/cameraserver/Android.mk b/camera/cameraserver/Android.mk
index 7e36c5e..888862a 100644
--- a/camera/cameraserver/Android.mk
+++ b/camera/cameraserver/Android.mk
@@ -21,10 +21,10 @@
LOCAL_SHARED_LIBRARIES := \
libcameraservice \
+ liblog \
libcutils \
libutils \
libbinder \
- libcamera_client
LOCAL_MODULE:= cameraserver
LOCAL_32_BIT_ONLY := true
diff --git a/camera/ndk/Android.bp b/camera/ndk/Android.bp
new file mode 100644
index 0000000..c5fc646
--- /dev/null
+++ b/camera/ndk/Android.bp
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 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.
+
+// Headers module is in frameworks/av/Android.bp because modules are not allowed
+// to refer to headers in parent directories and the headers live in
+// frameworks/av/include.
+
+ndk_library {
+ name: "libcamera2ndk.ndk",
+ symbol_file: "libcamera2ndk.map.txt",
+ first_version: "24",
+ unversioned_until: "current",
+}
diff --git a/camera/ndk/NdkCaptureRequest.cpp b/camera/ndk/NdkCaptureRequest.cpp
index 77b9a33..7c37955 100644
--- a/camera/ndk/NdkCaptureRequest.cpp
+++ b/camera/ndk/NdkCaptureRequest.cpp
@@ -51,8 +51,13 @@
ACaptureRequest* req, const ACameraOutputTarget* target) {
ATRACE_CALL();
if (req == nullptr || req->targets == nullptr || target == nullptr) {
+ void* req_targets;
+ if (req != nullptr)
+ req_targets = req->targets;
+ else
+ req_targets = nullptr;
ALOGE("%s: Error: invalid input: req %p, req-targets %p, target %p",
- __FUNCTION__, req, req->targets, target);
+ __FUNCTION__, req, req_targets, target);
return ACAMERA_ERROR_INVALID_PARAMETER;
}
auto pair = req->targets->mOutputs.insert(*target);
@@ -67,8 +72,13 @@
ACaptureRequest* req, const ACameraOutputTarget* target) {
ATRACE_CALL();
if (req == nullptr || req->targets == nullptr || target == nullptr) {
+ void* req_targets;
+ if (req != nullptr)
+ req_targets = req->targets;
+ else
+ req_targets = nullptr;
ALOGE("%s: Error: invalid input: req %p, req-targets %p, target %p",
- __FUNCTION__, req, req->targets, target);
+ __FUNCTION__, req, req_targets, target);
return ACAMERA_ERROR_INVALID_PARAMETER;
}
req->targets->mOutputs.erase(*target);
diff --git a/camera/ndk/impl/ACameraCaptureSession.h b/camera/ndk/impl/ACameraCaptureSession.h
index 58428e6..f56219c 100644
--- a/camera/ndk/impl/ACameraCaptureSession.h
+++ b/camera/ndk/impl/ACameraCaptureSession.h
@@ -24,7 +24,7 @@
using namespace android;
struct ACaptureSessionOutput {
- ACaptureSessionOutput(ANativeWindow* window) : mWindow(window) {};
+ explicit ACaptureSessionOutput(ANativeWindow* window) : mWindow(window) {};
bool operator == (const ACaptureSessionOutput& other) const {
return mWindow == other.mWindow;
diff --git a/camera/ndk/impl/ACameraDevice.h b/camera/ndk/impl/ACameraDevice.h
index 71e364d..051462b 100644
--- a/camera/ndk/impl/ACameraDevice.h
+++ b/camera/ndk/impl/ACameraDevice.h
@@ -65,7 +65,7 @@
// Callbacks from camera service
class ServiceCallback : public hardware::camera2::BnCameraDeviceCallbacks {
public:
- ServiceCallback(CameraDevice* device) : mDevice(device) {}
+ explicit ServiceCallback(CameraDevice* device) : mDevice(device) {}
binder::Status onDeviceError(int32_t errorCode,
const CaptureResultExtras& resultExtras) override;
binder::Status onDeviceIdle() override;
diff --git a/camera/ndk/impl/ACameraManager.h b/camera/ndk/impl/ACameraManager.h
index 3f2262f..5b88904 100644
--- a/camera/ndk/impl/ACameraManager.h
+++ b/camera/ndk/impl/ACameraManager.h
@@ -60,7 +60,7 @@
class DeathNotifier : public IBinder::DeathRecipient {
public:
- DeathNotifier(CameraManagerGlobal* cm) : mCameraManager(cm) {}
+ explicit DeathNotifier(CameraManagerGlobal* cm) : mCameraManager(cm) {}
protected:
// IBinder::DeathRecipient implementation
virtual void binderDied(const wp<IBinder>& who);
@@ -71,7 +71,7 @@
class CameraServiceListener final : public hardware::BnCameraServiceListener {
public:
- CameraServiceListener(CameraManagerGlobal* cm) : mCameraManager(cm) {}
+ explicit CameraServiceListener(CameraManagerGlobal* cm) : mCameraManager(cm) {}
virtual binder::Status onStatusChanged(int32_t status, int32_t cameraId);
// Torch API not implemented yet
@@ -86,7 +86,7 @@
// Wrapper of ACameraManager_AvailabilityCallbacks so we can store it in std::set
struct Callback {
- Callback(const ACameraManager_AvailabilityCallbacks *callback) :
+ explicit Callback(const ACameraManager_AvailabilityCallbacks *callback) :
mAvailable(callback->onCameraAvailable),
mUnavailable(callback->onCameraUnavailable),
mContext(callback->context) {}
diff --git a/camera/ndk/impl/ACaptureRequest.h b/camera/ndk/impl/ACaptureRequest.h
index 6bd8406..3ef6a84 100644
--- a/camera/ndk/impl/ACaptureRequest.h
+++ b/camera/ndk/impl/ACaptureRequest.h
@@ -22,7 +22,7 @@
using namespace android;
struct ACameraOutputTarget {
- ACameraOutputTarget(ANativeWindow* window) : mWindow(window) {};
+ explicit ACameraOutputTarget(ANativeWindow* window) : mWindow(window) {};
bool operator == (const ACameraOutputTarget& other) const {
return mWindow == other.mWindow;
diff --git a/camera/ndk/libcamera2ndk.map.txt b/camera/ndk/libcamera2ndk.map.txt
new file mode 100644
index 0000000..41bb22b
--- /dev/null
+++ b/camera/ndk/libcamera2ndk.map.txt
@@ -0,0 +1,46 @@
+LIBCAMERA2NDK {
+ global:
+ ACameraCaptureSession_abortCaptures;
+ ACameraCaptureSession_capture;
+ ACameraCaptureSession_close;
+ ACameraCaptureSession_getDevice;
+ ACameraCaptureSession_setRepeatingRequest;
+ ACameraCaptureSession_stopRepeating;
+ ACameraDevice_close;
+ ACameraDevice_createCaptureRequest;
+ ACameraDevice_createCaptureSession;
+ ACameraDevice_getId;
+ ACameraManager_create;
+ ACameraManager_delete;
+ ACameraManager_deleteCameraIdList;
+ ACameraManager_getCameraCharacteristics;
+ ACameraManager_getCameraIdList;
+ ACameraManager_openCamera;
+ ACameraManager_registerAvailabilityCallback;
+ ACameraManager_unregisterAvailabilityCallback;
+ ACameraMetadata_copy;
+ ACameraMetadata_free;
+ ACameraMetadata_getAllTags;
+ ACameraMetadata_getConstEntry;
+ ACameraOutputTarget_create;
+ ACameraOutputTarget_free;
+ ACaptureRequest_addTarget;
+ ACaptureRequest_free;
+ ACaptureRequest_getAllTags;
+ ACaptureRequest_getConstEntry;
+ ACaptureRequest_removeTarget;
+ ACaptureRequest_setEntry_double;
+ ACaptureRequest_setEntry_float;
+ ACaptureRequest_setEntry_i32;
+ ACaptureRequest_setEntry_i64;
+ ACaptureRequest_setEntry_rational;
+ ACaptureRequest_setEntry_u8;
+ ACaptureSessionOutputContainer_add;
+ ACaptureSessionOutputContainer_create;
+ ACaptureSessionOutputContainer_free;
+ ACaptureSessionOutputContainer_remove;
+ ACaptureSessionOutput_create;
+ ACaptureSessionOutput_free;
+ local:
+ *;
+};
diff --git a/camera/tests/Android.mk b/camera/tests/Android.mk
index 8019999..0978a81 100644
--- a/camera/tests/Android.mk
+++ b/camera/tests/Android.mk
@@ -21,6 +21,7 @@
CameraBinderTests.cpp
LOCAL_SHARED_LIBRARIES := \
+ liblog \
libutils \
libcutils \
libcamera_metadata \
diff --git a/cmds/stagefright/Android.mk b/cmds/stagefright/Android.mk
index 9e15a81..f8c8d3d 100644
--- a/cmds/stagefright/Android.mk
+++ b/cmds/stagefright/Android.mk
@@ -134,7 +134,7 @@
LOCAL_SHARED_LIBRARIES := \
libstagefright liblog libutils libbinder libstagefright_foundation \
- libmedia libgui libcutils libui
+ libmedia libgui libcutils
LOCAL_C_INCLUDES:= \
frameworks/av/media/libstagefright \
@@ -159,7 +159,7 @@
LOCAL_SHARED_LIBRARIES := \
libstagefright liblog libutils libbinder libstagefright_foundation \
- libmedia libgui libcutils libui
+ libmedia libaudioclient libgui libcutils
LOCAL_C_INCLUDES:= \
frameworks/av/media/libstagefright \
@@ -193,7 +193,6 @@
libmedia \
libgui \
libcutils \
- libui \
libRScpp \
LOCAL_C_INCLUDES:= \
@@ -226,7 +225,7 @@
LOCAL_SHARED_LIBRARIES := \
libstagefright liblog libutils libbinder libstagefright_foundation \
- libmedia libgui libcutils libui libc
+ libcutils libc
LOCAL_C_INCLUDES:= \
frameworks/av/media/libstagefright \
diff --git a/cmds/stagefright/SimplePlayer.h b/cmds/stagefright/SimplePlayer.h
index ae9dfd2..0d8c74a 100644
--- a/cmds/stagefright/SimplePlayer.h
+++ b/cmds/stagefright/SimplePlayer.h
@@ -22,7 +22,7 @@
struct ABuffer;
struct ALooper;
-struct AudioTrack;
+class AudioTrack;
class IGraphicBufferProducer;
struct MediaCodec;
struct NuMediaExtractor;
diff --git a/cmds/stagefright/mediafilter.cpp b/cmds/stagefright/mediafilter.cpp
index 1183112..d829df0 100644
--- a/cmds/stagefright/mediafilter.cpp
+++ b/cmds/stagefright/mediafilter.cpp
@@ -69,7 +69,7 @@
namespace android {
struct SaturationRSFilter : RenderScriptWrapper::RSFilterCallback {
- void init(RSC::sp<RSC::RS> context) {
+ void init(const RSC::sp<RSC::RS> &context) {
mScript = new ScriptC_saturation(context);
mScript->set_gSaturation(3.f);
}
@@ -90,7 +90,7 @@
};
struct NightVisionRSFilter : RenderScriptWrapper::RSFilterCallback {
- void init(RSC::sp<RSC::RS> context) {
+ void init(const RSC::sp<RSC::RS> &context) {
mScript = new ScriptC_nightvision(context);
}
@@ -110,7 +110,7 @@
};
struct ARGBToRGBARSFilter : RenderScriptWrapper::RSFilterCallback {
- void init(RSC::sp<RSC::RS> context) {
+ void init(const RSC::sp<RSC::RS> &context) {
mScript = new ScriptC_argbtorgba(context);
}
diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp
index ca68722..2bb35cb 100644
--- a/cmds/stagefright/stagefright.cpp
+++ b/cmds/stagefright/stagefright.cpp
@@ -401,7 +401,7 @@
////////////////////////////////////////////////////////////////////////////////
struct DetectSyncSource : public MediaSource {
- DetectSyncSource(const sp<IMediaSource> &source);
+ explicit DetectSyncSource(const sp<IMediaSource> &source);
virtual status_t start(MetaData *params = NULL);
virtual status_t stop();
diff --git a/cmds/stagefright/stream.cpp b/cmds/stagefright/stream.cpp
index bca3832..16ff39d 100644
--- a/cmds/stagefright/stream.cpp
+++ b/cmds/stagefright/stream.cpp
@@ -45,7 +45,7 @@
struct MyStreamSource : public BnStreamSource {
// Object assumes ownership of fd.
- MyStreamSource(int fd);
+ explicit MyStreamSource(int fd);
virtual void setListener(const sp<IStreamListener> &listener);
virtual void setBuffers(const Vector<sp<IMemory> > &buffers);
@@ -125,7 +125,7 @@
////////////////////////////////////////////////////////////////////////////////
struct MyConvertingStreamSource : public BnStreamSource {
- MyConvertingStreamSource(const char *filename);
+ explicit MyConvertingStreamSource(const char *filename);
virtual void setListener(const sp<IStreamListener> &listener);
virtual void setBuffers(const Vector<sp<IMemory> > &buffers);
diff --git a/drm/common/Android.mk b/drm/common/Android.mk
index db67534..ca3d2cd 100644
--- a/drm/common/Android.mk
+++ b/drm/common/Android.mk
@@ -31,6 +31,8 @@
DrmInfoEvent.cpp \
ReadWriteUtils.cpp
+LOCAL_STATIC_LIBRARIES := libbinder
+
LOCAL_C_INCLUDES := \
$(TOP)/frameworks/av/include \
$(TOP)/frameworks/av/drm/libdrmframework/include \
diff --git a/drm/common/DrmInfoEvent.cpp b/drm/common/DrmInfoEvent.cpp
index 27a5a2d..703e363 100644
--- a/drm/common/DrmInfoEvent.cpp
+++ b/drm/common/DrmInfoEvent.cpp
@@ -19,7 +19,7 @@
using namespace android;
-DrmInfoEvent::DrmInfoEvent(int uniqueId, int infoType, const String8 message)
+DrmInfoEvent::DrmInfoEvent(int uniqueId, int infoType, const String8 &message)
: mUniqueId(uniqueId),
mInfoType(infoType),
mMessage(message) {
diff --git a/drm/common/IDrmManagerService.cpp b/drm/common/IDrmManagerService.cpp
index caae75f..44f98dd 100644
--- a/drm/common/IDrmManagerService.cpp
+++ b/drm/common/IDrmManagerService.cpp
@@ -33,7 +33,7 @@
#include "IDrmManagerService.h"
-#define INVALID_BUFFER_LENGTH -1
+#define INVALID_BUFFER_LENGTH (-1)
#define MAX_BINDER_TRANSACTION_SIZE ((1*1024*1024)-(4096*2))
using namespace android;
diff --git a/drm/common/ReadWriteUtils.cpp b/drm/common/ReadWriteUtils.cpp
index d696f16..16b5b34 100644
--- a/drm/common/ReadWriteUtils.cpp
+++ b/drm/common/ReadWriteUtils.cpp
@@ -30,7 +30,7 @@
using namespace android;
-#define FAILURE -1
+#define FAILURE (-1)
String8 ReadWriteUtils::readBytes(const String8& filePath) {
FILE* file = NULL;
diff --git a/drm/drmserver/DrmManager.cpp b/drm/drmserver/DrmManager.cpp
index e168ba2..1d835f9 100644
--- a/drm/drmserver/DrmManager.cpp
+++ b/drm/drmserver/DrmManager.cpp
@@ -33,7 +33,7 @@
#include "DrmManager.h"
#include "ReadWriteUtils.h"
-#define DECRYPT_FILE_ERROR -1
+#define DECRYPT_FILE_ERROR (-1)
using namespace android;
@@ -413,7 +413,7 @@
handle->decryptId = mDecryptSessionId + 1;
for (size_t index = 0; index < plugInIdList.size(); index++) {
- String8 plugInId = plugInIdList.itemAt(index);
+ const String8& plugInId = plugInIdList.itemAt(index);
IDrmEngine& rDrmEngine = mPlugInManager.getPlugIn(plugInId);
result = rDrmEngine.openDecryptSession(uniqueId, handle, fd, offset, length, mime);
@@ -441,7 +441,7 @@
handle->decryptId = mDecryptSessionId + 1;
for (size_t index = 0; index < plugInIdList.size(); index++) {
- String8 plugInId = plugInIdList.itemAt(index);
+ const String8& plugInId = plugInIdList.itemAt(index);
IDrmEngine& rDrmEngine = mPlugInManager.getPlugIn(plugInId);
result = rDrmEngine.openDecryptSession(uniqueId, handle, uri, mime);
@@ -470,7 +470,7 @@
handle->decryptId = mDecryptSessionId + 1;
for (size_t index = 0; index < plugInIdList.size(); index++) {
- String8 plugInId = plugInIdList.itemAt(index);
+ const String8& plugInId = plugInIdList.itemAt(index);
IDrmEngine& rDrmEngine = mPlugInManager.getPlugIn(plugInId);
result = rDrmEngine.openDecryptSession(uniqueId, handle, buf, mimeType);
diff --git a/drm/libdrmframework/DrmManagerClientImpl.cpp b/drm/libdrmframework/DrmManagerClientImpl.cpp
index cbd013e..c047eb1 100644
--- a/drm/libdrmframework/DrmManagerClientImpl.cpp
+++ b/drm/libdrmframework/DrmManagerClientImpl.cpp
@@ -28,7 +28,7 @@
using namespace android;
-#define INVALID_VALUE -1
+#define INVALID_VALUE (-1)
Mutex DrmManagerClientImpl::sMutex;
sp<IDrmManagerService> DrmManagerClientImpl::sDrmManagerService;
diff --git a/drm/libdrmframework/include/IDrmManagerService.h b/drm/libdrmframework/include/IDrmManagerService.h
index fe55650..0376b49 100644
--- a/drm/libdrmframework/include/IDrmManagerService.h
+++ b/drm/libdrmframework/include/IDrmManagerService.h
@@ -169,7 +169,7 @@
class BpDrmManagerService: public BpInterface<IDrmManagerService>
{
public:
- BpDrmManagerService(const sp<IBinder>& impl)
+ explicit BpDrmManagerService(const sp<IBinder>& impl)
: BpInterface<IDrmManagerService>(impl) {}
virtual int addUniqueId(bool isNative);
diff --git a/drm/libdrmframework/include/IDrmServiceListener.h b/drm/libdrmframework/include/IDrmServiceListener.h
index 7f7109f..78c5d1a 100644
--- a/drm/libdrmframework/include/IDrmServiceListener.h
+++ b/drm/libdrmframework/include/IDrmServiceListener.h
@@ -49,7 +49,7 @@
class BpDrmServiceListener: public BpInterface<IDrmServiceListener>
{
public:
- BpDrmServiceListener(const sp<IBinder>& impl)
+ explicit BpDrmServiceListener(const sp<IBinder>& impl)
: BpInterface<IDrmServiceListener>(impl) {}
virtual status_t notify(const DrmInfoEvent& event);
diff --git a/drm/libdrmframework/plugins/common/util/src/MimeTypeUtil.cpp b/drm/libdrmframework/plugins/common/util/src/MimeTypeUtil.cpp
index 4bd1adb..3b1566f 100644
--- a/drm/libdrmframework/plugins/common/util/src/MimeTypeUtil.cpp
+++ b/drm/libdrmframework/plugins/common/util/src/MimeTypeUtil.cpp
@@ -115,7 +115,7 @@
* replacement mimetype otherwise the original mimetype
* is returned.
*
- * If the mimetype is of unsupported group i.e. application / *
+ * If the mimetype is of unsupported group i.e. application/...
* then "unsupported/drm.mimetype" will be returned.
*
* @param mimeType - mimetype in lower case to convert.
diff --git a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/include/FwdLockEngine.h b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/include/FwdLockEngine.h
index a31b951..d222703 100644
--- a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/include/FwdLockEngine.h
+++ b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/include/FwdLockEngine.h
@@ -539,7 +539,7 @@
offset = 0;
}
- DecodeSession(int fd) {
+ explicit DecodeSession(int fd) {
fileDesc = fd;
offset = 0;
}
diff --git a/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp b/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
index 084e323..7f5b0ec 100644
--- a/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
+++ b/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
@@ -52,12 +52,12 @@
}
-DrmMetadata* DrmPassthruPlugIn::onGetMetadata(int uniqueId, const String8* path) {
+DrmMetadata* DrmPassthruPlugIn::onGetMetadata(int /*uniqueId*/, const String8* /*path*/) {
return NULL;
}
DrmConstraints* DrmPassthruPlugIn::onGetConstraints(
- int uniqueId, const String8* path, int action) {
+ int uniqueId, const String8* /*path*/, int /*action*/) {
ALOGV("DrmPassthruPlugIn::onGetConstraints From Path: %d", uniqueId);
DrmConstraints* drmConstraints = new DrmConstraints();
@@ -108,7 +108,7 @@
}
status_t DrmPassthruPlugIn::onSetOnInfoListener(
- int uniqueId, const IDrmEngine::OnInfoListener* infoListener) {
+ int uniqueId, const IDrmEngine::OnInfoListener* /*infoListener*/) {
ALOGV("DrmPassthruPlugIn::onSetOnInfoListener : %d", uniqueId);
return DRM_NO_ERROR;
}
@@ -135,8 +135,8 @@
return drmSupportInfo;
}
-status_t DrmPassthruPlugIn::onSaveRights(int uniqueId, const DrmRights& drmRights,
- const String8& rightsPath, const String8& contentPath) {
+status_t DrmPassthruPlugIn::onSaveRights(int uniqueId, const DrmRights& /*drmRights*/,
+ const String8& /*rightsPath*/, const String8& /*contentPath*/) {
ALOGV("DrmPassthruPlugIn::onSaveRights : %d", uniqueId);
return DRM_NO_ERROR;
}
@@ -157,49 +157,50 @@
return drmInfo;
}
-bool DrmPassthruPlugIn::onCanHandle(int uniqueId, const String8& path) {
+bool DrmPassthruPlugIn::onCanHandle(int /*uniqueId*/, const String8& path) {
ALOGV("DrmPassthruPlugIn::canHandle: %s ", path.string());
String8 extension = path.getPathExtension();
extension.toLower();
return (String8(".passthru") == extension);
}
-String8 DrmPassthruPlugIn::onGetOriginalMimeType(int uniqueId, const String8& path, int fd) {
+String8 DrmPassthruPlugIn::onGetOriginalMimeType(int uniqueId,
+ const String8& /*path*/, int /*fd*/) {
ALOGV("DrmPassthruPlugIn::onGetOriginalMimeType() : %d", uniqueId);
return String8("video/passthru");
}
int DrmPassthruPlugIn::onGetDrmObjectType(
- int uniqueId, const String8& path, const String8& mimeType) {
+ int uniqueId, const String8& /*path*/, const String8& /*mimeType*/) {
ALOGV("DrmPassthruPlugIn::onGetDrmObjectType() : %d", uniqueId);
return DrmObjectType::UNKNOWN;
}
-int DrmPassthruPlugIn::onCheckRightsStatus(int uniqueId, const String8& path, int action) {
+int DrmPassthruPlugIn::onCheckRightsStatus(int uniqueId, const String8& /*path*/, int /*action*/) {
ALOGV("DrmPassthruPlugIn::onCheckRightsStatus() : %d", uniqueId);
int rightsStatus = RightsStatus::RIGHTS_VALID;
return rightsStatus;
}
-status_t DrmPassthruPlugIn::onConsumeRights(int uniqueId, DecryptHandle* decryptHandle,
- int action, bool reserve) {
+status_t DrmPassthruPlugIn::onConsumeRights(int uniqueId,
+ DecryptHandle* /*decryptHandle*/, int /*action*/, bool /*reserve*/) {
ALOGV("DrmPassthruPlugIn::onConsumeRights() : %d", uniqueId);
return DRM_NO_ERROR;
}
-status_t DrmPassthruPlugIn::onSetPlaybackStatus(int uniqueId, DecryptHandle* decryptHandle,
- int playbackStatus, int64_t position) {
+status_t DrmPassthruPlugIn::onSetPlaybackStatus(int uniqueId,
+ DecryptHandle* /*decryptHandle*/, int /*playbackStatus*/, int64_t /*position*/) {
ALOGV("DrmPassthruPlugIn::onSetPlaybackStatus() : %d", uniqueId);
return DRM_NO_ERROR;
}
-bool DrmPassthruPlugIn::onValidateAction(int uniqueId, const String8& path,
- int action, const ActionDescription& description) {
+bool DrmPassthruPlugIn::onValidateAction(int uniqueId,
+ const String8& /*path*/, int /*action*/, const ActionDescription& /*description*/) {
ALOGV("DrmPassthruPlugIn::onValidateAction() : %d", uniqueId);
return true;
}
-status_t DrmPassthruPlugIn::onRemoveRights(int uniqueId, const String8& path) {
+status_t DrmPassthruPlugIn::onRemoveRights(int uniqueId, const String8& /*path*/) {
ALOGV("DrmPassthruPlugIn::onRemoveRights() : %d", uniqueId);
return DRM_NO_ERROR;
}
@@ -209,13 +210,13 @@
return DRM_NO_ERROR;
}
-status_t DrmPassthruPlugIn::onOpenConvertSession(int uniqueId, int convertId) {
+status_t DrmPassthruPlugIn::onOpenConvertSession(int uniqueId, int /*convertId*/) {
ALOGV("DrmPassthruPlugIn::onOpenConvertSession() : %d", uniqueId);
return DRM_NO_ERROR;
}
DrmConvertedStatus* DrmPassthruPlugIn::onConvertData(
- int uniqueId, int convertId, const DrmBuffer* inputData) {
+ int uniqueId, int /*convertId*/, const DrmBuffer* inputData) {
ALOGV("DrmPassthruPlugIn::onConvertData() : %d", uniqueId);
DrmBuffer* convertedData = NULL;
@@ -229,13 +230,13 @@
return new DrmConvertedStatus(DrmConvertedStatus::STATUS_OK, convertedData, 0 /*offset*/);
}
-DrmConvertedStatus* DrmPassthruPlugIn::onCloseConvertSession(int uniqueId, int convertId) {
+DrmConvertedStatus* DrmPassthruPlugIn::onCloseConvertSession(int uniqueId, int /*convertId*/) {
ALOGV("DrmPassthruPlugIn::onCloseConvertSession() : %d", uniqueId);
return new DrmConvertedStatus(DrmConvertedStatus::STATUS_OK, NULL, 0 /*offset*/);
}
status_t DrmPassthruPlugIn::onOpenDecryptSession(
- int uniqueId, DecryptHandle* decryptHandle, int fd, off64_t offset, off64_t length) {
+ int uniqueId, DecryptHandle* decryptHandle, int /*fd*/, off64_t /*offset*/, off64_t /*length*/) {
ALOGV("DrmPassthruPlugIn::onOpenDecryptSession() : %d", uniqueId);
#ifdef ENABLE_PASSTHRU_DECRYPTION
@@ -250,7 +251,7 @@
}
status_t DrmPassthruPlugIn::onOpenDecryptSession(
- int uniqueId, DecryptHandle* decryptHandle, const char* uri) {
+ int /*uniqueId*/, DecryptHandle* /*decryptHandle*/, const char* /*uri*/) {
return DRM_ERROR_CANNOT_HANDLE;
}
@@ -265,14 +266,14 @@
return DRM_NO_ERROR;
}
-status_t DrmPassthruPlugIn::onInitializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle,
- int decryptUnitId, const DrmBuffer* headerInfo) {
+status_t DrmPassthruPlugIn::onInitializeDecryptUnit(int uniqueId, DecryptHandle* /*decryptHandle*/,
+ int /*decryptUnitId*/, const DrmBuffer* /*headerInfo*/) {
ALOGV("DrmPassthruPlugIn::onInitializeDecryptUnit() : %d", uniqueId);
return DRM_NO_ERROR;
}
-status_t DrmPassthruPlugIn::onDecrypt(int uniqueId, DecryptHandle* decryptHandle,
- int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) {
+status_t DrmPassthruPlugIn::onDecrypt(int uniqueId, DecryptHandle* /*decryptHandle*/,
+ int /*decryptUnitId*/, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* /*IV*/) {
ALOGV("DrmPassthruPlugIn::onDecrypt() : %d", uniqueId);
/**
* As a workaround implementation passthru would copy the given
@@ -293,13 +294,13 @@
}
status_t DrmPassthruPlugIn::onFinalizeDecryptUnit(
- int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) {
+ int uniqueId, DecryptHandle* /*decryptHandle*/, int /*decryptUnitId*/) {
ALOGV("DrmPassthruPlugIn::onFinalizeDecryptUnit() : %d", uniqueId);
return DRM_NO_ERROR;
}
-ssize_t DrmPassthruPlugIn::onPread(int uniqueId, DecryptHandle* decryptHandle,
- void* buffer, ssize_t numBytes, off64_t offset) {
+ssize_t DrmPassthruPlugIn::onPread(int uniqueId, DecryptHandle* /*decryptHandle*/,
+ void* /*buffer*/, ssize_t /*numBytes*/, off64_t /*offset*/) {
ALOGV("DrmPassthruPlugIn::onPread() : %d", uniqueId);
return 0;
}
diff --git a/drm/libmediadrm/Android.mk b/drm/libmediadrm/Android.mk
index 6a2ed31..3be1d60 100644
--- a/drm/libmediadrm/Android.mk
+++ b/drm/libmediadrm/Android.mk
@@ -14,18 +14,13 @@
LOCAL_SHARED_LIBRARIES := \
libbinder \
- libcrypto \
libcutils \
libdl \
liblog \
libmedia \
libstagefright \
- libstagefright_foundation \
libutils
-LOCAL_C_INCLUDES := \
- libcore/include
-
LOCAL_CFLAGS += -Werror -Wno-error=deprecated-declarations -Wall
LOCAL_CLANG := true
diff --git a/drm/libmediadrm/Drm.cpp b/drm/libmediadrm/Drm.cpp
index 7c1f5c8..9ab08db 100644
--- a/drm/libmediadrm/Drm.cpp
+++ b/drm/libmediadrm/Drm.cpp
@@ -61,7 +61,7 @@
}
struct DrmSessionClient : public DrmSessionClientInterface {
- DrmSessionClient(Drm* drm) : mDrm(drm) {}
+ explicit DrmSessionClient(Drm* drm) : mDrm(drm) {}
virtual bool reclaimSession(const Vector<uint8_t>& sessionId) {
sp<Drm> drm = mDrm.promote();
diff --git a/drm/libmediadrm/DrmSessionManager.cpp b/drm/libmediadrm/DrmSessionManager.cpp
index a87fb9d..02270d0 100644
--- a/drm/libmediadrm/DrmSessionManager.cpp
+++ b/drm/libmediadrm/DrmSessionManager.cpp
@@ -65,7 +65,7 @@
DrmSessionManager::~DrmSessionManager() {}
void DrmSessionManager::addSession(
- int pid, sp<DrmSessionClientInterface> drm, const Vector<uint8_t> &sessionId) {
+ int pid, const sp<DrmSessionClientInterface>& drm, const Vector<uint8_t> &sessionId) {
ALOGV("addSession(pid %d, drm %p, sessionId %s)", pid, drm.get(),
GetSessionIdString(sessionId).string());
@@ -116,7 +116,7 @@
}
}
-void DrmSessionManager::removeDrm(sp<DrmSessionClientInterface> drm) {
+void DrmSessionManager::removeDrm(const sp<DrmSessionClientInterface>& drm) {
ALOGV("removeDrm(%p)", drm.get());
Mutex::Autolock lock(mLock);
diff --git a/drm/mediadrm/plugins/clearkey/CryptoPlugin.h b/drm/mediadrm/plugins/clearkey/CryptoPlugin.h
index de84c36..a6d2f7b 100644
--- a/drm/mediadrm/plugins/clearkey/CryptoPlugin.h
+++ b/drm/mediadrm/plugins/clearkey/CryptoPlugin.h
@@ -31,7 +31,7 @@
class CryptoPlugin : public android::CryptoPlugin {
public:
- CryptoPlugin(const android::Vector<uint8_t>& sessionId) {
+ explicit CryptoPlugin(const android::Vector<uint8_t>& sessionId) {
mInitStatus = setMediaDrmSession(sessionId);
}
diff --git a/drm/mediadrm/plugins/clearkey/DrmPlugin.h b/drm/mediadrm/plugins/clearkey/DrmPlugin.h
index efb9f8b..c4d934e 100644
--- a/drm/mediadrm/plugins/clearkey/DrmPlugin.h
+++ b/drm/mediadrm/plugins/clearkey/DrmPlugin.h
@@ -39,7 +39,7 @@
class DrmPlugin : public android::DrmPlugin {
public:
- DrmPlugin(SessionLibrary* sessionLibrary)
+ explicit DrmPlugin(SessionLibrary* sessionLibrary)
: mSessionLibrary(sessionLibrary) {}
virtual ~DrmPlugin() {}
diff --git a/drm/mediadrm/plugins/mock/MockDrmCryptoPlugin.cpp b/drm/mediadrm/plugins/mock/MockDrmCryptoPlugin.cpp
index 1e80f8e..a38cca9 100644
--- a/drm/mediadrm/plugins/mock/MockDrmCryptoPlugin.cpp
+++ b/drm/mediadrm/plugins/mock/MockDrmCryptoPlugin.cpp
@@ -766,7 +766,7 @@
return result;
}
- String8 MockDrmPlugin::stringMapToString(KeyedVector<String8, String8> map) const
+ String8 MockDrmPlugin::stringMapToString(const KeyedVector<String8, String8>& map) const
{
String8 result("{ ");
for (size_t i = 0; i < map.size(); i++) {
diff --git a/drm/mediadrm/plugins/mock/MockDrmCryptoPlugin.h b/drm/mediadrm/plugins/mock/MockDrmCryptoPlugin.h
index 40d4e84..98bdd69 100644
--- a/drm/mediadrm/plugins/mock/MockDrmCryptoPlugin.h
+++ b/drm/mediadrm/plugins/mock/MockDrmCryptoPlugin.h
@@ -138,7 +138,7 @@
private:
String8 vectorToString(Vector<uint8_t> const &vector) const;
String8 arrayToString(uint8_t const *array, size_t len) const;
- String8 stringMapToString(KeyedVector<String8, String8> map) const;
+ String8 stringMapToString(const KeyedVector<String8, String8>& map) const;
SortedVector<Vector<uint8_t> > mSessions;
SortedVector<Vector<uint8_t> > mKeySets;
diff --git a/include/camera/Camera.h b/include/camera/Camera.h
index be793a2..57dc228 100644
--- a/include/camera/Camera.h
+++ b/include/camera/Camera.h
@@ -170,7 +170,7 @@
class RecordingProxy : public BnCameraRecordingProxy
{
public:
- RecordingProxy(const sp<Camera>& camera);
+ explicit RecordingProxy(const sp<Camera>& camera);
// ICameraRecordingProxy interface
virtual status_t startRecording(const sp<ICameraRecordingProxyListener>& listener);
@@ -183,7 +183,7 @@
};
protected:
- Camera(int cameraId);
+ explicit Camera(int cameraId);
Camera(const Camera&);
Camera& operator=(const Camera);
diff --git a/include/camera/CameraParameters2.h b/include/camera/CameraParameters2.h
index 88ad812..f691cd6 100644
--- a/include/camera/CameraParameters2.h
+++ b/include/camera/CameraParameters2.h
@@ -151,7 +151,7 @@
}
ssize_t removeItem(const KeyT& key) {
- size_t vectorIdx = (size_t) indexOfKey(key);
+ ssize_t vectorIdx = indexOfKey(key);
if (vectorIdx < 0) {
return vectorIdx;
diff --git a/include/camera/VendorTagDescriptor.h b/include/camera/VendorTagDescriptor.h
index 60e2d2d..bfc8c96 100644
--- a/include/camera/VendorTagDescriptor.h
+++ b/include/camera/VendorTagDescriptor.h
@@ -91,7 +91,7 @@
*
* Returns OK on success, or a negative error code.
*/
- status_t lookupTag(String8 name, String8 section, /*out*/uint32_t* tag) const;
+ status_t lookupTag(const String8& name, const String8& section, /*out*/uint32_t* tag) const;
/**
* Dump the currently configured vendor tags to a file descriptor.
diff --git a/include/camera/ndk/NdkCameraCaptureSession.h b/include/camera/ndk/NdkCameraCaptureSession.h
index 7b314e9..d96f538 100644
--- a/include/camera/ndk/NdkCameraCaptureSession.h
+++ b/include/camera/ndk/NdkCameraCaptureSession.h
@@ -32,6 +32,8 @@
* Do not reference types that are not part of the NDK.
* Do not #include files that aren't part of the NDK.
*/
+#include <sys/cdefs.h>
+
#include <android/native_window.h>
#include "NdkCameraError.h"
#include "NdkCameraMetadata.h"
@@ -39,9 +41,9 @@
#ifndef _NDK_CAMERA_CAPTURE_SESSION_H
#define _NDK_CAMERA_CAPTURE_SESSION_H
-#ifdef __cplusplus
-extern "C" {
-#endif
+__BEGIN_DECLS
+
+#if __ANDROID_API__ >= 24
/**
* ACameraCaptureSession is an opaque type that manages frame captures of a camera device.
@@ -587,11 +589,10 @@
*/
camera_status_t ACameraCaptureSession_abortCaptures(ACameraCaptureSession* session);
+#endif /* __ANDROID_API__ >= 24 */
-#ifdef __cplusplus
-} // extern "C"
-#endif
+__END_DECLS
-#endif // _NDK_CAMERA_CAPTURE_SESSION_H
+#endif /* _NDK_CAMERA_CAPTURE_SESSION_H */
/** @} */
diff --git a/include/camera/ndk/NdkCameraDevice.h b/include/camera/ndk/NdkCameraDevice.h
index 9011cb6..9b7f6f4 100644
--- a/include/camera/ndk/NdkCameraDevice.h
+++ b/include/camera/ndk/NdkCameraDevice.h
@@ -32,6 +32,7 @@
* Do not reference types that are not part of the NDK.
* Do not #include files that aren't part of the NDK.
*/
+#include <sys/cdefs.h>
#include <android/native_window.h>
#include "NdkCameraError.h"
@@ -41,9 +42,9 @@
#ifndef _NDK_CAMERA_DEVICE_H
#define _NDK_CAMERA_DEVICE_H
-#ifdef __cplusplus
-extern "C" {
-#endif
+__BEGIN_DECLS
+
+#if __ANDROID_API__ >= 24
/**
* ACameraDevice is opaque type that provides access to a camera device.
@@ -658,11 +659,11 @@
const ACameraCaptureSession_stateCallbacks* callbacks,
/*out*/ACameraCaptureSession** session);
-#ifdef __cplusplus
-} // extern "C"
-#endif
+#endif /* __ANDROID_API__ >= 24 */
-#endif // _NDK_CAMERA_DEVICE_H
+__END_DECLS
+
+#endif /* _NDK_CAMERA_DEVICE_H */
/** @} */
diff --git a/include/camera/ndk/NdkCameraError.h b/include/camera/ndk/NdkCameraError.h
index 36251fc..6b58155 100644
--- a/include/camera/ndk/NdkCameraError.h
+++ b/include/camera/ndk/NdkCameraError.h
@@ -36,9 +36,11 @@
#ifndef _NDK_CAMERA_ERROR_H
#define _NDK_CAMERA_ERROR_H
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
+#if __ANDROID_API__ >= 24
typedef enum {
ACAMERA_OK = 0,
@@ -130,11 +132,10 @@
ACAMERA_ERROR_PERMISSION_DENIED = ACAMERA_ERROR_BASE - 13,
} camera_status_t;
+#endif /* __ANDROID_API__ >= 24 */
-#ifdef __cplusplus
-} // extern "C"
-#endif
+__END_DECLS
-#endif // _NDK_CAMERA_ERROR_H
+#endif /* _NDK_CAMERA_ERROR_H */
/** @} */
diff --git a/include/camera/ndk/NdkCameraManager.h b/include/camera/ndk/NdkCameraManager.h
index 9188e94..5b5c98b 100644
--- a/include/camera/ndk/NdkCameraManager.h
+++ b/include/camera/ndk/NdkCameraManager.h
@@ -36,13 +36,15 @@
#ifndef _NDK_CAMERA_MANAGER_H
#define _NDK_CAMERA_MANAGER_H
+#include <sys/cdefs.h>
+
#include "NdkCameraError.h"
#include "NdkCameraMetadata.h"
#include "NdkCameraDevice.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+__BEGIN_DECLS
+
+#if __ANDROID_API__ >= 24
/**
* ACameraManager is opaque type that provides access to camera service.
@@ -271,10 +273,10 @@
ACameraDevice_StateCallbacks* callback,
/*out*/ACameraDevice** device);
-#ifdef __cplusplus
-} // extern "C"
-#endif
+#endif /* __ANDROID_API__ >= 24 */
-#endif //_NDK_CAMERA_MANAGER_H
+__END_DECLS
+
+#endif /* _NDK_CAMERA_MANAGER_H */
/** @} */
diff --git a/include/camera/ndk/NdkCameraMetadata.h b/include/camera/ndk/NdkCameraMetadata.h
index d929854..f2aec98 100644
--- a/include/camera/ndk/NdkCameraMetadata.h
+++ b/include/camera/ndk/NdkCameraMetadata.h
@@ -36,12 +36,14 @@
#ifndef _NDK_CAMERA_METADATA_H
#define _NDK_CAMERA_METADATA_H
+#include <sys/cdefs.h>
+
#include "NdkCameraError.h"
#include "NdkCameraMetadataTags.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+__BEGIN_DECLS
+
+#if __ANDROID_API__ >= 24
/**
* ACameraMetadata is opaque type that provides access to read-only camera metadata like camera
@@ -226,10 +228,10 @@
*/
void ACameraMetadata_free(ACameraMetadata* metadata);
-#ifdef __cplusplus
-} // extern "C"
-#endif
+#endif /* __ANDROID_API__ >= 24 */
-#endif //_NDK_CAMERA_METADATA_H
+__END_DECLS
+
+#endif /* _NDK_CAMERA_METADATA_H */
/** @} */
diff --git a/include/camera/ndk/NdkCameraMetadataTags.h b/include/camera/ndk/NdkCameraMetadataTags.h
index e7f6989..0fec983 100644
--- a/include/camera/ndk/NdkCameraMetadataTags.h
+++ b/include/camera/ndk/NdkCameraMetadataTags.h
@@ -36,6 +36,12 @@
#ifndef _NDK_CAMERA_METADATA_TAGS_H
#define _NDK_CAMERA_METADATA_TAGS_H
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
+#if __ANDROID_API__ >= 24
+
typedef enum acamera_metadata_section {
ACAMERA_COLOR_CORRECTION,
ACAMERA_CONTROL,
@@ -6901,8 +6907,10 @@
} acamera_metadata_enum_android_depth_depth_is_exclusive_t;
+#endif /* __ANDROID_API__ >= 24 */
+__END_DECLS
-#endif //_NDK_CAMERA_METADATA_TAGS_H
+#endif /* _NDK_CAMERA_METADATA_TAGS_H */
/** @} */
diff --git a/include/camera/ndk/NdkCaptureRequest.h b/include/camera/ndk/NdkCaptureRequest.h
index cd97f4d..c62ba2c 100644
--- a/include/camera/ndk/NdkCaptureRequest.h
+++ b/include/camera/ndk/NdkCaptureRequest.h
@@ -32,6 +32,9 @@
* Do not reference types that are not part of the NDK.
* Do not #include files that aren't part of the NDK.
*/
+
+#include <sys/cdefs.h>
+
#include <android/native_window.h>
#include "NdkCameraError.h"
#include "NdkCameraMetadata.h"
@@ -39,9 +42,9 @@
#ifndef _NDK_CAPTURE_REQUEST_H
#define _NDK_CAPTURE_REQUEST_H
-#ifdef __cplusplus
-extern "C" {
-#endif
+__BEGIN_DECLS
+
+#if __ANDROID_API__ >= 24
// Container for output targets
typedef struct ACameraOutputTargets ACameraOutputTargets;
@@ -300,10 +303,10 @@
*/
void ACaptureRequest_free(ACaptureRequest* request);
-#ifdef __cplusplus
-} // extern "C"
-#endif
+#endif /* __ANDROID_API__ >= 24 */
-#endif // _NDK_CAPTURE_REQUEST_H
+__END_DECLS
+
+#endif /* _NDK_CAPTURE_REQUEST_H */
/** @} */
diff --git a/include/drm/DrmConstraints.h b/include/drm/DrmConstraints.h
index a9ec942..b8bb24f 100644
--- a/include/drm/DrmConstraints.h
+++ b/include/drm/DrmConstraints.h
@@ -70,7 +70,7 @@
class KeyIterator {
friend class DrmConstraints;
private:
- KeyIterator(DrmConstraints* drmConstraints)
+ explicit KeyIterator(DrmConstraints* drmConstraints)
: mDrmConstraints(drmConstraints), mIndex(0) {}
public:
@@ -93,7 +93,7 @@
class Iterator {
friend class DrmConstraints;
private:
- Iterator(DrmConstraints* drmConstraints)
+ explicit Iterator(DrmConstraints* drmConstraints)
: mDrmConstraints(drmConstraints), mIndex(0) {}
public:
diff --git a/include/drm/DrmInfo.h b/include/drm/DrmInfo.h
index 7b48541..53dfd61 100644
--- a/include/drm/DrmInfo.h
+++ b/include/drm/DrmInfo.h
@@ -55,7 +55,7 @@
friend class DrmInfo;
private:
- KeyIterator(const DrmInfo* drmInfo)
+ explicit KeyIterator(const DrmInfo* drmInfo)
: mDrmInfo(const_cast <DrmInfo*> (drmInfo)), mIndex(0) {}
public:
@@ -79,7 +79,7 @@
friend class DrmInfo;
private:
- Iterator(const DrmInfo* drmInfo)
+ explicit Iterator(const DrmInfo* drmInfo)
: mDrmInfo(const_cast <DrmInfo*> (drmInfo)), mIndex(0) {}
public:
diff --git a/include/drm/DrmInfoEvent.h b/include/drm/DrmInfoEvent.h
index dfca228..3165f02 100644
--- a/include/drm/DrmInfoEvent.h
+++ b/include/drm/DrmInfoEvent.h
@@ -77,7 +77,7 @@
* @param[in] infoType Type of information
* @param[in] message Message description
*/
- DrmInfoEvent(int uniqueId, int infoType, const String8 message);
+ DrmInfoEvent(int uniqueId, int infoType, const String8& message);
/**
* Destructor for DrmInfoEvent
diff --git a/include/drm/DrmInfoRequest.h b/include/drm/DrmInfoRequest.h
index 3e48ecc..e2da4fe 100644
--- a/include/drm/DrmInfoRequest.h
+++ b/include/drm/DrmInfoRequest.h
@@ -69,7 +69,7 @@
friend class DrmInfoRequest;
private:
- KeyIterator(const DrmInfoRequest* drmInfoRequest)
+ explicit KeyIterator(const DrmInfoRequest* drmInfoRequest)
: mDrmInfoRequest(const_cast <DrmInfoRequest*> (drmInfoRequest)), mIndex(0) {}
public:
@@ -93,7 +93,7 @@
friend class DrmInfoRequest;
private:
- Iterator(const DrmInfoRequest* drmInfoRequest)
+ explicit Iterator(const DrmInfoRequest* drmInfoRequest)
: mDrmInfoRequest(const_cast <DrmInfoRequest*> (drmInfoRequest)), mIndex(0) {}
public:
diff --git a/include/drm/DrmMetadata.h b/include/drm/DrmMetadata.h
index 2c7538a..6624450 100644
--- a/include/drm/DrmMetadata.h
+++ b/include/drm/DrmMetadata.h
@@ -35,7 +35,7 @@
class KeyIterator {
friend class DrmMetadata;
private:
- KeyIterator(DrmMetadata* drmMetadata) : mDrmMetadata(drmMetadata), mIndex(0) {}
+ explicit KeyIterator(DrmMetadata* drmMetadata) : mDrmMetadata(drmMetadata), mIndex(0) {}
public:
KeyIterator(const KeyIterator& keyIterator);
@@ -57,7 +57,7 @@
class Iterator {
friend class DrmMetadata;
private:
- Iterator(DrmMetadata* drmMetadata) : mDrmMetadata(drmMetadata), mIndex(0) {}
+ explicit Iterator(DrmMetadata* drmMetadata) : mDrmMetadata(drmMetadata), mIndex(0) {}
public:
Iterator(const Iterator& iterator);
diff --git a/include/drm/DrmSupportInfo.h b/include/drm/DrmSupportInfo.h
index bf12b0b..bf85dbb 100644
--- a/include/drm/DrmSupportInfo.h
+++ b/include/drm/DrmSupportInfo.h
@@ -37,7 +37,7 @@
class MimeTypeIterator {
friend class DrmSupportInfo;
private:
- MimeTypeIterator(DrmSupportInfo* drmSupportInfo)
+ explicit MimeTypeIterator(DrmSupportInfo* drmSupportInfo)
: mDrmSupportInfo(drmSupportInfo), mIndex(0) {}
public:
MimeTypeIterator(const MimeTypeIterator& iterator);
@@ -60,7 +60,7 @@
friend class DrmSupportInfo;
private:
- FileSuffixIterator(DrmSupportInfo* drmSupportInfo)
+ explicit FileSuffixIterator(DrmSupportInfo* drmSupportInfo)
: mDrmSupportInfo(drmSupportInfo), mIndex(0) {}
public:
FileSuffixIterator(const FileSuffixIterator& iterator);
diff --git a/include/drm/drm_framework_common.h b/include/drm/drm_framework_common.h
index 637409c..0750406 100644
--- a/include/drm/drm_framework_common.h
+++ b/include/drm/drm_framework_common.h
@@ -23,7 +23,7 @@
#include <utils/String8.h>
#include <utils/Errors.h>
-#define INVALID_VALUE -1
+#define INVALID_VALUE (-1)
namespace android {
diff --git a/include/media/AudioEffect.h b/include/media/AudioEffect.h
index 6af1962..7f6ccac 100644
--- a/include/media/AudioEffect.h
+++ b/include/media/AudioEffect.h
@@ -462,7 +462,7 @@
}
// IBinder::DeathRecipient
- virtual void binderDied(const wp<IBinder>& who) {
+ virtual void binderDied(const wp<IBinder>& /*who*/) {
sp<AudioEffect> effect = mEffect.promote();
if (effect != 0) {
effect->binderDied();
diff --git a/include/media/AudioPolicy.h b/include/media/AudioPolicy.h
index 8528c7a..8da0069 100644
--- a/include/media/AudioPolicy.h
+++ b/include/media/AudioPolicy.h
@@ -36,7 +36,7 @@
(RULE_EXCLUSION_MASK|RULE_MATCH_ATTRIBUTE_CAPTURE_PRESET)
#define RULE_EXCLUDE_UID (RULE_EXCLUSION_MASK|RULE_MATCH_UID)
-#define MIX_TYPE_INVALID -1
+#define MIX_TYPE_INVALID (-1)
#define MIX_TYPE_PLAYERS 0
#define MIX_TYPE_RECORDERS 1
@@ -45,7 +45,7 @@
// keep in sync with AudioSystem.java
#define DYNAMIC_POLICY_EVENT_MIX_STATE_UPDATE 0
-#define MIX_STATE_DISABLED -1
+#define MIX_STATE_DISABLED (-1)
#define MIX_STATE_IDLE 0
#define MIX_STATE_MIXING 1
diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h
index 2e6646a..d67ad44 100644
--- a/include/media/AudioSystem.h
+++ b/include/media/AudioSystem.h
@@ -200,6 +200,9 @@
const char *device_address, const char *device_name);
static audio_policy_dev_state_t getDeviceConnectionState(audio_devices_t device,
const char *device_address);
+ static status_t handleDeviceConfigChange(audio_devices_t device,
+ const char *device_address,
+ const char *device_name);
static status_t setPhoneState(audio_mode_t state);
static status_t setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config);
static audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage);
@@ -326,7 +329,7 @@
static audio_mode_t getPhoneState();
- static status_t registerPolicyMixes(Vector<AudioMix> mixes, bool registration);
+ static status_t registerPolicyMixes(const Vector<AudioMix>& mixes, bool registration);
static status_t startAudioSource(const struct audio_port_config *source,
const audio_attributes_t *attributes,
diff --git a/include/media/DrmSessionManager.h b/include/media/DrmSessionManager.h
index ba5c268..ba27199 100644
--- a/include/media/DrmSessionManager.h
+++ b/include/media/DrmSessionManager.h
@@ -45,12 +45,12 @@
static sp<DrmSessionManager> Instance();
DrmSessionManager();
- DrmSessionManager(sp<ProcessInfoInterface> processInfo);
+ explicit DrmSessionManager(sp<ProcessInfoInterface> processInfo);
- void addSession(int pid, sp<DrmSessionClientInterface> drm, const Vector<uint8_t>& sessionId);
+ void addSession(int pid, const sp<DrmSessionClientInterface>& drm, const Vector<uint8_t>& sessionId);
void useSession(const Vector<uint8_t>& sessionId);
void removeSession(const Vector<uint8_t>& sessionId);
- void removeDrm(sp<DrmSessionClientInterface> drm);
+ void removeDrm(const sp<DrmSessionClientInterface>& drm);
bool reclaimSession(int callingPid);
protected:
diff --git a/include/media/ExtendedAudioBufferProvider.h b/include/media/ExtendedAudioBufferProvider.h
index 168ceed..51e4713 100644
--- a/include/media/ExtendedAudioBufferProvider.h
+++ b/include/media/ExtendedAudioBufferProvider.h
@@ -31,7 +31,7 @@
// Invoked by buffer consumer when a new timestamp is available.
// Default implementation ignores the timestamp.
- virtual void onTimestamp(const ExtendedTimestamp& timestamp) { }
+ virtual void onTimestamp(const ExtendedTimestamp& /*timestamp*/) { }
};
} // namespace android
diff --git a/include/media/IAudioPolicyService.h b/include/media/IAudioPolicyService.h
index 0e9e3bc..f9dcbea 100644
--- a/include/media/IAudioPolicyService.h
+++ b/include/media/IAudioPolicyService.h
@@ -48,6 +48,9 @@
const char *device_name) = 0;
virtual audio_policy_dev_state_t getDeviceConnectionState(audio_devices_t device,
const char *device_address) = 0;
+ virtual status_t handleDeviceConfigChange(audio_devices_t device,
+ const char *device_address,
+ const char *device_name) = 0;
virtual status_t setPhoneState(audio_mode_t state) = 0;
virtual status_t setForceUse(audio_policy_force_use_t usage,
audio_policy_forced_cfg_t config) = 0;
@@ -160,7 +163,7 @@
virtual audio_mode_t getPhoneState() = 0;
- virtual status_t registerPolicyMixes(Vector<AudioMix> mixes, bool registration) = 0;
+ virtual status_t registerPolicyMixes(const Vector<AudioMix>& mixes, bool registration) = 0;
virtual status_t startAudioSource(const struct audio_port_config *source,
const audio_attributes_t *attributes,
diff --git a/include/media/IMediaPlayerService.h b/include/media/IMediaPlayerService.h
index 8266b0b..f21bb3a 100644
--- a/include/media/IMediaPlayerService.h
+++ b/include/media/IMediaPlayerService.h
@@ -32,7 +32,7 @@
namespace android {
struct IHDCP;
-struct IMediaCodecList;
+class IMediaCodecList;
struct IMediaHTTPService;
class IMediaRecorder;
class IOMX;
diff --git a/include/media/IMediaSource.h b/include/media/IMediaSource.h
index 2ff42ec..2bde782 100644
--- a/include/media/IMediaSource.h
+++ b/include/media/IMediaSource.h
@@ -98,7 +98,7 @@
SeekMode mSeekMode;
int64_t mLatenessUs;
bool mNonBlocking;
- };
+ } __attribute__((packed)); // sent through Binder
// Returns a new buffer of data. Call blocks until a
// buffer is available, an error is encountered or the end of the stream
diff --git a/include/media/IOMX.h b/include/media/IOMX.h
index 1c39b9c..ffa6d6d 100644
--- a/include/media/IOMX.h
+++ b/include/media/IOMX.h
@@ -261,7 +261,7 @@
protected:
// check if the codec is secure.
- virtual bool isSecure(IOMX::node_id node) {
+ virtual bool isSecure(IOMX::node_id /*node*/) {
return false;
}
};
diff --git a/include/media/MediaCodecInfo.h b/include/media/MediaCodecInfo.h
index 48d0407..6b50f22 100644
--- a/include/media/MediaCodecInfo.h
+++ b/include/media/MediaCodecInfo.h
@@ -74,7 +74,7 @@
DISALLOW_EVIL_CONSTRUCTORS(Capabilities);
- friend class MediaCodecInfo;
+ friend struct MediaCodecInfo;
};
// Use a subclass to allow setting fields on construction without allowing
@@ -136,7 +136,7 @@
DISALLOW_EVIL_CONSTRUCTORS(MediaCodecInfo);
- friend class MediaCodecList;
+ friend struct MediaCodecList;
friend class MediaCodecListOverridesTest;
};
diff --git a/include/media/MediaMetadataRetrieverInterface.h b/include/media/MediaMetadataRetrieverInterface.h
index bce6ee3..a5e1350 100644
--- a/include/media/MediaMetadataRetrieverInterface.h
+++ b/include/media/MediaMetadataRetrieverInterface.h
@@ -54,9 +54,9 @@
MediaMetadataRetrieverInterface() {}
virtual ~MediaMetadataRetrieverInterface() {}
- virtual VideoFrame* getFrameAtTime(int64_t timeUs, int option) { return NULL; }
+ virtual VideoFrame* getFrameAtTime(int64_t /*timeUs*/, int /*option*/) { return NULL; }
virtual MediaAlbumArt* extractAlbumArt() { return NULL; }
- virtual const char* extractMetadata(int keyCode) { return NULL; }
+ virtual const char* extractMetadata(int /*keyCode*/) { return NULL; }
};
}; // namespace android
diff --git a/include/media/MediaRecorderBase.h b/include/media/MediaRecorderBase.h
index 5195993..42151ea 100644
--- a/include/media/MediaRecorderBase.h
+++ b/include/media/MediaRecorderBase.h
@@ -46,7 +46,7 @@
const sp<ICameraRecordingProxy>& proxy) = 0;
virtual status_t setPreviewSurface(const sp<IGraphicBufferProducer>& surface) = 0;
virtual status_t setOutputFile(int fd, int64_t offset, int64_t length) = 0;
- virtual status_t setOutputFileAuxiliary(int fd) {return INVALID_OPERATION;}
+ virtual status_t setOutputFileAuxiliary(int /*fd*/) {return INVALID_OPERATION;}
virtual status_t setParameters(const String8& params) = 0;
virtual status_t setListener(const sp<IMediaRecorderClient>& listener) = 0;
virtual status_t setClientName(const String16& clientName) = 0;
diff --git a/include/media/RingBuffer.h b/include/media/RingBuffer.h
index df7c00e..4d92d87 100644
--- a/include/media/RingBuffer.h
+++ b/include/media/RingBuffer.h
@@ -39,7 +39,7 @@
/**
* Construct a RingBuffer that can grow up to the given length.
*/
- RingBuffer(size_t length);
+ explicit RingBuffer(size_t length);
/**
* Forward iterator to this class. Implements an std:forward_iterator.
diff --git a/include/media/SharedLibrary.h b/include/media/SharedLibrary.h
index 88451a0..fd02203 100644
--- a/include/media/SharedLibrary.h
+++ b/include/media/SharedLibrary.h
@@ -24,7 +24,7 @@
namespace android {
class SharedLibrary : public RefBase {
public:
- SharedLibrary(const String8 &path);
+ explicit SharedLibrary(const String8 &path);
~SharedLibrary();
bool operator!() const;
diff --git a/include/media/mediaplayer.h b/include/media/mediaplayer.h
index cec9d99..389ec01 100644
--- a/include/media/mediaplayer.h
+++ b/include/media/mediaplayer.h
@@ -30,7 +30,7 @@
#include <utils/KeyedVector.h>
#include <utils/String8.h>
-class ANativeWindow;
+struct ANativeWindow;
namespace android {
diff --git a/include/media/nbaio/NBAIO.h b/include/media/nbaio/NBAIO.h
index 120de4f..212f8e8 100644
--- a/include/media/nbaio/NBAIO.h
+++ b/include/media/nbaio/NBAIO.h
@@ -212,7 +212,7 @@
// Returns NO_ERROR if a timestamp is available. The timestamp includes the total number
// of frames presented to an external observer, together with the value of CLOCK_MONOTONIC
// as of this presentation count. The timestamp parameter is undefined if error is returned.
- virtual status_t getTimestamp(ExtendedTimestamp ×tamp) { return INVALID_OPERATION; }
+ virtual status_t getTimestamp(ExtendedTimestamp& /*timestamp*/) { return INVALID_OPERATION; }
protected:
NBAIO_Sink(const NBAIO_Format& format = Format_Invalid) : NBAIO_Port(format), mFramesWritten(0)
@@ -299,7 +299,7 @@
// Invoked asynchronously by corresponding sink when a new timestamp is available.
// Default implementation ignores the timestamp.
- virtual void onTimestamp(const ExtendedTimestamp& timestamp) { }
+ virtual void onTimestamp(const ExtendedTimestamp& /*timestamp*/) { }
protected:
NBAIO_Source(const NBAIO_Format& format = Format_Invalid) : NBAIO_Port(format), mFramesRead(0)
diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h
index 25f7173..b59319c 100644
--- a/include/media/stagefright/ACodec.h
+++ b/include/media/stagefright/ACodec.h
@@ -35,7 +35,7 @@
namespace android {
struct ABuffer;
-struct MemoryDealer;
+class MemoryDealer;
struct DescribeColorFormat2Params;
struct DataConverter;
@@ -238,6 +238,7 @@
sp<IdleToLoadedState> mIdleToLoadedState;
sp<FlushingState> mFlushingState;
sp<SkipCutBuffer> mSkipCutBuffer;
+ int32_t mSampleRate;
AString mComponentName;
uint32_t mFlags;
diff --git a/include/media/stagefright/CameraSource.h b/include/media/stagefright/CameraSource.h
index c2e75a6..c604f2d 100644
--- a/include/media/stagefright/CameraSource.h
+++ b/include/media/stagefright/CameraSource.h
@@ -216,10 +216,10 @@
// Returns true if need to skip the current frame.
// Called from dataCallbackTimestamp.
- virtual bool skipCurrentFrame(int64_t timestampUs) {return false;}
+ virtual bool skipCurrentFrame(int64_t /*timestampUs*/) {return false;}
// Callback called when still camera raw data is available.
- virtual void dataCallback(int32_t msgType, const sp<IMemory> &data) {}
+ virtual void dataCallback(int32_t /*msgType*/, const sp<IMemory>& /*data*/) {}
virtual void dataCallbackTimestamp(int64_t timestampUs, int32_t msgType,
const sp<IMemory> &data);
diff --git a/include/media/stagefright/CodecBase.h b/include/media/stagefright/CodecBase.h
index be2835d..e057075 100644
--- a/include/media/stagefright/CodecBase.h
+++ b/include/media/stagefright/CodecBase.h
@@ -73,10 +73,10 @@
virtual void onMessageReceived(const sp<AMessage> &msg) = 0;
virtual status_t queryCapabilities(
- const AString &name, const AString &mime, bool isEncoder,
- sp<MediaCodecInfo::Capabilities> *caps /* nonnull */) { return INVALID_OPERATION; }
+ const AString& /*name*/, const AString& /*mime*/, bool /*isEncoder*/,
+ sp<MediaCodecInfo::Capabilities>* /*caps*/ /* nonnull */) { return INVALID_OPERATION; }
- virtual status_t setSurface(const sp<Surface> &surface) { return INVALID_OPERATION; }
+ virtual status_t setSurface(const sp<Surface>& /*surface*/) { return INVALID_OPERATION; }
virtual void signalFlush() = 0;
virtual void signalResume() = 0;
@@ -89,8 +89,8 @@
virtual size_t countBuffers() = 0;
virtual IOMX::buffer_id bufferIDAt(size_t index) const = 0;
virtual sp<ABuffer> bufferAt(size_t index) const = 0;
- virtual sp<NativeHandle> handleAt(size_t index) const { return NULL; };
- virtual sp<RefBase> memRefAt(size_t index) const { return NULL; }
+ virtual sp<NativeHandle> handleAt(size_t /*index*/) const { return NULL; };
+ virtual sp<RefBase> memRefAt(size_t /*index*/) const { return NULL; }
protected:
PortDescription();
diff --git a/include/media/stagefright/DataSource.h b/include/media/stagefright/DataSource.h
index 0254545..052b9b7 100644
--- a/include/media/stagefright/DataSource.h
+++ b/include/media/stagefright/DataSource.h
@@ -96,7 +96,7 @@
return String8("<unspecified>");
}
- virtual status_t reconnectAtOffset(off64_t offset) {
+ virtual status_t reconnectAtOffset(off64_t /*offset*/) {
return ERROR_UNSUPPORTED;
}
@@ -114,10 +114,10 @@
static void RegisterDefaultSniffers();
// for DRM
- virtual sp<DecryptHandle> DrmInitialization(const char *mime = NULL) {
+ virtual sp<DecryptHandle> DrmInitialization(const char * /*mime*/ = NULL) {
return NULL;
}
- virtual void getDrmInfo(sp<DecryptHandle> &handle, DrmManagerClient **client) {};
+ virtual void getDrmInfo(sp<DecryptHandle> &/*handle*/, DrmManagerClient ** /*client*/) {};
virtual String8 getUri() {
return String8();
diff --git a/include/media/stagefright/FrameRenderTracker.h b/include/media/stagefright/FrameRenderTracker.h
index 9333e8f..327d260 100644
--- a/include/media/stagefright/FrameRenderTracker.h
+++ b/include/media/stagefright/FrameRenderTracker.h
@@ -32,7 +32,7 @@
class Fence;
class GraphicBuffer;
-struct FrameRenderTracker : public RefBase {
+struct FrameRenderTracker {
// Tracks the render information about a frame. Frames go through several states while
// the render information is tracked:
//
@@ -82,7 +82,7 @@
sp<GraphicBuffer> mGraphicBuffer;
sp<Fence> mFence;
- friend class FrameRenderTracker;
+ friend struct FrameRenderTracker;
};
FrameRenderTracker();
diff --git a/include/media/stagefright/MPEG4Writer.h b/include/media/stagefright/MPEG4Writer.h
index 8f0eaa7..a8ba095 100644
--- a/include/media/stagefright/MPEG4Writer.h
+++ b/include/media/stagefright/MPEG4Writer.h
@@ -27,7 +27,7 @@
namespace android {
-class AMessage;
+struct AMessage;
class MediaBuffer;
class MetaData;
diff --git a/include/media/stagefright/MediaBuffer.h b/include/media/stagefright/MediaBuffer.h
index a61ddaa..2c0ebe7 100644
--- a/include/media/stagefright/MediaBuffer.h
+++ b/include/media/stagefright/MediaBuffer.h
@@ -56,11 +56,11 @@
// The underlying data remains the responsibility of the caller!
MediaBuffer(void *data, size_t size);
- MediaBuffer(size_t size);
+ explicit MediaBuffer(size_t size);
- MediaBuffer(const sp<GraphicBuffer>& graphicBuffer);
+ explicit MediaBuffer(const sp<GraphicBuffer>& graphicBuffer);
- MediaBuffer(const sp<ABuffer> &buffer);
+ explicit MediaBuffer(const sp<ABuffer> &buffer);
MediaBuffer(const sp<IMemory> &mem) :
MediaBuffer((uint8_t *)mem->pointer() + sizeof(SharedControl), mem->size()) {
diff --git a/include/media/stagefright/MediaCodec.h b/include/media/stagefright/MediaCodec.h
index fe579b7..d18aad8 100644
--- a/include/media/stagefright/MediaCodec.h
+++ b/include/media/stagefright/MediaCodec.h
@@ -33,15 +33,15 @@
struct AReplyToken;
struct AString;
struct CodecBase;
-struct IBatteryStats;
+class IBatteryStats;
struct ICrypto;
class IMemory;
-struct MemoryDealer;
+class MemoryDealer;
class IResourceManagerClient;
class IResourceManagerService;
struct PersistentSurface;
-struct SoftwareRenderer;
-struct Surface;
+class SoftwareRenderer;
+class Surface;
struct MediaCodec : public AHandler {
enum ConfigureFlags {
@@ -175,7 +175,7 @@
// by adding rendered frame information to a base notification message. Returns the number
// of frames that were rendered.
static size_t CreateFramesRenderedMessage(
- std::list<FrameRenderTracker::Info> done, sp<AMessage> &msg);
+ const std::list<FrameRenderTracker::Info> &done, sp<AMessage> &msg);
protected:
virtual ~MediaCodec();
@@ -274,7 +274,7 @@
void addResource(
int64_t clientId,
- const sp<IResourceManagerClient> client,
+ const sp<IResourceManagerClient> &client,
const Vector<MediaResource> &resources);
void removeResource(int64_t clientId);
diff --git a/include/media/stagefright/MediaExtractor.h b/include/media/stagefright/MediaExtractor.h
index 6bf8c9e..f383e72 100644
--- a/include/media/stagefright/MediaExtractor.h
+++ b/include/media/stagefright/MediaExtractor.h
@@ -24,7 +24,7 @@
namespace android {
class DataSource;
-class MediaSource;
+struct MediaSource;
class MetaData;
class MediaExtractor : public BnMediaExtractor {
@@ -65,10 +65,10 @@
bool getDrmFlag() {
return mIsDrm;
}
- virtual char* getDrmTrackInfo(size_t trackID, int *len) {
+ virtual char* getDrmTrackInfo(size_t /*trackID*/, int * /*len*/) {
return NULL;
}
- virtual void setUID(uid_t uid) {
+ virtual void setUID(uid_t /*uid*/) {
}
virtual const char * name() { return "<unspecified>"; }
diff --git a/include/media/stagefright/MediaFilter.h b/include/media/stagefright/MediaFilter.h
index d0a572c..5725f88 100644
--- a/include/media/stagefright/MediaFilter.h
+++ b/include/media/stagefright/MediaFilter.h
@@ -23,7 +23,7 @@
struct ABuffer;
struct GraphicBufferListener;
-struct MemoryDealer;
+class MemoryDealer;
struct SimpleFilter;
struct MediaFilter : public CodecBase {
diff --git a/include/media/stagefright/MediaWriter.h b/include/media/stagefright/MediaWriter.h
index b6476c9..2b19523 100644
--- a/include/media/stagefright/MediaWriter.h
+++ b/include/media/stagefright/MediaWriter.h
@@ -44,11 +44,11 @@
mListener = listener;
}
- virtual status_t dump(int fd, const Vector<String16>& args) {
+ virtual status_t dump(int /*fd*/, const Vector<String16>& /*args*/) {
return OK;
}
- virtual void setStartTimeOffsetMs(int ms) {}
+ virtual void setStartTimeOffsetMs(int /*ms*/) {}
virtual int32_t getStartTimeOffsetMs() const { return 0; }
protected:
diff --git a/include/media/stagefright/NuMediaExtractor.h b/include/media/stagefright/NuMediaExtractor.h
index 03e2185..dd31447 100644
--- a/include/media/stagefright/NuMediaExtractor.h
+++ b/include/media/stagefright/NuMediaExtractor.h
@@ -34,7 +34,7 @@
class DataSource;
struct IMediaHTTPService;
class MediaBuffer;
-struct MediaExtractor;
+class MediaExtractor;
struct MediaSource;
class MetaData;
diff --git a/include/media/stagefright/Utils.h b/include/media/stagefright/Utils.h
index 01b3e3f..8eff914 100644
--- a/include/media/stagefright/Utils.h
+++ b/include/media/stagefright/Utils.h
@@ -28,7 +28,7 @@
namespace android {
#define FOURCC(c1, c2, c3, c4) \
- (c1 << 24 | c2 << 16 | c3 << 8 | c4)
+ ((c1) << 24 | (c2) << 16 | (c3) << 8 | (c4))
uint16_t U16_AT(const uint8_t *ptr);
uint32_t U32_AT(const uint8_t *ptr);
@@ -75,7 +75,7 @@
int64_t mTimeUs;
sp<AMessage> mMeta;
- HLSTime(const sp<AMessage> &meta = NULL);
+ explicit HLSTime(const sp<AMessage> &meta = NULL);
int64_t getSegmentTimeUs() const;
};
@@ -83,10 +83,10 @@
// read and write various object to/from AMessage
-void writeToAMessage(sp<AMessage> msg, const AudioPlaybackRate &rate);
+void writeToAMessage(const sp<AMessage> &msg, const AudioPlaybackRate &rate);
void readFromAMessage(const sp<AMessage> &msg, AudioPlaybackRate *rate /* nonnull */);
-void writeToAMessage(sp<AMessage> msg, const AVSyncSettings &sync, float videoFpsHint);
+void writeToAMessage(const sp<AMessage> &msg, const AVSyncSettings &sync, float videoFpsHint);
void readFromAMessage(
const sp<AMessage> &msg, AVSyncSettings *sync /* nonnull */, float *videoFps /* nonnull */);
diff --git a/include/media/stagefright/foundation/ABase.h b/include/media/stagefright/foundation/ABase.h
index ef1e010..76a787e 100644
--- a/include/media/stagefright/foundation/ABase.h
+++ b/include/media/stagefright/foundation/ABase.h
@@ -24,7 +24,7 @@
#define DISALLOW_EVIL_CONSTRUCTORS(name) \
name(const name &); \
- name &operator=(const name &)
+ name &operator=(const name &) /* NOLINT */
/* Returns true if the size parameter is safe for new array allocation (32-bit)
*
diff --git a/include/media/stagefright/foundation/ABuffer.h b/include/media/stagefright/foundation/ABuffer.h
index dc9c778..ef11434 100644
--- a/include/media/stagefright/foundation/ABuffer.h
+++ b/include/media/stagefright/foundation/ABuffer.h
@@ -30,7 +30,7 @@
class MediaBufferBase;
struct ABuffer : public RefBase {
- ABuffer(size_t capacity);
+ explicit ABuffer(size_t capacity);
ABuffer(void *data, size_t capacity);
uint8_t *base() { return (uint8_t *)mData; }
diff --git a/include/media/stagefright/foundation/AHandler.h b/include/media/stagefright/foundation/AHandler.h
index fe02a86..53d8a9b 100644
--- a/include/media/stagefright/foundation/AHandler.h
+++ b/include/media/stagefright/foundation/AHandler.h
@@ -60,7 +60,7 @@
ALooper::handler_id mID;
wp<ALooper> mLooper;
- inline void setID(ALooper::handler_id id, wp<ALooper> looper) {
+ inline void setID(ALooper::handler_id id, const wp<ALooper> &looper) {
mID = id;
mLooper = looper;
}
diff --git a/include/media/stagefright/foundation/ALooperRoster.h b/include/media/stagefright/foundation/ALooperRoster.h
index 9912455..5873e68 100644
--- a/include/media/stagefright/foundation/ALooperRoster.h
+++ b/include/media/stagefright/foundation/ALooperRoster.h
@@ -28,7 +28,7 @@
ALooperRoster();
ALooper::handler_id registerHandler(
- const sp<ALooper> looper, const sp<AHandler> &handler);
+ const sp<ALooper> &looper, const sp<AHandler> &handler);
void unregisterHandler(ALooper::handler_id handlerID);
void unregisterStaleHandlers();
diff --git a/include/media/stagefright/foundation/AMessage.h b/include/media/stagefright/foundation/AMessage.h
index 4b2b868..782f8e6 100644
--- a/include/media/stagefright/foundation/AMessage.h
+++ b/include/media/stagefright/foundation/AMessage.h
@@ -31,7 +31,7 @@
class Parcel;
struct AReplyToken : public RefBase {
- AReplyToken(const sp<ALooper> &looper)
+ explicit AReplyToken(const sp<ALooper> &looper)
: mLooper(looper),
mReplied(false) {
}
diff --git a/include/media/stagefright/foundation/AString.h b/include/media/stagefright/foundation/AString.h
index 2f6d532..ff086b3 100644
--- a/include/media/stagefright/foundation/AString.h
+++ b/include/media/stagefright/foundation/AString.h
@@ -28,9 +28,9 @@
struct AString {
AString();
- AString(const char *s);
+ AString(const char *s); // NOLINT, implicit conversion
AString(const char *s, size_t size);
- AString(const String8 &from);
+ AString(const String8 &from); // NOLINT, implicit conversion
AString(const AString &from);
AString(const AString &from, size_t offset, size_t n);
~AString();
diff --git a/include/media/stagefright/foundation/AWakeLock.h b/include/media/stagefright/foundation/AWakeLock.h
index 57716c1..323e7d7 100644
--- a/include/media/stagefright/foundation/AWakeLock.h
+++ b/include/media/stagefright/foundation/AWakeLock.h
@@ -43,7 +43,7 @@
class PMDeathRecipient : public IBinder::DeathRecipient {
public:
- PMDeathRecipient(AWakeLock *wakeLock) : mWakeLock(wakeLock) {}
+ explicit PMDeathRecipient(AWakeLock *wakeLock) : mWakeLock(wakeLock) {}
virtual ~PMDeathRecipient() {}
// IBinder::DeathRecipient
diff --git a/include/ndk/NdkImage.h b/include/ndk/NdkImage.h
index cd0b11e..9a99287 100644
--- a/include/ndk/NdkImage.h
+++ b/include/ndk/NdkImage.h
@@ -36,12 +36,16 @@
#ifndef _NDK_IMAGE_H
#define _NDK_IMAGE_H
+#include <sys/cdefs.h>
+
#include "NdkMediaError.h"
#ifdef __cplusplus
extern "C" {
#endif
+#if __ANDROID_API__ >= 24
+
/**
* AImage is an opaque type that provides access to image generated by {@link AImageReader}.
*/
@@ -604,6 +608,8 @@
const AImage* image, int planeIdx,
/*out*/uint8_t** data, /*out*/int* dataLength);
+#endif /* __ANDROID_API__ >= 24 */
+
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/include/ndk/NdkImageReader.h b/include/ndk/NdkImageReader.h
index 7c7ec6a..8d72c28 100644
--- a/include/ndk/NdkImageReader.h
+++ b/include/ndk/NdkImageReader.h
@@ -36,6 +36,8 @@
#ifndef _NDK_IMAGE_READER_H
#define _NDK_IMAGE_READER_H
+#include <sys/cdefs.h>
+
#include <android/native_window.h>
#include "NdkMediaError.h"
#include "NdkImage.h"
@@ -44,6 +46,8 @@
extern "C" {
#endif
+#if __ANDROID_API__ >= 24
+
/**
* AImage is an opaque type that allows direct application access to image data rendered into a
* {@link ANativeWindow}.
@@ -294,6 +298,8 @@
media_status_t AImageReader_setImageListener(
AImageReader* reader, AImageReader_ImageListener* listener);
+#endif /* __ANDROID_API__ >= 24 */
+
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/include/ndk/NdkMediaCodec.h b/include/ndk/NdkMediaCodec.h
index fcb3a99..ad17321 100644
--- a/include/ndk/NdkMediaCodec.h
+++ b/include/ndk/NdkMediaCodec.h
@@ -27,6 +27,8 @@
#ifndef _NDK_MEDIA_CODEC_H
#define _NDK_MEDIA_CODEC_H
+#include <sys/cdefs.h>
+
#include <android/native_window.h>
#include "NdkMediaCrypto.h"
@@ -37,6 +39,7 @@
extern "C" {
#endif
+#if __ANDROID_API__ >= 21
struct AMediaCodec;
typedef struct AMediaCodec AMediaCodec;
@@ -254,6 +257,8 @@
*/
media_status_t AMediaCodecCryptoInfo_getEncryptedBytes(AMediaCodecCryptoInfo*, size_t *dst);
+#endif /* __ANDROID_API__ >= 21 */
+
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/include/ndk/NdkMediaCrypto.h b/include/ndk/NdkMediaCrypto.h
index 90374c5..9236765 100644
--- a/include/ndk/NdkMediaCrypto.h
+++ b/include/ndk/NdkMediaCrypto.h
@@ -28,6 +28,7 @@
#ifndef _NDK_MEDIA_CRYPTO_H
#define _NDK_MEDIA_CRYPTO_H
+#include <sys/cdefs.h>
#include <sys/types.h>
#include <stdbool.h>
@@ -35,6 +36,8 @@
extern "C" {
#endif
+#if __ANDROID_API__ >= 21
+
struct AMediaCrypto;
typedef struct AMediaCrypto AMediaCrypto;
@@ -48,6 +51,7 @@
void AMediaCrypto_delete(AMediaCrypto* crypto);
+#endif /* __ANDROID_API__ >= 21 */
#ifdef __cplusplus
} // extern "C"
diff --git a/include/ndk/NdkMediaDrm.h b/include/ndk/NdkMediaDrm.h
index 3c312a9..9dd6283 100644
--- a/include/ndk/NdkMediaDrm.h
+++ b/include/ndk/NdkMediaDrm.h
@@ -27,14 +27,17 @@
#ifndef _NDK_MEDIA_DRM_H
#define _NDK_MEDIA_DRM_H
+#include <stdbool.h>
+#include <stdint.h>
+#include <sys/cdefs.h>
+
#include "NdkMediaError.h"
#ifdef __cplusplus
extern "C" {
#endif
-#include <stdint.h>
-#include <stdbool.h>
+#if __ANDROID_API__ >= 21
struct AMediaDrm;
typedef struct AMediaDrm AMediaDrm;
@@ -448,6 +451,8 @@
const char *macAlgorithm, uint8_t *keyId, const uint8_t *message, size_t messageSize,
const uint8_t *signature, size_t signatureSize);
+#endif /* __ANDROID_API__ >= 21 */
+
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/include/ndk/NdkMediaError.h b/include/ndk/NdkMediaError.h
index 60d401b..fb00b1d 100644
--- a/include/ndk/NdkMediaError.h
+++ b/include/ndk/NdkMediaError.h
@@ -28,10 +28,14 @@
#ifndef _NDK_MEDIA_ERROR_H
#define _NDK_MEDIA_ERROR_H
+#include <sys/cdefs.h>
+
#ifdef __cplusplus
extern "C" {
#endif
+#if __ANDROID_API__ >= 21
+
typedef enum {
AMEDIA_OK = 0,
@@ -59,6 +63,7 @@
} media_status_t;
+#endif /* __ANDROID_API__ >= 21 */
#ifdef __cplusplus
} // extern "C"
diff --git a/include/ndk/NdkMediaExtractor.h b/include/ndk/NdkMediaExtractor.h
index 7324d31..c3180dc 100644
--- a/include/ndk/NdkMediaExtractor.h
+++ b/include/ndk/NdkMediaExtractor.h
@@ -28,6 +28,7 @@
#ifndef _NDK_MEDIA_EXTRACTOR_H
#define _NDK_MEDIA_EXTRACTOR_H
+#include <sys/cdefs.h>
#include <sys/types.h>
#include "NdkMediaCodec.h"
@@ -38,6 +39,8 @@
extern "C" {
#endif
+#if __ANDROID_API__ >= 21
+
struct AMediaExtractor;
typedef struct AMediaExtractor AMediaExtractor;
@@ -158,6 +161,8 @@
AMEDIAEXTRACTOR_SAMPLE_FLAG_ENCRYPTED = 2,
};
+#endif /* __ANDROID_API__ >= 21 */
+
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/include/ndk/NdkMediaFormat.h b/include/ndk/NdkMediaFormat.h
index ab29791..a2a21d2 100644
--- a/include/ndk/NdkMediaFormat.h
+++ b/include/ndk/NdkMediaFormat.h
@@ -27,6 +27,7 @@
#ifndef _NDK_MEDIA_FORMAT_H
#define _NDK_MEDIA_FORMAT_H
+#include <sys/cdefs.h>
#include <sys/types.h>
#include "NdkMediaError.h"
@@ -35,6 +36,8 @@
extern "C" {
#endif
+#if __ANDROID_API__ >= 21
+
struct AMediaFormat;
typedef struct AMediaFormat AMediaFormat;
@@ -104,6 +107,8 @@
extern const char* AMEDIAFORMAT_KEY_WIDTH;
extern const char* AMEDIAFORMAT_KEY_STRIDE;
+#endif /* __ANDROID_API__ >= 21 */
+
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/include/ndk/NdkMediaMuxer.h b/include/ndk/NdkMediaMuxer.h
index 90d946c..25987a2 100644
--- a/include/ndk/NdkMediaMuxer.h
+++ b/include/ndk/NdkMediaMuxer.h
@@ -28,6 +28,7 @@
#ifndef _NDK_MEDIA_MUXER_H
#define _NDK_MEDIA_MUXER_H
+#include <sys/cdefs.h>
#include <sys/types.h>
#include "NdkMediaCodec.h"
@@ -38,6 +39,8 @@
extern "C" {
#endif
+#if __ANDROID_API__ >= 21
+
struct AMediaMuxer;
typedef struct AMediaMuxer AMediaMuxer;
@@ -112,6 +115,8 @@
media_status_t AMediaMuxer_writeSampleData(AMediaMuxer *muxer,
size_t trackIdx, const uint8_t *data, const AMediaCodecBufferInfo *info);
+#endif /* __ANDROID_API__ >= 21 */
+
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/media/audioserver/Android.mk b/media/audioserver/Android.mk
index 5ce1798..c620e7c 100644
--- a/media/audioserver/Android.mk
+++ b/media/audioserver/Android.mk
@@ -11,9 +11,7 @@
libbinder \
libcutils \
liblog \
- libmedia \
libmedialogservice \
- libnbaio \
libradioservice \
libsoundtriggerservice \
libutils
diff --git a/media/common_time/ICommonClock.cpp b/media/common_time/ICommonClock.cpp
index 19b7d6e..f1f1fca 100644
--- a/media/common_time/ICommonClock.cpp
+++ b/media/common_time/ICommonClock.cpp
@@ -48,7 +48,7 @@
class BpCommonClock : public BpInterface<ICommonClock>
{
public:
- BpCommonClock(const sp<IBinder>& impl)
+ explicit BpCommonClock(const sp<IBinder>& impl)
: BpInterface<ICommonClock>(impl) {}
virtual status_t isCommonTimeValid(bool* valid, uint32_t* timelineID) {
@@ -401,7 +401,7 @@
class BpCommonClockListener : public BpInterface<ICommonClockListener>
{
public:
- BpCommonClockListener(const sp<IBinder>& impl)
+ explicit BpCommonClockListener(const sp<IBinder>& impl)
: BpInterface<ICommonClockListener>(impl) {}
virtual void onTimelineChanged(uint64_t timelineID) {
diff --git a/media/common_time/ICommonTimeConfig.cpp b/media/common_time/ICommonTimeConfig.cpp
index 67167b0..e587b39 100644
--- a/media/common_time/ICommonTimeConfig.cpp
+++ b/media/common_time/ICommonTimeConfig.cpp
@@ -50,7 +50,7 @@
class BpCommonTimeConfig : public BpInterface<ICommonTimeConfig>
{
public:
- BpCommonTimeConfig(const sp<IBinder>& impl)
+ explicit BpCommonTimeConfig(const sp<IBinder>& impl)
: BpInterface<ICommonTimeConfig>(impl) {}
virtual status_t getMasterElectionPriority(uint8_t *priority) {
diff --git a/media/common_time/cc_helper.cpp b/media/common_time/cc_helper.cpp
index 222b7ce..6a7de74 100644
--- a/media/common_time/cc_helper.cpp
+++ b/media/common_time/cc_helper.cpp
@@ -80,7 +80,7 @@
}
}
-void CCHelper::CommonClockListener::onTimelineChanged(uint64_t timelineID __unused) {
+void CCHelper::CommonClockListener::onTimelineChanged(uint64_t /*timelineID*/) {
// do nothing; listener is only really used as a token so the server can
// find out when clients die.
}
diff --git a/media/img_utils/include/img_utils/EndianUtils.h b/media/img_utils/include/img_utils/EndianUtils.h
index e99be1a..bfa42e9 100644
--- a/media/img_utils/include/img_utils/EndianUtils.h
+++ b/media/img_utils/include/img_utils/EndianUtils.h
@@ -58,7 +58,7 @@
* Wrap the given Output. Calling write methods will result in
* writes to this output.
*/
- EndianOutput(Output* out, Endianness end=LITTLE);
+ explicit EndianOutput(Output* out, Endianness end=LITTLE);
virtual ~EndianOutput();
diff --git a/media/img_utils/include/img_utils/FileInput.h b/media/img_utils/include/img_utils/FileInput.h
index 4d4f22b..66afaff 100644
--- a/media/img_utils/include/img_utils/FileInput.h
+++ b/media/img_utils/include/img_utils/FileInput.h
@@ -36,7 +36,7 @@
/**
* Create a file input for the given path.
*/
- FileInput(String8 path);
+ explicit FileInput(String8 path);
virtual ~FileInput();
diff --git a/media/img_utils/include/img_utils/FileOutput.h b/media/img_utils/include/img_utils/FileOutput.h
index fd5be27..3d4cf76 100644
--- a/media/img_utils/include/img_utils/FileOutput.h
+++ b/media/img_utils/include/img_utils/FileOutput.h
@@ -29,7 +29,7 @@
class ANDROID_API FileOutput : public Output {
public:
- FileOutput(String8 path);
+ explicit FileOutput(String8 path);
virtual ~FileOutput();
virtual status_t open();
virtual status_t write(const uint8_t* buf, size_t offset, size_t count);
diff --git a/media/img_utils/include/img_utils/TiffHelpers.h b/media/img_utils/include/img_utils/TiffHelpers.h
index 0969e4d..3e5f863 100644
--- a/media/img_utils/include/img_utils/TiffHelpers.h
+++ b/media/img_utils/include/img_utils/TiffHelpers.h
@@ -25,7 +25,7 @@
const uint8_t ZERO_WORD[] = {0, 0, 0, 0};
#define BAIL_ON_FAIL(x, flag) \
- if ((flag = (x)) != OK) return flag;
+ if (((flag) = (x)) != OK) return flag;
#define BYTES_TILL_WORD(index) \
((TIFF_WORD_SIZE - ((index) % TIFF_WORD_SIZE)) % TIFF_WORD_SIZE)
diff --git a/media/img_utils/include/img_utils/TiffIfd.h b/media/img_utils/include/img_utils/TiffIfd.h
index 51b5c9a..2d8e91f 100644
--- a/media/img_utils/include/img_utils/TiffIfd.h
+++ b/media/img_utils/include/img_utils/TiffIfd.h
@@ -42,7 +42,7 @@
*/
class ANDROID_API TiffIfd : public TiffWritable {
public:
- TiffIfd(uint32_t ifdId);
+ explicit TiffIfd(uint32_t ifdId);
virtual ~TiffIfd();
/**
diff --git a/media/img_utils/src/Android.mk b/media/img_utils/src/Android.mk
index 4074849..4c6fe70 100644
--- a/media/img_utils/src/Android.mk
+++ b/media/img_utils/src/Android.mk
@@ -34,11 +34,9 @@
StripSource.cpp \
LOCAL_SHARED_LIBRARIES := \
- libexpat \
+ liblog \
libutils \
libcutils \
- libcamera_metadata \
- libcamera_client
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/../include \
diff --git a/media/img_utils/src/TiffWriter.cpp b/media/img_utils/src/TiffWriter.cpp
index a6f9218..564474f 100644
--- a/media/img_utils/src/TiffWriter.cpp
+++ b/media/img_utils/src/TiffWriter.cpp
@@ -40,7 +40,7 @@
}
#define ARRAY_SIZE(array) \
- (sizeof(array) / sizeof(array[0]))
+ (sizeof(array) / sizeof((array)[0]))
KeyedVector<uint16_t, const TagDefinition_t*> TiffWriter::sTagMaps[] = {
buildTagMap(TIFF_EP_TAG_DEFINITIONS, ARRAY_SIZE(TIFF_EP_TAG_DEFINITIONS)),
diff --git a/media/libaudioclient/Android.bp b/media/libaudioclient/Android.bp
new file mode 100644
index 0000000..03dce0c
--- /dev/null
+++ b/media/libaudioclient/Android.bp
@@ -0,0 +1,45 @@
+cc_library_shared {
+ name: "libaudioclient",
+ srcs: [
+ "AudioEffect.cpp",
+ "AudioPolicy.cpp",
+ "AudioRecord.cpp",
+ "AudioSystem.cpp",
+ "AudioTrack.cpp",
+ "AudioTrackShared.cpp",
+ "IAudioFlinger.cpp",
+ "IAudioFlingerClient.cpp",
+ "IAudioPolicyService.cpp",
+ "IAudioPolicyServiceClient.cpp",
+ "IAudioRecord.cpp",
+ "IAudioTrack.cpp",
+ "IEffect.cpp",
+ "IEffectClient.cpp",
+ "ToneGenerator.cpp",
+ ],
+ shared_libs: [
+ "liblog",
+ "libcutils",
+ "libutils",
+ "libbinder",
+ "libdl",
+ "libaudioutils",
+ ],
+ export_shared_lib_headers: ["libbinder"],
+ // for memory heap analysis
+ static_libs: [
+ "libc_malloc_debug_backtrace",
+ "libc_logging",
+ ],
+ cflags: [
+ "-Werror",
+ "-Wno-error=deprecated-declarations",
+ "-Wall",
+ ],
+ sanitize: {
+ misc_undefined : [
+ "unsigned-integer-overflow",
+ "signed-integer-overflow",
+ ],
+ },
+}
diff --git a/media/libmedia/AudioEffect.cpp b/media/libaudioclient/AudioEffect.cpp
similarity index 100%
rename from media/libmedia/AudioEffect.cpp
rename to media/libaudioclient/AudioEffect.cpp
diff --git a/media/libmedia/AudioPolicy.cpp b/media/libaudioclient/AudioPolicy.cpp
similarity index 100%
rename from media/libmedia/AudioPolicy.cpp
rename to media/libaudioclient/AudioPolicy.cpp
diff --git a/media/libmedia/AudioRecord.cpp b/media/libaudioclient/AudioRecord.cpp
similarity index 100%
rename from media/libmedia/AudioRecord.cpp
rename to media/libaudioclient/AudioRecord.cpp
diff --git a/media/libmedia/AudioSystem.cpp b/media/libaudioclient/AudioSystem.cpp
similarity index 98%
rename from media/libmedia/AudioSystem.cpp
rename to media/libaudioclient/AudioSystem.cpp
index 808b3ab..bbe6a8f 100644
--- a/media/libmedia/AudioSystem.cpp
+++ b/media/libaudioclient/AudioSystem.cpp
@@ -751,6 +751,25 @@
return aps->getDeviceConnectionState(device, device_address);
}
+status_t AudioSystem::handleDeviceConfigChange(audio_devices_t device,
+ const char *device_address,
+ const char *device_name)
+{
+ const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
+ const char *address = "";
+ const char *name = "";
+
+ if (aps == 0) return PERMISSION_DENIED;
+
+ if (device_address != NULL) {
+ address = device_address;
+ }
+ if (device_name != NULL) {
+ name = device_name;
+ }
+ return aps->handleDeviceConfigChange(device, address, name);
+}
+
status_t AudioSystem::setPhoneState(audio_mode_t state)
{
if (uint32_t(state) >= AUDIO_MODE_CNT) return BAD_VALUE;
@@ -1166,7 +1185,7 @@
return aps->getPhoneState();
}
-status_t AudioSystem::registerPolicyMixes(Vector<AudioMix> mixes, bool registration)
+status_t AudioSystem::registerPolicyMixes(const Vector<AudioMix>& mixes, bool registration)
{
const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
if (aps == 0) return PERMISSION_DENIED;
diff --git a/media/libmedia/AudioTrack.cpp b/media/libaudioclient/AudioTrack.cpp
similarity index 99%
rename from media/libmedia/AudioTrack.cpp
rename to media/libaudioclient/AudioTrack.cpp
index d322f05..08ec834 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libaudioclient/AudioTrack.cpp
@@ -2500,7 +2500,7 @@
// This is sometimes caused by erratic reports of the available space in the ALSA drivers.
if (status == NO_ERROR) {
if (previousTimestampValid) {
-#define TIME_TO_NANOS(time) ((int64_t)time.tv_sec * 1000000000 + time.tv_nsec)
+#define TIME_TO_NANOS(time) ((int64_t)(time).tv_sec * 1000000000 + (time).tv_nsec)
const int64_t previousTimeNanos = TIME_TO_NANOS(mPreviousTimestamp.mTime);
const int64_t currentTimeNanos = TIME_TO_NANOS(timestamp.mTime);
#undef TIME_TO_NANOS
diff --git a/media/libmedia/AudioTrackShared.cpp b/media/libaudioclient/AudioTrackShared.cpp
similarity index 100%
rename from media/libmedia/AudioTrackShared.cpp
rename to media/libaudioclient/AudioTrackShared.cpp
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libaudioclient/IAudioFlinger.cpp
similarity index 99%
rename from media/libmedia/IAudioFlinger.cpp
rename to media/libaudioclient/IAudioFlinger.cpp
index 900d418..65fdedb 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libaudioclient/IAudioFlinger.cpp
@@ -90,7 +90,7 @@
class BpAudioFlinger : public BpInterface<IAudioFlinger>
{
public:
- BpAudioFlinger(const sp<IBinder>& impl)
+ explicit BpAudioFlinger(const sp<IBinder>& impl)
: BpInterface<IAudioFlinger>(impl)
{
}
diff --git a/media/libmedia/IAudioFlingerClient.cpp b/media/libaudioclient/IAudioFlingerClient.cpp
similarity index 97%
rename from media/libmedia/IAudioFlingerClient.cpp
rename to media/libaudioclient/IAudioFlingerClient.cpp
index 8dca9e9..b2dbc4c 100644
--- a/media/libmedia/IAudioFlingerClient.cpp
+++ b/media/libaudioclient/IAudioFlingerClient.cpp
@@ -34,7 +34,7 @@
class BpAudioFlingerClient : public BpInterface<IAudioFlingerClient>
{
public:
- BpAudioFlingerClient(const sp<IBinder>& impl)
+ explicit BpAudioFlingerClient(const sp<IBinder>& impl)
: BpInterface<IAudioFlingerClient>(impl)
{
}
diff --git a/media/libmedia/IAudioPolicyService.cpp b/media/libaudioclient/IAudioPolicyService.cpp
similarity index 95%
rename from media/libmedia/IAudioPolicyService.cpp
rename to media/libaudioclient/IAudioPolicyService.cpp
index 6405d6d..0ac5726 100644
--- a/media/libmedia/IAudioPolicyService.cpp
+++ b/media/libaudioclient/IAudioPolicyService.cpp
@@ -33,6 +33,7 @@
enum {
SET_DEVICE_CONNECTION_STATE = IBinder::FIRST_CALL_TRANSACTION,
GET_DEVICE_CONNECTION_STATE,
+ HANDLE_DEVICE_CONFIG_CHANGE,
SET_PHONE_STATE,
SET_RINGER_MODE, // reserved, no longer used
SET_FORCE_USE,
@@ -83,7 +84,7 @@
class BpAudioPolicyService : public BpInterface<IAudioPolicyService>
{
public:
- BpAudioPolicyService(const sp<IBinder>& impl)
+ explicit BpAudioPolicyService(const sp<IBinder>& impl)
: BpInterface<IAudioPolicyService>(impl)
{
}
@@ -116,6 +117,19 @@
return static_cast <audio_policy_dev_state_t>(reply.readInt32());
}
+ virtual status_t handleDeviceConfigChange(audio_devices_t device,
+ const char *device_address,
+ const char *device_name)
+ {
+ Parcel data, reply;
+ data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
+ data.writeInt32(static_cast <uint32_t>(device));
+ data.writeCString(device_address);
+ data.writeCString(device_name);
+ remote()->transact(HANDLE_DEVICE_CONFIG_CHANGE, data, &reply);
+ return static_cast <status_t> (reply.readInt32());
+ }
+
virtual status_t setPhoneState(audio_mode_t state)
{
Parcel data, reply;
@@ -704,7 +718,7 @@
return (audio_mode_t)reply.readInt32();
}
- virtual status_t registerPolicyMixes(Vector<AudioMix> mixes, bool registration)
+ virtual status_t registerPolicyMixes(const Vector<AudioMix>& mixes, bool registration)
{
Parcel data, reply;
data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
@@ -821,10 +835,15 @@
static_cast <audio_policy_dev_state_t>(data.readInt32());
const char *device_address = data.readCString();
const char *device_name = data.readCString();
- reply->writeInt32(static_cast<uint32_t> (setDeviceConnectionState(device,
- state,
- device_address,
- device_name)));
+ if (device_address == nullptr || device_name == nullptr) {
+ ALOGE("Bad Binder transaction: SET_DEVICE_CONNECTION_STATE for device %u", device);
+ reply->writeInt32(static_cast<int32_t> (BAD_VALUE));
+ } else {
+ reply->writeInt32(static_cast<uint32_t> (setDeviceConnectionState(device,
+ state,
+ device_address,
+ device_name)));
+ }
return NO_ERROR;
} break;
@@ -833,8 +852,30 @@
audio_devices_t device =
static_cast<audio_devices_t> (data.readInt32());
const char *device_address = data.readCString();
- reply->writeInt32(static_cast<uint32_t> (getDeviceConnectionState(device,
- device_address)));
+ if (device_address == nullptr) {
+ ALOGE("Bad Binder transaction: GET_DEVICE_CONNECTION_STATE for device %u", device);
+ reply->writeInt32(static_cast<int32_t> (AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE));
+ } else {
+ reply->writeInt32(static_cast<uint32_t> (getDeviceConnectionState(device,
+ device_address)));
+ }
+ return NO_ERROR;
+ } break;
+
+ case HANDLE_DEVICE_CONFIG_CHANGE: {
+ CHECK_INTERFACE(IAudioPolicyService, data, reply);
+ audio_devices_t device =
+ static_cast <audio_devices_t>(data.readInt32());
+ const char *device_address = data.readCString();
+ const char *device_name = data.readCString();
+ if (device_address == nullptr || device_name == nullptr) {
+ ALOGE("Bad Binder transaction: HANDLE_DEVICE_CONFIG_CHANGE for device %u", device);
+ reply->writeInt32(static_cast<int32_t> (BAD_VALUE));
+ } else {
+ reply->writeInt32(static_cast<uint32_t> (handleDeviceConfigChange(device,
+ device_address,
+ device_name)));
+ }
return NO_ERROR;
} break;
diff --git a/media/libmedia/IAudioPolicyServiceClient.cpp b/media/libaudioclient/IAudioPolicyServiceClient.cpp
similarity index 98%
rename from media/libmedia/IAudioPolicyServiceClient.cpp
rename to media/libaudioclient/IAudioPolicyServiceClient.cpp
index 5f931e5..98a0521 100644
--- a/media/libmedia/IAudioPolicyServiceClient.cpp
+++ b/media/libaudioclient/IAudioPolicyServiceClient.cpp
@@ -52,7 +52,7 @@
class BpAudioPolicyServiceClient : public BpInterface<IAudioPolicyServiceClient>
{
public:
- BpAudioPolicyServiceClient(const sp<IBinder>& impl)
+ explicit BpAudioPolicyServiceClient(const sp<IBinder>& impl)
: BpInterface<IAudioPolicyServiceClient>(impl)
{
}
diff --git a/media/libmedia/IAudioRecord.cpp b/media/libaudioclient/IAudioRecord.cpp
similarity index 97%
rename from media/libmedia/IAudioRecord.cpp
rename to media/libaudioclient/IAudioRecord.cpp
index ae66436..1331c0d 100644
--- a/media/libmedia/IAudioRecord.cpp
+++ b/media/libaudioclient/IAudioRecord.cpp
@@ -37,7 +37,7 @@
class BpAudioRecord : public BpInterface<IAudioRecord>
{
public:
- BpAudioRecord(const sp<IBinder>& impl)
+ explicit BpAudioRecord(const sp<IBinder>& impl)
: BpInterface<IAudioRecord>(impl)
{
}
diff --git a/media/libmedia/IAudioTrack.cpp b/media/libaudioclient/IAudioTrack.cpp
similarity index 98%
rename from media/libmedia/IAudioTrack.cpp
rename to media/libaudioclient/IAudioTrack.cpp
index 636e3bb..89e0fcc 100644
--- a/media/libmedia/IAudioTrack.cpp
+++ b/media/libaudioclient/IAudioTrack.cpp
@@ -44,7 +44,7 @@
class BpAudioTrack : public BpInterface<IAudioTrack>
{
public:
- BpAudioTrack(const sp<IBinder>& impl)
+ explicit BpAudioTrack(const sp<IBinder>& impl)
: BpInterface<IAudioTrack>(impl)
{
}
diff --git a/media/libmedia/IEffect.cpp b/media/libaudioclient/IEffect.cpp
similarity index 98%
rename from media/libmedia/IEffect.cpp
rename to media/libaudioclient/IEffect.cpp
index af6d8de..ce72dae 100644
--- a/media/libmedia/IEffect.cpp
+++ b/media/libaudioclient/IEffect.cpp
@@ -39,7 +39,7 @@
class BpEffect: public BpInterface<IEffect>
{
public:
- BpEffect(const sp<IBinder>& impl)
+ explicit BpEffect(const sp<IBinder>& impl)
: BpInterface<IEffect>(impl)
{
}
diff --git a/media/libmedia/IEffectClient.cpp b/media/libaudioclient/IEffectClient.cpp
similarity index 98%
rename from media/libmedia/IEffectClient.cpp
rename to media/libaudioclient/IEffectClient.cpp
index 1322e72..3f2c67d 100644
--- a/media/libmedia/IEffectClient.cpp
+++ b/media/libaudioclient/IEffectClient.cpp
@@ -33,7 +33,7 @@
class BpEffectClient: public BpInterface<IEffectClient>
{
public:
- BpEffectClient(const sp<IBinder>& impl)
+ explicit BpEffectClient(const sp<IBinder>& impl)
: BpInterface<IEffectClient>(impl)
{
}
diff --git a/media/libmedia/ToneGenerator.cpp b/media/libaudioclient/ToneGenerator.cpp
similarity index 100%
rename from media/libmedia/ToneGenerator.cpp
rename to media/libaudioclient/ToneGenerator.cpp
diff --git a/media/libcpustats/Android.mk b/media/libcpustats/Android.mk
index 57fe527..b2d73ee 100644
--- a/media/libcpustats/Android.mk
+++ b/media/libcpustats/Android.mk
@@ -8,6 +8,6 @@
LOCAL_MODULE := libcpustats
-LOCAL_CFLAGS := -std=gnu++11 -Werror -Wall
+LOCAL_CFLAGS := -Werror -Wall
include $(BUILD_STATIC_LIBRARY)
diff --git a/media/libeffects/Android.bp b/media/libeffects/Android.bp
new file mode 100644
index 0000000..ccaa2b4
--- /dev/null
+++ b/media/libeffects/Android.bp
@@ -0,0 +1 @@
+subdirs = ["factory"]
diff --git a/media/libeffects/downmix/EffectDownmix.c b/media/libeffects/downmix/EffectDownmix.c
index 9823c55..5b74845 100644
--- a/media/libeffects/downmix/EffectDownmix.c
+++ b/media/libeffects/downmix/EffectDownmix.c
@@ -16,11 +16,14 @@
#define LOG_TAG "EffectDownmix"
//#define LOG_NDEBUG 0
-#include <log/log.h>
+
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
-#include <stdbool.h>
+
+#include <log/log.h>
+
#include "EffectDownmix.h"
// Do not submit with DOWNMIX_TEST_CHANNEL_INDEX defined, strictly for testing
diff --git a/media/libeffects/factory/Android.bp b/media/libeffects/factory/Android.bp
new file mode 100644
index 0000000..0d8b6eb
--- /dev/null
+++ b/media/libeffects/factory/Android.bp
@@ -0,0 +1,13 @@
+// Effect factory library
+cc_library_shared {
+ name: "libeffects",
+ srcs: ["EffectsFactory.c"],
+
+ shared_libs: [
+ "libcutils",
+ "liblog",
+ "libdl",
+ ],
+
+ include_dirs: ["system/media/audio_effects/include"],
+}
diff --git a/media/libeffects/factory/Android.mk b/media/libeffects/factory/Android.mk
deleted file mode 100644
index a932af7..0000000
--- a/media/libeffects/factory/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-# Effect factory library
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- EffectsFactory.c
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils liblog
-
-LOCAL_MODULE:= libeffects
-
-LOCAL_SHARED_LIBRARIES += libdl
-
-LOCAL_C_INCLUDES := \
- $(call include-path-for, audio-effects)
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libeffects/factory/EffectsFactory.c b/media/libeffects/factory/EffectsFactory.c
index db7865a..ba20ac2 100644
--- a/media/libeffects/factory/EffectsFactory.c
+++ b/media/libeffects/factory/EffectsFactory.c
@@ -18,13 +18,17 @@
//#define LOG_NDEBUG 0
#include "EffectsFactory.h"
-#include <string.h>
-#include <stdlib.h>
-#include <dlfcn.h>
-#include <cutils/misc.h>
+#include <dlfcn.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
#include <cutils/config_utils.h>
+#include <cutils/misc.h>
#include <cutils/properties.h>
+#include <log/log.h>
+
#include <audio_effects/audio_effects_conf.h>
static list_elem_t *gEffectList; // list of effect_entry_t: all currently created effects
diff --git a/media/libeffects/factory/EffectsFactory.h b/media/libeffects/factory/EffectsFactory.h
index 518800d..b7936e0 100644
--- a/media/libeffects/factory/EffectsFactory.h
+++ b/media/libeffects/factory/EffectsFactory.h
@@ -17,9 +17,10 @@
#ifndef ANDROID_EFFECTSFACTORY_H_
#define ANDROID_EFFECTSFACTORY_H_
-#include <cutils/log.h>
-#include <pthread.h>
#include <dirent.h>
+#include <pthread.h>
+
+#include <android/log.h>
#include <hardware/audio_effect.h>
#if __cplusplus
diff --git a/media/libeffects/loudness/EffectLoudnessEnhancer.cpp b/media/libeffects/loudness/EffectLoudnessEnhancer.cpp
index a5a1a3f..cf00e60 100644
--- a/media/libeffects/loudness/EffectLoudnessEnhancer.cpp
+++ b/media/libeffects/loudness/EffectLoudnessEnhancer.cpp
@@ -16,13 +16,17 @@
#define LOG_TAG "EffectLE"
//#define LOG_NDEBUG 0
-#include <cutils/log.h>
+
#include <assert.h>
+#include <math.h>
#include <stdlib.h>
#include <string.h>
-#include <new>
#include <time.h>
-#include <math.h>
+
+#include <new>
+
+#include <log/log.h>
+
#include <audio_effects/effect_loudnessenhancer.h>
#include "dsp/core/dynamic_range_compression.h"
diff --git a/media/libeffects/loudness/dsp/core/dynamic_range_compression-inl.h b/media/libeffects/loudness/dsp/core/dynamic_range_compression-inl.h
index da75ceb..7ea0593 100644
--- a/media/libeffects/loudness/dsp/core/dynamic_range_compression-inl.h
+++ b/media/libeffects/loudness/dsp/core/dynamic_range_compression-inl.h
@@ -16,13 +16,15 @@
#ifndef LE_FX_ENGINE_DSP_CORE_DYNAMIC_RANGE_COMPRESSION_INL_H_
#define LE_FX_ENGINE_DSP_CORE_DYNAMIC_RANGE_COMPRESSION_INL_H_
+#ifndef LOG_TAG
+#define LOG_TAG NULL
+#endif
//#define LOG_NDEBUG 0
-#include <cutils/log.h>
+#include <log/log.h>
namespace le_fx {
-
inline void AdaptiveDynamicRangeCompression::set_knee_threshold(float decibel) {
// Converts to 1og-base
knee_threshold_in_decibel_ = decibel;
diff --git a/media/libeffects/loudness/dsp/core/dynamic_range_compression.cpp b/media/libeffects/loudness/dsp/core/dynamic_range_compression.cpp
index 7bd068e..578f58a 100644
--- a/media/libeffects/loudness/dsp/core/dynamic_range_compression.cpp
+++ b/media/libeffects/loudness/dsp/core/dynamic_range_compression.cpp
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
#include <cmath>
@@ -22,9 +23,7 @@
#include "dsp/core/interpolation.h"
#include "dsp/core/dynamic_range_compression.h"
-//#define LOG_NDEBUG 0
-#include <cutils/log.h>
-
+#include <android/log.h>
namespace le_fx {
diff --git a/media/libeffects/loudness/dsp/core/dynamic_range_compression.h b/media/libeffects/loudness/dsp/core/dynamic_range_compression.h
index 2821a78..04455c5 100644
--- a/media/libeffects/loudness/dsp/core/dynamic_range_compression.h
+++ b/media/libeffects/loudness/dsp/core/dynamic_range_compression.h
@@ -16,14 +16,14 @@
#ifndef LE_FX_ENGINE_DSP_CORE_DYNAMIC_RANGE_COMPRESSION_H_
#define LE_FX_ENGINE_DSP_CORE_DYNAMIC_RANGE_COMPRESSION_H_
+//#define LOG_NDEBUG 0
+
#include "common/core/types.h"
#include "common/core/math.h"
#include "dsp/core/basic.h"
#include "dsp/core/interpolation.h"
-//#define LOG_NDEBUG 0
-#include <cutils/log.h>
-
+#include <android/log.h>
namespace le_fx {
diff --git a/media/libeffects/loudness/dsp/core/interpolator_base-inl.h b/media/libeffects/loudness/dsp/core/interpolator_base-inl.h
index bd08b65..fb87c79 100644
--- a/media/libeffects/loudness/dsp/core/interpolator_base-inl.h
+++ b/media/libeffects/loudness/dsp/core/interpolator_base-inl.h
@@ -16,13 +16,15 @@
#ifndef LE_FX_ENGINE_DSP_CORE_INTERPOLATOR_BASE_INL_H_
#define LE_FX_ENGINE_DSP_CORE_INTERPOLATOR_BASE_INL_H_
+#ifndef LOG_TAG
+#define LOG_TAG NULL
+#endif
+//#define LOG_NDEBUG 0
+
+#include <log/log.h>
#include "dsp/core/basic.h"
-//#define LOG_NDEBUG 0
-#include <cutils/log.h>
-
-
namespace le_fx {
namespace sigmod {
@@ -112,7 +114,7 @@
if (x_data_[n + 1] <= x_data_[n]) {
ALOGE("InterpolatorBase::Initialize: xData are not ordered or "
"contain equal values (X[%d] <= X[%d]) (%.5e <= %.5e)",
- n + 1, n, x_data_[n + 1], x_data_[n]);
+ n + 1, n, x_data_[n + 1], x_data_[n]);
status_ = false;
return false;
}
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h b/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h
index 94a7869..b1ebadf 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h
@@ -36,190 +36,190 @@
/* Coefficients for centre frequency 55Hz */
#define HPF_Fs8000_Fc55_A0 1029556328 /* Floating point value 0.958849 */
-#define HPF_Fs8000_Fc55_A1 -2059112655 /* Floating point value -1.917698 */
+#define HPF_Fs8000_Fc55_A1 (-2059112655) /* Floating point value -1.917698 */
#define HPF_Fs8000_Fc55_A2 1029556328 /* Floating point value 0.958849 */
-#define HPF_Fs8000_Fc55_B1 -2081986375 /* Floating point value -1.939001 */
+#define HPF_Fs8000_Fc55_B1 (-2081986375) /* Floating point value -1.939001 */
#define HPF_Fs8000_Fc55_B2 1010183914 /* Floating point value 0.940807 */
#define HPF_Fs11025_Fc55_A0 1038210831 /* Floating point value 0.966909 */
-#define HPF_Fs11025_Fc55_A1 -2076421662 /* Floating point value -1.933818 */
+#define HPF_Fs11025_Fc55_A1 (-2076421662) /* Floating point value -1.933818 */
#define HPF_Fs11025_Fc55_A2 1038210831 /* Floating point value 0.966909 */
-#define HPF_Fs11025_Fc55_B1 -2099950710 /* Floating point value -1.955732 */
+#define HPF_Fs11025_Fc55_B1 (-2099950710) /* Floating point value -1.955732 */
#define HPF_Fs11025_Fc55_B2 1027238450 /* Floating point value 0.956690 */
#define HPF_Fs12000_Fc55_A0 1040079943 /* Floating point value 0.968650 */
-#define HPF_Fs12000_Fc55_A1 -2080159885 /* Floating point value -1.937300 */
+#define HPF_Fs12000_Fc55_A1 (-2080159885) /* Floating point value -1.937300 */
#define HPF_Fs12000_Fc55_A2 1040079943 /* Floating point value 0.968650 */
-#define HPF_Fs12000_Fc55_B1 -2103811702 /* Floating point value -1.959327 */
+#define HPF_Fs12000_Fc55_B1 (-2103811702) /* Floating point value -1.959327 */
#define HPF_Fs12000_Fc55_B2 1030940477 /* Floating point value 0.960138 */
#define HPF_Fs16000_Fc55_A0 1045381988 /* Floating point value 0.973588 */
-#define HPF_Fs16000_Fc55_A1 -2090763976 /* Floating point value -1.947176 */
+#define HPF_Fs16000_Fc55_A1 (-2090763976) /* Floating point value -1.947176 */
#define HPF_Fs16000_Fc55_A2 1045381988 /* Floating point value 0.973588 */
-#define HPF_Fs16000_Fc55_B1 -2114727793 /* Floating point value -1.969494 */
+#define HPF_Fs16000_Fc55_B1 (-2114727793) /* Floating point value -1.969494 */
#define HPF_Fs16000_Fc55_B2 1041478147 /* Floating point value 0.969952 */
#define HPF_Fs22050_Fc55_A0 1049766523 /* Floating point value 0.977671 */
-#define HPF_Fs22050_Fc55_A1 -2099533046 /* Floating point value -1.955343 */
+#define HPF_Fs22050_Fc55_A1 (-2099533046) /* Floating point value -1.955343 */
#define HPF_Fs22050_Fc55_A2 1049766523 /* Floating point value 0.977671 */
-#define HPF_Fs22050_Fc55_B1 -2123714381 /* Floating point value -1.977863 */
+#define HPF_Fs22050_Fc55_B1 (-2123714381) /* Floating point value -1.977863 */
#define HPF_Fs22050_Fc55_B2 1050232780 /* Floating point value 0.978105 */
#define HPF_Fs24000_Fc55_A0 1050711051 /* Floating point value 0.978551 */
-#define HPF_Fs24000_Fc55_A1 -2101422103 /* Floating point value -1.957102 */
+#define HPF_Fs24000_Fc55_A1 (-2101422103) /* Floating point value -1.957102 */
#define HPF_Fs24000_Fc55_A2 1050711051 /* Floating point value 0.978551 */
-#define HPF_Fs24000_Fc55_B1 -2125645498 /* Floating point value -1.979662 */
+#define HPF_Fs24000_Fc55_B1 (-2125645498) /* Floating point value -1.979662 */
#define HPF_Fs24000_Fc55_B2 1052123526 /* Floating point value 0.979866 */
#define HPF_Fs32000_Fc55_A0 1053385759 /* Floating point value 0.981042 */
-#define HPF_Fs32000_Fc55_A1 -2106771519 /* Floating point value -1.962084 */
+#define HPF_Fs32000_Fc55_A1 (-2106771519) /* Floating point value -1.962084 */
#define HPF_Fs32000_Fc55_A2 1053385759 /* Floating point value 0.981042 */
-#define HPF_Fs32000_Fc55_B1 -2131104794 /* Floating point value -1.984746 */
+#define HPF_Fs32000_Fc55_B1 (-2131104794) /* Floating point value -1.984746 */
#define HPF_Fs32000_Fc55_B2 1057486949 /* Floating point value 0.984861 */
#define HPF_Fs44100_Fc55_A0 1055592498 /* Floating point value 0.983097 */
-#define HPF_Fs44100_Fc55_A1 -2111184995 /* Floating point value -1.966194 */
+#define HPF_Fs44100_Fc55_A1 (-2111184995) /* Floating point value -1.966194 */
#define HPF_Fs44100_Fc55_A2 1055592498 /* Floating point value 0.983097 */
-#define HPF_Fs44100_Fc55_B1 -2135598658 /* Floating point value -1.988931 */
+#define HPF_Fs44100_Fc55_B1 (-2135598658) /* Floating point value -1.988931 */
#define HPF_Fs44100_Fc55_B2 1061922249 /* Floating point value 0.988992 */
#define HPF_Fs48000_Fc55_A0 1056067276 /* Floating point value 0.983539 */
-#define HPF_Fs48000_Fc55_A1 -2112134551 /* Floating point value -1.967079 */
+#define HPF_Fs48000_Fc55_A1 (-2112134551) /* Floating point value -1.967079 */
#define HPF_Fs48000_Fc55_A2 1056067276 /* Floating point value 0.983539 */
-#define HPF_Fs48000_Fc55_B1 -2136564296 /* Floating point value -1.989831 */
+#define HPF_Fs48000_Fc55_B1 (-2136564296) /* Floating point value -1.989831 */
#define HPF_Fs48000_Fc55_B2 1062877714 /* Floating point value 0.989882 */
/* Coefficients for centre frequency 66Hz */
#define HPF_Fs8000_Fc66_A0 1023293271 /* Floating point value 0.953016 */
-#define HPF_Fs8000_Fc66_A1 -2046586542 /* Floating point value -1.906032 */
+#define HPF_Fs8000_Fc66_A1 (-2046586542) /* Floating point value -1.906032 */
#define HPF_Fs8000_Fc66_A2 1023293271 /* Floating point value 0.953016 */
-#define HPF_Fs8000_Fc66_B1 -2068896860 /* Floating point value -1.926810 */
+#define HPF_Fs8000_Fc66_B1 (-2068896860) /* Floating point value -1.926810 */
#define HPF_Fs8000_Fc66_B2 997931110 /* Floating point value 0.929396 */
#define HPF_Fs11025_Fc66_A0 1033624228 /* Floating point value 0.962638 */
-#define HPF_Fs11025_Fc66_A1 -2067248455 /* Floating point value -1.925275 */
+#define HPF_Fs11025_Fc66_A1 (-2067248455) /* Floating point value -1.925275 */
#define HPF_Fs11025_Fc66_A2 1033624228 /* Floating point value 0.962638 */
-#define HPF_Fs11025_Fc66_B1 -2090448000 /* Floating point value -1.946881 */
+#define HPF_Fs11025_Fc66_B1 (-2090448000) /* Floating point value -1.946881 */
#define HPF_Fs11025_Fc66_B2 1018182305 /* Floating point value 0.948256 */
#define HPF_Fs12000_Fc66_A0 1035857662 /* Floating point value 0.964718 */
-#define HPF_Fs12000_Fc66_A1 -2071715325 /* Floating point value -1.929435 */
+#define HPF_Fs12000_Fc66_A1 (-2071715325) /* Floating point value -1.929435 */
#define HPF_Fs12000_Fc66_A2 1035857662 /* Floating point value 0.964718 */
-#define HPF_Fs12000_Fc66_B1 -2095080333 /* Floating point value -1.951196 */
+#define HPF_Fs12000_Fc66_B1 (-2095080333) /* Floating point value -1.951196 */
#define HPF_Fs12000_Fc66_B2 1022587158 /* Floating point value 0.952359 */
#define HPF_Fs16000_Fc66_A0 1042197528 /* Floating point value 0.970622 */
-#define HPF_Fs16000_Fc66_A1 -2084395056 /* Floating point value -1.941244 */
+#define HPF_Fs16000_Fc66_A1 (-2084395056) /* Floating point value -1.941244 */
#define HPF_Fs16000_Fc66_A2 1042197528 /* Floating point value 0.970622 */
-#define HPF_Fs16000_Fc66_B1 -2108177912 /* Floating point value -1.963394 */
+#define HPF_Fs16000_Fc66_B1 (-2108177912) /* Floating point value -1.963394 */
#define HPF_Fs16000_Fc66_B2 1035142690 /* Floating point value 0.964052 */
#define HPF_Fs22050_Fc66_A0 1047445145 /* Floating point value 0.975509 */
-#define HPF_Fs22050_Fc66_A1 -2094890289 /* Floating point value -1.951019 */
+#define HPF_Fs22050_Fc66_A1 (-2094890289) /* Floating point value -1.951019 */
#define HPF_Fs22050_Fc66_A2 1047445145 /* Floating point value 0.975509 */
-#define HPF_Fs22050_Fc66_B1 -2118961025 /* Floating point value -1.973436 */
+#define HPF_Fs22050_Fc66_B1 (-2118961025) /* Floating point value -1.973436 */
#define HPF_Fs22050_Fc66_B2 1045593102 /* Floating point value 0.973784 */
#define HPF_Fs24000_Fc66_A0 1048576175 /* Floating point value 0.976563 */
-#define HPF_Fs24000_Fc66_A1 -2097152349 /* Floating point value -1.953125 */
+#define HPF_Fs24000_Fc66_A1 (-2097152349) /* Floating point value -1.953125 */
#define HPF_Fs24000_Fc66_A2 1048576175 /* Floating point value 0.976563 */
-#define HPF_Fs24000_Fc66_B1 -2121278255 /* Floating point value -1.975594 */
+#define HPF_Fs24000_Fc66_B1 (-2121278255) /* Floating point value -1.975594 */
#define HPF_Fs24000_Fc66_B2 1047852379 /* Floating point value 0.975889 */
#define HPF_Fs32000_Fc66_A0 1051780119 /* Floating point value 0.979547 */
-#define HPF_Fs32000_Fc66_A1 -2103560237 /* Floating point value -1.959093 */
+#define HPF_Fs32000_Fc66_A1 (-2103560237) /* Floating point value -1.959093 */
#define HPF_Fs32000_Fc66_A2 1051780119 /* Floating point value 0.979547 */
-#define HPF_Fs32000_Fc66_B1 -2127829187 /* Floating point value -1.981695 */
+#define HPF_Fs32000_Fc66_B1 (-2127829187) /* Floating point value -1.981695 */
#define HPF_Fs32000_Fc66_B2 1054265623 /* Floating point value 0.981861 */
#define HPF_Fs44100_Fc66_A0 1054424722 /* Floating point value 0.982010 */
-#define HPF_Fs44100_Fc66_A1 -2108849444 /* Floating point value -1.964019 */
+#define HPF_Fs44100_Fc66_A1 (-2108849444) /* Floating point value -1.964019 */
#define HPF_Fs44100_Fc66_A2 1054424722 /* Floating point value 0.982010 */
-#define HPF_Fs44100_Fc66_B1 -2133221723 /* Floating point value -1.986718 */
+#define HPF_Fs44100_Fc66_B1 (-2133221723) /* Floating point value -1.986718 */
#define HPF_Fs44100_Fc66_B2 1059573993 /* Floating point value 0.986805 */
#define HPF_Fs48000_Fc66_A0 1054993851 /* Floating point value 0.982540 */
-#define HPF_Fs48000_Fc66_A1 -2109987702 /* Floating point value -1.965079 */
+#define HPF_Fs48000_Fc66_A1 (-2109987702) /* Floating point value -1.965079 */
#define HPF_Fs48000_Fc66_A2 1054993851 /* Floating point value 0.982540 */
-#define HPF_Fs48000_Fc66_B1 -2134380475 /* Floating point value -1.987797 */
+#define HPF_Fs48000_Fc66_B1 (-2134380475) /* Floating point value -1.987797 */
#define HPF_Fs48000_Fc66_B2 1060718118 /* Floating point value 0.987871 */
/* Coefficients for centre frequency 78Hz */
#define HPF_Fs8000_Fc78_A0 1016504203 /* Floating point value 0.946693 */
-#define HPF_Fs8000_Fc78_A1 -2033008405 /* Floating point value -1.893387 */
+#define HPF_Fs8000_Fc78_A1 (-2033008405) /* Floating point value -1.893387 */
#define HPF_Fs8000_Fc78_A2 1016504203 /* Floating point value 0.946693 */
-#define HPF_Fs8000_Fc78_B1 -2054623390 /* Floating point value -1.913517 */
+#define HPF_Fs8000_Fc78_B1 (-2054623390) /* Floating point value -1.913517 */
#define HPF_Fs8000_Fc78_B2 984733853 /* Floating point value 0.917105 */
#define HPF_Fs11025_Fc78_A0 1028643741 /* Floating point value 0.957999 */
-#define HPF_Fs11025_Fc78_A1 -2057287482 /* Floating point value -1.915998 */
+#define HPF_Fs11025_Fc78_A1 (-2057287482) /* Floating point value -1.915998 */
#define HPF_Fs11025_Fc78_A2 1028643741 /* Floating point value 0.957999 */
-#define HPF_Fs11025_Fc78_B1 -2080083769 /* Floating point value -1.937229 */
+#define HPF_Fs11025_Fc78_B1 (-2080083769) /* Floating point value -1.937229 */
#define HPF_Fs11025_Fc78_B2 1008393904 /* Floating point value 0.939140 */
#define HPF_Fs12000_Fc78_A0 1031271067 /* Floating point value 0.960446 */
-#define HPF_Fs12000_Fc78_A1 -2062542133 /* Floating point value -1.920892 */
+#define HPF_Fs12000_Fc78_A1 (-2062542133) /* Floating point value -1.920892 */
#define HPF_Fs12000_Fc78_A2 1031271067 /* Floating point value 0.960446 */
-#define HPF_Fs12000_Fc78_B1 -2085557048 /* Floating point value -1.942326 */
+#define HPF_Fs12000_Fc78_B1 (-2085557048) /* Floating point value -1.942326 */
#define HPF_Fs12000_Fc78_B2 1013551620 /* Floating point value 0.943944 */
#define HPF_Fs16000_Fc78_A0 1038734628 /* Floating point value 0.967397 */
-#define HPF_Fs16000_Fc78_A1 -2077469256 /* Floating point value -1.934794 */
+#define HPF_Fs16000_Fc78_A1 (-2077469256) /* Floating point value -1.934794 */
#define HPF_Fs16000_Fc78_A2 1038734628 /* Floating point value 0.967397 */
-#define HPF_Fs16000_Fc78_B1 -2101033380 /* Floating point value -1.956740 */
+#define HPF_Fs16000_Fc78_B1 (-2101033380) /* Floating point value -1.956740 */
#define HPF_Fs16000_Fc78_B2 1028275228 /* Floating point value 0.957656 */
#define HPF_Fs22050_Fc78_A0 1044918584 /* Floating point value 0.973156 */
-#define HPF_Fs22050_Fc78_A1 -2089837169 /* Floating point value -1.946313 */
+#define HPF_Fs22050_Fc78_A1 (-2089837169) /* Floating point value -1.946313 */
#define HPF_Fs22050_Fc78_A2 1044918584 /* Floating point value 0.973156 */
-#define HPF_Fs22050_Fc78_B1 -2113775854 /* Floating point value -1.968607 */
+#define HPF_Fs22050_Fc78_B1 (-2113775854) /* Floating point value -1.968607 */
#define HPF_Fs22050_Fc78_B2 1040555007 /* Floating point value 0.969092 */
#define HPF_Fs24000_Fc78_A0 1046252164 /* Floating point value 0.974398 */
-#define HPF_Fs24000_Fc78_A1 -2092504328 /* Floating point value -1.948797 */
+#define HPF_Fs24000_Fc78_A1 (-2092504328) /* Floating point value -1.948797 */
#define HPF_Fs24000_Fc78_A2 1046252164 /* Floating point value 0.974398 */
-#define HPF_Fs24000_Fc78_B1 -2116514229 /* Floating point value -1.971157 */
+#define HPF_Fs24000_Fc78_B1 (-2116514229) /* Floating point value -1.971157 */
#define HPF_Fs24000_Fc78_B2 1043212719 /* Floating point value 0.971568 */
#define HPF_Fs32000_Fc78_A0 1050031301 /* Floating point value 0.977918 */
-#define HPF_Fs32000_Fc78_A1 -2100062603 /* Floating point value -1.955836 */
+#define HPF_Fs32000_Fc78_A1 (-2100062603) /* Floating point value -1.955836 */
#define HPF_Fs32000_Fc78_A2 1050031301 /* Floating point value 0.977918 */
-#define HPF_Fs32000_Fc78_B1 -2124255900 /* Floating point value -1.978367 */
+#define HPF_Fs32000_Fc78_B1 (-2124255900) /* Floating point value -1.978367 */
#define HPF_Fs32000_Fc78_B2 1050762639 /* Floating point value 0.978599 */
#define HPF_Fs44100_Fc78_A0 1053152258 /* Floating point value 0.980824 */
-#define HPF_Fs44100_Fc78_A1 -2106304516 /* Floating point value -1.961649 */
+#define HPF_Fs44100_Fc78_A1 (-2106304516) /* Floating point value -1.961649 */
#define HPF_Fs44100_Fc78_A2 1053152258 /* Floating point value 0.980824 */
-#define HPF_Fs44100_Fc78_B1 -2130628742 /* Floating point value -1.984303 */
+#define HPF_Fs44100_Fc78_B1 (-2130628742) /* Floating point value -1.984303 */
#define HPF_Fs44100_Fc78_B2 1057018180 /* Floating point value 0.984425 */
#define HPF_Fs48000_Fc78_A0 1053824087 /* Floating point value 0.981450 */
-#define HPF_Fs48000_Fc78_A1 -2107648173 /* Floating point value -1.962900 */
+#define HPF_Fs48000_Fc78_A1 (-2107648173) /* Floating point value -1.962900 */
#define HPF_Fs48000_Fc78_A2 1053824087 /* Floating point value 0.981450 */
-#define HPF_Fs48000_Fc78_B1 -2131998154 /* Floating point value -1.985578 */
+#define HPF_Fs48000_Fc78_B1 (-2131998154) /* Floating point value -1.985578 */
#define HPF_Fs48000_Fc78_B2 1058367200 /* Floating point value 0.985681 */
/* Coefficients for centre frequency 90Hz */
#define HPF_Fs8000_Fc90_A0 1009760053 /* Floating point value 0.940412 */
-#define HPF_Fs8000_Fc90_A1 -2019520105 /* Floating point value -1.880825 */
+#define HPF_Fs8000_Fc90_A1 (-2019520105) /* Floating point value -1.880825 */
#define HPF_Fs8000_Fc90_A2 1009760053 /* Floating point value 0.940412 */
-#define HPF_Fs8000_Fc90_B1 -2040357139 /* Floating point value -1.900231 */
+#define HPF_Fs8000_Fc90_B1 (-2040357139) /* Floating point value -1.900231 */
#define HPF_Fs8000_Fc90_B2 971711129 /* Floating point value 0.904977 */
#define HPF_Fs11025_Fc90_A0 1023687217 /* Floating point value 0.953383 */
-#define HPF_Fs11025_Fc90_A1 -2047374434 /* Floating point value -1.906766 */
+#define HPF_Fs11025_Fc90_A1 (-2047374434) /* Floating point value -1.906766 */
#define HPF_Fs11025_Fc90_A2 1023687217 /* Floating point value 0.953383 */
-#define HPF_Fs11025_Fc90_B1 -2069722397 /* Floating point value -1.927579 */
+#define HPF_Fs11025_Fc90_B1 (-2069722397) /* Floating point value -1.927579 */
#define HPF_Fs11025_Fc90_B2 998699604 /* Floating point value 0.930111 */
#define HPF_Fs12000_Fc90_A0 1026704754 /* Floating point value 0.956193 */
-#define HPF_Fs12000_Fc90_A1 -2053409508 /* Floating point value -1.912387 */
+#define HPF_Fs12000_Fc90_A1 (-2053409508) /* Floating point value -1.912387 */
#define HPF_Fs12000_Fc90_A2 1026704754 /* Floating point value 0.956193 */
-#define HPF_Fs12000_Fc90_B1 -2076035996 /* Floating point value -1.933459 */
+#define HPF_Fs12000_Fc90_B1 (-2076035996) /* Floating point value -1.933459 */
#define HPF_Fs12000_Fc90_B2 1004595918 /* Floating point value 0.935603 */
#define HPF_Fs16000_Fc90_A0 1035283225 /* Floating point value 0.964183 */
-#define HPF_Fs16000_Fc90_A1 -2070566451 /* Floating point value -1.928365 */
+#define HPF_Fs16000_Fc90_A1 (-2070566451) /* Floating point value -1.928365 */
#define HPF_Fs16000_Fc90_A2 1035283225 /* Floating point value 0.964183 */
-#define HPF_Fs16000_Fc90_B1 -2093889811 /* Floating point value -1.950087 */
+#define HPF_Fs16000_Fc90_B1 (-2093889811) /* Floating point value -1.950087 */
#define HPF_Fs16000_Fc90_B2 1021453326 /* Floating point value 0.951303 */
#define HPF_Fs22050_Fc90_A0 1042398116 /* Floating point value 0.970809 */
-#define HPF_Fs22050_Fc90_A1 -2084796232 /* Floating point value -1.941618 */
+#define HPF_Fs22050_Fc90_A1 (-2084796232) /* Floating point value -1.941618 */
#define HPF_Fs22050_Fc90_A2 1042398116 /* Floating point value 0.970809 */
-#define HPF_Fs22050_Fc90_B1 -2108591057 /* Floating point value -1.963778 */
+#define HPF_Fs22050_Fc90_B1 (-2108591057) /* Floating point value -1.963778 */
#define HPF_Fs22050_Fc90_B2 1035541188 /* Floating point value 0.964423 */
#define HPF_Fs24000_Fc90_A0 1043933302 /* Floating point value 0.972239 */
-#define HPF_Fs24000_Fc90_A1 -2087866604 /* Floating point value -1.944477 */
+#define HPF_Fs24000_Fc90_A1 (-2087866604) /* Floating point value -1.944477 */
#define HPF_Fs24000_Fc90_A2 1043933302 /* Floating point value 0.972239 */
-#define HPF_Fs24000_Fc90_B1 -2111750495 /* Floating point value -1.966721 */
+#define HPF_Fs24000_Fc90_B1 (-2111750495) /* Floating point value -1.966721 */
#define HPF_Fs24000_Fc90_B2 1038593601 /* Floating point value 0.967266 */
#define HPF_Fs32000_Fc90_A0 1048285391 /* Floating point value 0.976292 */
-#define HPF_Fs32000_Fc90_A1 -2096570783 /* Floating point value -1.952584 */
+#define HPF_Fs32000_Fc90_A1 (-2096570783) /* Floating point value -1.952584 */
#define HPF_Fs32000_Fc90_A2 1048285391 /* Floating point value 0.976292 */
-#define HPF_Fs32000_Fc90_B1 -2120682737 /* Floating point value -1.975040 */
+#define HPF_Fs32000_Fc90_B1 (-2120682737) /* Floating point value -1.975040 */
#define HPF_Fs32000_Fc90_B2 1047271295 /* Floating point value 0.975347 */
#define HPF_Fs44100_Fc90_A0 1051881330 /* Floating point value 0.979641 */
-#define HPF_Fs44100_Fc90_A1 -2103762660 /* Floating point value -1.959282 */
+#define HPF_Fs44100_Fc90_A1 (-2103762660) /* Floating point value -1.959282 */
#define HPF_Fs44100_Fc90_A2 1051881330 /* Floating point value 0.979641 */
-#define HPF_Fs44100_Fc90_B1 -2128035809 /* Floating point value -1.981888 */
+#define HPF_Fs44100_Fc90_B1 (-2128035809) /* Floating point value -1.981888 */
#define HPF_Fs44100_Fc90_B2 1054468533 /* Floating point value 0.982050 */
#define HPF_Fs48000_Fc90_A0 1052655619 /* Floating point value 0.980362 */
-#define HPF_Fs48000_Fc90_A1 -2105311238 /* Floating point value -1.960724 */
+#define HPF_Fs48000_Fc90_A1 (-2105311238) /* Floating point value -1.960724 */
#define HPF_Fs48000_Fc90_A2 1052655619 /* Floating point value 0.980362 */
-#define HPF_Fs48000_Fc90_B1 -2129615871 /* Floating point value -1.983359 */
+#define HPF_Fs48000_Fc90_B1 (-2129615871) /* Floating point value -1.983359 */
#define HPF_Fs48000_Fc90_B2 1056021492 /* Floating point value 0.983497 */
@@ -232,189 +232,189 @@
/* Coefficients for centre frequency 55Hz */
#define BPF_Fs8000_Fc55_A0 9875247 /* Floating point value 0.009197 */
#define BPF_Fs8000_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs8000_Fc55_A2 -9875247 /* Floating point value -0.009197 */
-#define BPF_Fs8000_Fc55_B1 -2125519830 /* Floating point value -1.979545 */
+#define BPF_Fs8000_Fc55_A2 (-9875247) /* Floating point value -0.009197 */
+#define BPF_Fs8000_Fc55_B1 (-2125519830) /* Floating point value -1.979545 */
#define BPF_Fs8000_Fc55_B2 1053762629 /* Floating point value 0.981393 */
#define BPF_Fs11025_Fc55_A0 7183952 /* Floating point value 0.006691 */
#define BPF_Fs11025_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs11025_Fc55_A2 -7183952 /* Floating point value -0.006691 */
-#define BPF_Fs11025_Fc55_B1 -2131901658 /* Floating point value -1.985488 */
+#define BPF_Fs11025_Fc55_A2 (-7183952) /* Floating point value -0.006691 */
+#define BPF_Fs11025_Fc55_B1 (-2131901658) /* Floating point value -1.985488 */
#define BPF_Fs11025_Fc55_B2 1059207548 /* Floating point value 0.986464 */
#define BPF_Fs12000_Fc55_A0 6603871 /* Floating point value 0.006150 */
#define BPF_Fs12000_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs12000_Fc55_A2 -6603871 /* Floating point value -0.006150 */
-#define BPF_Fs12000_Fc55_B1 -2133238092 /* Floating point value -1.986733 */
+#define BPF_Fs12000_Fc55_A2 (-6603871) /* Floating point value -0.006150 */
+#define BPF_Fs12000_Fc55_B1 (-2133238092) /* Floating point value -1.986733 */
#define BPF_Fs12000_Fc55_B2 1060381143 /* Floating point value 0.987557 */
#define BPF_Fs16000_Fc55_A0 4960591 /* Floating point value 0.004620 */
#define BPF_Fs16000_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs16000_Fc55_A2 -4960591 /* Floating point value -0.004620 */
-#define BPF_Fs16000_Fc55_B1 -2136949052 /* Floating point value -1.990189 */
+#define BPF_Fs16000_Fc55_A2 (-4960591) /* Floating point value -0.004620 */
+#define BPF_Fs16000_Fc55_B1 (-2136949052) /* Floating point value -1.990189 */
#define BPF_Fs16000_Fc55_B2 1063705760 /* Floating point value 0.990653 */
#define BPF_Fs22050_Fc55_A0 3604131 /* Floating point value 0.003357 */
#define BPF_Fs22050_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs22050_Fc55_A2 -3604131 /* Floating point value -0.003357 */
-#define BPF_Fs22050_Fc55_B1 -2139929085 /* Floating point value -1.992964 */
+#define BPF_Fs22050_Fc55_A2 (-3604131) /* Floating point value -0.003357 */
+#define BPF_Fs22050_Fc55_B1 (-2139929085) /* Floating point value -1.992964 */
#define BPF_Fs22050_Fc55_B2 1066450095 /* Floating point value 0.993209 */
#define BPF_Fs24000_Fc55_A0 3312207 /* Floating point value 0.003085 */
#define BPF_Fs24000_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs24000_Fc55_A2 -3312207 /* Floating point value -0.003085 */
-#define BPF_Fs24000_Fc55_B1 -2140560606 /* Floating point value -1.993552 */
+#define BPF_Fs24000_Fc55_A2 (-3312207) /* Floating point value -0.003085 */
+#define BPF_Fs24000_Fc55_B1 (-2140560606) /* Floating point value -1.993552 */
#define BPF_Fs24000_Fc55_B2 1067040703 /* Floating point value 0.993759 */
#define BPF_Fs32000_Fc55_A0 2486091 /* Floating point value 0.002315 */
#define BPF_Fs32000_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs32000_Fc55_A2 -2486091 /* Floating point value -0.002315 */
-#define BPF_Fs32000_Fc55_B1 -2142328962 /* Floating point value -1.995199 */
+#define BPF_Fs32000_Fc55_A2 (-2486091) /* Floating point value -0.002315 */
+#define BPF_Fs32000_Fc55_B1 (-2142328962) /* Floating point value -1.995199 */
#define BPF_Fs32000_Fc55_B2 1068712067 /* Floating point value 0.995316 */
#define BPF_Fs44100_Fc55_A0 1805125 /* Floating point value 0.001681 */
#define BPF_Fs44100_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs44100_Fc55_A2 -1805125 /* Floating point value -0.001681 */
-#define BPF_Fs44100_Fc55_B1 -2143765772 /* Floating point value -1.996537 */
+#define BPF_Fs44100_Fc55_A2 (-1805125) /* Floating point value -0.001681 */
+#define BPF_Fs44100_Fc55_B1 (-2143765772) /* Floating point value -1.996537 */
#define BPF_Fs44100_Fc55_B2 1070089770 /* Floating point value 0.996599 */
#define BPF_Fs48000_Fc55_A0 1658687 /* Floating point value 0.001545 */
#define BPF_Fs48000_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs48000_Fc55_A2 -1658687 /* Floating point value -0.001545 */
-#define BPF_Fs48000_Fc55_B1 -2144072292 /* Floating point value -1.996823 */
+#define BPF_Fs48000_Fc55_A2 (-1658687) /* Floating point value -0.001545 */
+#define BPF_Fs48000_Fc55_B1 (-2144072292) /* Floating point value -1.996823 */
#define BPF_Fs48000_Fc55_B2 1070386036 /* Floating point value 0.996875 */
/* Coefficients for centre frequency 66Hz */
#define BPF_Fs8000_Fc66_A0 13580189 /* Floating point value 0.012648 */
#define BPF_Fs8000_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs8000_Fc66_A2 -13580189 /* Floating point value -0.012648 */
-#define BPF_Fs8000_Fc66_B1 -2117161175 /* Floating point value -1.971760 */
+#define BPF_Fs8000_Fc66_A2 (-13580189) /* Floating point value -0.012648 */
+#define BPF_Fs8000_Fc66_B1 (-2117161175) /* Floating point value -1.971760 */
#define BPF_Fs8000_Fc66_B2 1046266945 /* Floating point value 0.974412 */
#define BPF_Fs11025_Fc66_A0 9888559 /* Floating point value 0.009209 */
#define BPF_Fs11025_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs11025_Fc66_A2 -9888559 /* Floating point value -0.009209 */
-#define BPF_Fs11025_Fc66_B1 -2125972738 /* Floating point value -1.979966 */
+#define BPF_Fs11025_Fc66_A2 (-9888559) /* Floating point value -0.009209 */
+#define BPF_Fs11025_Fc66_B1 (-2125972738) /* Floating point value -1.979966 */
#define BPF_Fs11025_Fc66_B2 1053735698 /* Floating point value 0.981368 */
#define BPF_Fs12000_Fc66_A0 9091954 /* Floating point value 0.008468 */
#define BPF_Fs12000_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs12000_Fc66_A2 -9091954 /* Floating point value -0.008468 */
-#define BPF_Fs12000_Fc66_B1 -2127818004 /* Floating point value -1.981685 */
+#define BPF_Fs12000_Fc66_A2 (-9091954) /* Floating point value -0.008468 */
+#define BPF_Fs12000_Fc66_B1 (-2127818004) /* Floating point value -1.981685 */
#define BPF_Fs12000_Fc66_B2 1055347356 /* Floating point value 0.982869 */
#define BPF_Fs16000_Fc66_A0 6833525 /* Floating point value 0.006364 */
#define BPF_Fs16000_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs16000_Fc66_A2 -6833525 /* Floating point value -0.006364 */
-#define BPF_Fs16000_Fc66_B1 -2132941739 /* Floating point value -1.986457 */
+#define BPF_Fs16000_Fc66_A2 (-6833525) /* Floating point value -0.006364 */
+#define BPF_Fs16000_Fc66_B1 (-2132941739) /* Floating point value -1.986457 */
#define BPF_Fs16000_Fc66_B2 1059916517 /* Floating point value 0.987124 */
#define BPF_Fs22050_Fc66_A0 4967309 /* Floating point value 0.004626 */
#define BPF_Fs22050_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs22050_Fc66_A2 -4967309 /* Floating point value -0.004626 */
-#define BPF_Fs22050_Fc66_B1 -2137056003 /* Floating point value -1.990288 */
+#define BPF_Fs22050_Fc66_A2 (-4967309) /* Floating point value -0.004626 */
+#define BPF_Fs22050_Fc66_B1 (-2137056003) /* Floating point value -1.990288 */
#define BPF_Fs22050_Fc66_B2 1063692170 /* Floating point value 0.990641 */
#define BPF_Fs24000_Fc66_A0 4565445 /* Floating point value 0.004252 */
#define BPF_Fs24000_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs24000_Fc66_A2 -4565445 /* Floating point value -0.004252 */
-#define BPF_Fs24000_Fc66_B1 -2137927842 /* Floating point value -1.991100 */
+#define BPF_Fs24000_Fc66_A2 (-4565445) /* Floating point value -0.004252 */
+#define BPF_Fs24000_Fc66_B1 (-2137927842) /* Floating point value -1.991100 */
#define BPF_Fs24000_Fc66_B2 1064505202 /* Floating point value 0.991398 */
#define BPF_Fs32000_Fc66_A0 3427761 /* Floating point value 0.003192 */
#define BPF_Fs32000_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs32000_Fc66_A2 -3427761 /* Floating point value -0.003192 */
-#define BPF_Fs32000_Fc66_B1 -2140369007 /* Floating point value -1.993374 */
+#define BPF_Fs32000_Fc66_A2 (-3427761) /* Floating point value -0.003192 */
+#define BPF_Fs32000_Fc66_B1 (-2140369007) /* Floating point value -1.993374 */
#define BPF_Fs32000_Fc66_B2 1066806920 /* Floating point value 0.993541 */
#define BPF_Fs44100_Fc66_A0 2489466 /* Floating point value 0.002318 */
#define BPF_Fs44100_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs44100_Fc66_A2 -2489466 /* Floating point value -0.002318 */
-#define BPF_Fs44100_Fc66_B1 -2142352342 /* Floating point value -1.995221 */
+#define BPF_Fs44100_Fc66_A2 (-2489466) /* Floating point value -0.002318 */
+#define BPF_Fs44100_Fc66_B1 (-2142352342) /* Floating point value -1.995221 */
#define BPF_Fs44100_Fc66_B2 1068705240 /* Floating point value 0.995309 */
#define BPF_Fs48000_Fc66_A0 2287632 /* Floating point value 0.002131 */
#define BPF_Fs48000_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs48000_Fc66_A2 -2287632 /* Floating point value -0.002131 */
-#define BPF_Fs48000_Fc66_B1 -2142775436 /* Floating point value -1.995615 */
+#define BPF_Fs48000_Fc66_A2 (-2287632) /* Floating point value -0.002131 */
+#define BPF_Fs48000_Fc66_B1 (-2142775436) /* Floating point value -1.995615 */
#define BPF_Fs48000_Fc66_B2 1069113581 /* Floating point value 0.995690 */
/* Coefficients for centre frequency 78Hz */
#define BPF_Fs8000_Fc78_A0 19941180 /* Floating point value 0.018572 */
#define BPF_Fs8000_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs8000_Fc78_A2 -19941180 /* Floating point value -0.018572 */
-#define BPF_Fs8000_Fc78_B1 -2103186749 /* Floating point value -1.958745 */
+#define BPF_Fs8000_Fc78_A2 (-19941180) /* Floating point value -0.018572 */
+#define BPF_Fs8000_Fc78_B1 (-2103186749) /* Floating point value -1.958745 */
#define BPF_Fs8000_Fc78_B2 1033397648 /* Floating point value 0.962427 */
#define BPF_Fs11025_Fc78_A0 14543934 /* Floating point value 0.013545 */
#define BPF_Fs11025_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs11025_Fc78_A2 -14543934 /* Floating point value -0.013545 */
-#define BPF_Fs11025_Fc78_B1 -2115966638 /* Floating point value -1.970647 */
+#define BPF_Fs11025_Fc78_A2 (-14543934) /* Floating point value -0.013545 */
+#define BPF_Fs11025_Fc78_B1 (-2115966638) /* Floating point value -1.970647 */
#define BPF_Fs11025_Fc78_B2 1044317135 /* Floating point value 0.972596 */
#define BPF_Fs12000_Fc78_A0 13376999 /* Floating point value 0.012458 */
#define BPF_Fs12000_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs12000_Fc78_A2 -13376999 /* Floating point value -0.012458 */
-#define BPF_Fs12000_Fc78_B1 -2118651708 /* Floating point value -1.973148 */
+#define BPF_Fs12000_Fc78_A2 (-13376999) /* Floating point value -0.012458 */
+#define BPF_Fs12000_Fc78_B1 (-2118651708) /* Floating point value -1.973148 */
#define BPF_Fs12000_Fc78_B2 1046678029 /* Floating point value 0.974795 */
#define BPF_Fs16000_Fc78_A0 10064222 /* Floating point value 0.009373 */
#define BPF_Fs16000_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs16000_Fc78_A2 -10064222 /* Floating point value -0.009373 */
-#define BPF_Fs16000_Fc78_B1 -2126124342 /* Floating point value -1.980108 */
+#define BPF_Fs16000_Fc78_A2 (-10064222) /* Floating point value -0.009373 */
+#define BPF_Fs16000_Fc78_B1 (-2126124342) /* Floating point value -1.980108 */
#define BPF_Fs16000_Fc78_B2 1053380304 /* Floating point value 0.981037 */
#define BPF_Fs22050_Fc78_A0 7321780 /* Floating point value 0.006819 */
#define BPF_Fs22050_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs22050_Fc78_A2 -7321780 /* Floating point value -0.006819 */
-#define BPF_Fs22050_Fc78_B1 -2132143771 /* Floating point value -1.985714 */
+#define BPF_Fs22050_Fc78_A2 (-7321780) /* Floating point value -0.006819 */
+#define BPF_Fs22050_Fc78_B1 (-2132143771) /* Floating point value -1.985714 */
#define BPF_Fs22050_Fc78_B2 1058928700 /* Floating point value 0.986204 */
#define BPF_Fs24000_Fc78_A0 6730640 /* Floating point value 0.006268 */
#define BPF_Fs24000_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs24000_Fc78_A2 -6730640 /* Floating point value -0.006268 */
-#define BPF_Fs24000_Fc78_B1 -2133421607 /* Floating point value -1.986904 */
+#define BPF_Fs24000_Fc78_A2 (-6730640) /* Floating point value -0.006268 */
+#define BPF_Fs24000_Fc78_B1 (-2133421607) /* Floating point value -1.986904 */
#define BPF_Fs24000_Fc78_B2 1060124669 /* Floating point value 0.987318 */
#define BPF_Fs32000_Fc78_A0 5055965 /* Floating point value 0.004709 */
#define BPF_Fs32000_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs32000_Fc78_A2 -5055965 /* Floating point value -0.004709 */
-#define BPF_Fs32000_Fc78_B1 -2137003977 /* Floating point value -1.990240 */
+#define BPF_Fs32000_Fc78_A2 (-5055965) /* Floating point value -0.004709 */
+#define BPF_Fs32000_Fc78_B1 (-2137003977) /* Floating point value -1.990240 */
#define BPF_Fs32000_Fc78_B2 1063512802 /* Floating point value 0.990473 */
#define BPF_Fs44100_Fc78_A0 3673516 /* Floating point value 0.003421 */
#define BPF_Fs44100_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs44100_Fc78_A2 -3673516 /* Floating point value -0.003421 */
-#define BPF_Fs44100_Fc78_B1 -2139919394 /* Floating point value -1.992955 */
+#define BPF_Fs44100_Fc78_A2 (-3673516) /* Floating point value -0.003421 */
+#define BPF_Fs44100_Fc78_B1 (-2139919394) /* Floating point value -1.992955 */
#define BPF_Fs44100_Fc78_B2 1066309718 /* Floating point value 0.993078 */
#define BPF_Fs48000_Fc78_A0 3375990 /* Floating point value 0.003144 */
#define BPF_Fs48000_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs48000_Fc78_A2 -3375990 /* Floating point value -0.003144 */
-#define BPF_Fs48000_Fc78_B1 -2140541906 /* Floating point value -1.993535 */
+#define BPF_Fs48000_Fc78_A2 (-3375990) /* Floating point value -0.003144 */
+#define BPF_Fs48000_Fc78_B1 (-2140541906) /* Floating point value -1.993535 */
#define BPF_Fs48000_Fc78_B2 1066911660 /* Floating point value 0.993639 */
/* Coefficients for centre frequency 90Hz */
#define BPF_Fs8000_Fc90_A0 24438548 /* Floating point value 0.022760 */
#define BPF_Fs8000_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs8000_Fc90_A2 -24438548 /* Floating point value -0.022760 */
-#define BPF_Fs8000_Fc90_B1 -2092801347 /* Floating point value -1.949073 */
+#define BPF_Fs8000_Fc90_A2 (-24438548) /* Floating point value -0.022760 */
+#define BPF_Fs8000_Fc90_B1 (-2092801347) /* Floating point value -1.949073 */
#define BPF_Fs8000_Fc90_B2 1024298757 /* Floating point value 0.953953 */
#define BPF_Fs11025_Fc90_A0 17844385 /* Floating point value 0.016619 */
#define BPF_Fs11025_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs11025_Fc90_A2 -17844385 /* Floating point value -0.016619 */
-#define BPF_Fs11025_Fc90_B1 -2108604921 /* Floating point value -1.963791 */
+#define BPF_Fs11025_Fc90_A2 (-17844385) /* Floating point value -0.016619 */
+#define BPF_Fs11025_Fc90_B1 (-2108604921) /* Floating point value -1.963791 */
#define BPF_Fs11025_Fc90_B2 1037639797 /* Floating point value 0.966377 */
#define BPF_Fs12000_Fc90_A0 16416707 /* Floating point value 0.015289 */
#define BPF_Fs12000_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs12000_Fc90_A2 -16416707 /* Floating point value -0.015289 */
-#define BPF_Fs12000_Fc90_B1 -2111922936 /* Floating point value -1.966882 */
+#define BPF_Fs12000_Fc90_A2 (-16416707) /* Floating point value -0.015289 */
+#define BPF_Fs12000_Fc90_B1 (-2111922936) /* Floating point value -1.966882 */
#define BPF_Fs12000_Fc90_B2 1040528216 /* Floating point value 0.969067 */
#define BPF_Fs16000_Fc90_A0 12359883 /* Floating point value 0.011511 */
#define BPF_Fs16000_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs16000_Fc90_A2 -12359883 /* Floating point value -0.011511 */
-#define BPF_Fs16000_Fc90_B1 -2121152162 /* Floating point value -1.975477 */
+#define BPF_Fs16000_Fc90_A2 (-12359883) /* Floating point value -0.011511 */
+#define BPF_Fs16000_Fc90_B1 (-2121152162) /* Floating point value -1.975477 */
#define BPF_Fs16000_Fc90_B2 1048735817 /* Floating point value 0.976711 */
#define BPF_Fs22050_Fc90_A0 8997173 /* Floating point value 0.008379 */
#define BPF_Fs22050_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs22050_Fc90_A2 -8997173 /* Floating point value -0.008379 */
-#define BPF_Fs22050_Fc90_B1 -2128580762 /* Floating point value -1.982395 */
+#define BPF_Fs22050_Fc90_A2 (-8997173) /* Floating point value -0.008379 */
+#define BPF_Fs22050_Fc90_B1 (-2128580762) /* Floating point value -1.982395 */
#define BPF_Fs22050_Fc90_B2 1055539113 /* Floating point value 0.983047 */
#define BPF_Fs24000_Fc90_A0 8271818 /* Floating point value 0.007704 */
#define BPF_Fs24000_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs24000_Fc90_A2 -8271818 /* Floating point value -0.007704 */
-#define BPF_Fs24000_Fc90_B1 -2130157013 /* Floating point value -1.983863 */
+#define BPF_Fs24000_Fc90_A2 (-8271818) /* Floating point value -0.007704 */
+#define BPF_Fs24000_Fc90_B1 (-2130157013) /* Floating point value -1.983863 */
#define BPF_Fs24000_Fc90_B2 1057006621 /* Floating point value 0.984414 */
#define BPF_Fs32000_Fc90_A0 6215918 /* Floating point value 0.005789 */
#define BPF_Fs32000_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs32000_Fc90_A2 -6215918 /* Floating point value -0.005789 */
-#define BPF_Fs32000_Fc90_B1 -2134574521 /* Floating point value -1.987977 */
+#define BPF_Fs32000_Fc90_A2 (-6215918) /* Floating point value -0.005789 */
+#define BPF_Fs32000_Fc90_B1 (-2134574521) /* Floating point value -1.987977 */
#define BPF_Fs32000_Fc90_B2 1061166033 /* Floating point value 0.988288 */
#define BPF_Fs44100_Fc90_A0 4517651 /* Floating point value 0.004207 */
#define BPF_Fs44100_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs44100_Fc90_A2 -4517651 /* Floating point value -0.004207 */
-#define BPF_Fs44100_Fc90_B1 -2138167926 /* Floating point value -1.991324 */
+#define BPF_Fs44100_Fc90_A2 (-4517651) /* Floating point value -0.004207 */
+#define BPF_Fs44100_Fc90_B1 (-2138167926) /* Floating point value -1.991324 */
#define BPF_Fs44100_Fc90_B2 1064601898 /* Floating point value 0.991488 */
#define BPF_Fs48000_Fc90_A0 4152024 /* Floating point value 0.003867 */
#define BPF_Fs48000_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs48000_Fc90_A2 -4152024 /* Floating point value -0.003867 */
-#define BPF_Fs48000_Fc90_B1 -2138935002 /* Floating point value -1.992038 */
+#define BPF_Fs48000_Fc90_A2 (-4152024) /* Floating point value -0.003867 */
+#define BPF_Fs48000_Fc90_B1 (-2138935002) /* Floating point value -1.992038 */
#define BPF_Fs48000_Fc90_B2 1065341620 /* Floating point value 0.992177 */
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.c b/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.c
index ab2a832..b6632a3 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.c
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.c
@@ -334,10 +334,10 @@
pParams); /* New parameters */
LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[0],
- LVDBE_BYPASS_MIXER_TC,pParams->SampleRate,2);
+ LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate,2);
LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[1],
- LVDBE_BYPASS_MIXER_TC,pParams->SampleRate,2);
+ LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate,2);
}
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c b/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c
index 35e5bc8..a3623bc 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c
@@ -270,7 +270,7 @@
pBypassMixer_Instance->MixerStream[0].CallbackSet=0;
LVC_Mixer_Init(&pBypassMixer_Instance->MixerStream[0],0,0);
LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[0],
- LVDBE_BYPASS_MIXER_TC,pInstance->Params.SampleRate,2);
+ LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pInstance->Params.SampleRate,2);
/*
* Setup the mixer gain for the unprocessed path
*/
@@ -280,8 +280,7 @@
pBypassMixer_Instance->MixerStream[1].CallbackSet=0;
LVC_Mixer_Init(&pBypassMixer_Instance->MixerStream[1],0x00007FFF,0x00007FFF);
LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[1],
- LVDBE_BYPASS_MIXER_TC,pInstance->Params.SampleRate,2);
+ LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pInstance->Params.SampleRate,2);
return(LVDBE_SUCCESS);
}
-
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h b/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h
index f578db9..2712b2c 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h
@@ -74,63 +74,63 @@
#define HPF_Fs22050_Gain6_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs22050_Gain6_Shift 1 /* Shift value */
/* Gain = 7.000000 dB */
-#define HPF_Fs22050_Gain7_A0 -164 /* Floating point value -0.005002 */
+#define HPF_Fs22050_Gain7_A0 (-164) /* Floating point value -0.005002 */
#define HPF_Fs22050_Gain7_A1 11311 /* Floating point value 0.345199 */
#define HPF_Fs22050_Gain7_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs22050_Gain7_B1 12125 /* Floating point value 0.370033 */
#define HPF_Fs22050_Gain7_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs22050_Gain7_Shift 2 /* Shift value */
/* Gain = 8.000000 dB */
-#define HPF_Fs22050_Gain8_A0 -864 /* Floating point value -0.026368 */
+#define HPF_Fs22050_Gain8_A0 (-864) /* Floating point value -0.026368 */
#define HPF_Fs22050_Gain8_A1 12012 /* Floating point value 0.366565 */
#define HPF_Fs22050_Gain8_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs22050_Gain8_B1 12125 /* Floating point value 0.370033 */
#define HPF_Fs22050_Gain8_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs22050_Gain8_Shift 2 /* Shift value */
/* Gain = 9.000000 dB */
-#define HPF_Fs22050_Gain9_A0 -1650 /* Floating point value -0.050340 */
+#define HPF_Fs22050_Gain9_A0 (-1650) /* Floating point value -0.050340 */
#define HPF_Fs22050_Gain9_A1 12797 /* Floating point value 0.390537 */
#define HPF_Fs22050_Gain9_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs22050_Gain9_B1 12125 /* Floating point value 0.370033 */
#define HPF_Fs22050_Gain9_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs22050_Gain9_Shift 2 /* Shift value */
/* Gain = 10.000000 dB */
-#define HPF_Fs22050_Gain10_A0 -2531 /* Floating point value -0.077238 */
+#define HPF_Fs22050_Gain10_A0 (-2531) /* Floating point value -0.077238 */
#define HPF_Fs22050_Gain10_A1 13679 /* Floating point value 0.417435 */
#define HPF_Fs22050_Gain10_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs22050_Gain10_B1 12125 /* Floating point value 0.370033 */
#define HPF_Fs22050_Gain10_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs22050_Gain10_Shift 2 /* Shift value */
/* Gain = 11.000000 dB */
-#define HPF_Fs22050_Gain11_A0 -3520 /* Floating point value -0.107417 */
+#define HPF_Fs22050_Gain11_A0 (-3520) /* Floating point value -0.107417 */
#define HPF_Fs22050_Gain11_A1 14667 /* Floating point value 0.447615 */
#define HPF_Fs22050_Gain11_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs22050_Gain11_B1 12125 /* Floating point value 0.370033 */
#define HPF_Fs22050_Gain11_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs22050_Gain11_Shift 2 /* Shift value */
/* Gain = 12.000000 dB */
-#define HPF_Fs22050_Gain12_A0 -4629 /* Floating point value -0.141279 */
+#define HPF_Fs22050_Gain12_A0 (-4629) /* Floating point value -0.141279 */
#define HPF_Fs22050_Gain12_A1 15777 /* Floating point value 0.481477 */
#define HPF_Fs22050_Gain12_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs22050_Gain12_B1 12125 /* Floating point value 0.370033 */
#define HPF_Fs22050_Gain12_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs22050_Gain12_Shift 2 /* Shift value */
/* Gain = 13.000000 dB */
-#define HPF_Fs22050_Gain13_A0 -2944 /* Floating point value -0.089849 */
+#define HPF_Fs22050_Gain13_A0 (-2944) /* Floating point value -0.089849 */
#define HPF_Fs22050_Gain13_A1 8531 /* Floating point value 0.260352 */
#define HPF_Fs22050_Gain13_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs22050_Gain13_B1 12125 /* Floating point value 0.370033 */
#define HPF_Fs22050_Gain13_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs22050_Gain13_Shift 3 /* Shift value */
/* Gain = 14.000000 dB */
-#define HPF_Fs22050_Gain14_A0 -3644 /* Floating point value -0.111215 */
+#define HPF_Fs22050_Gain14_A0 (-3644) /* Floating point value -0.111215 */
#define HPF_Fs22050_Gain14_A1 9231 /* Floating point value 0.281718 */
#define HPF_Fs22050_Gain14_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs22050_Gain14_B1 12125 /* Floating point value 0.370033 */
#define HPF_Fs22050_Gain14_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs22050_Gain14_Shift 3 /* Shift value */
/* Gain = 15.000000 dB */
-#define HPF_Fs22050_Gain15_A0 -4430 /* Floating point value -0.135187 */
+#define HPF_Fs22050_Gain15_A0 (-4430) /* Floating point value -0.135187 */
#define HPF_Fs22050_Gain15_A1 10017 /* Floating point value 0.305690 */
#define HPF_Fs22050_Gain15_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs22050_Gain15_B1 12125 /* Floating point value 0.370033 */
@@ -168,77 +168,77 @@
#define HPF_Fs24000_Gain4_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs24000_Gain4_Shift 1 /* Shift value */
/* Gain = 5.000000 dB */
-#define HPF_Fs24000_Gain5_A0 -275 /* Floating point value -0.008383 */
+#define HPF_Fs24000_Gain5_A0 (-275) /* Floating point value -0.008383 */
#define HPF_Fs24000_Gain5_A1 20860 /* Floating point value 0.636589 */
#define HPF_Fs24000_Gain5_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs24000_Gain5_B1 8780 /* Floating point value 0.267949 */
#define HPF_Fs24000_Gain5_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs24000_Gain5_Shift 1 /* Shift value */
/* Gain = 6.000000 dB */
-#define HPF_Fs24000_Gain6_A0 -1564 /* Floating point value -0.047733 */
+#define HPF_Fs24000_Gain6_A0 (-1564) /* Floating point value -0.047733 */
#define HPF_Fs24000_Gain6_A1 22149 /* Floating point value 0.675938 */
#define HPF_Fs24000_Gain6_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs24000_Gain6_B1 8780 /* Floating point value 0.267949 */
#define HPF_Fs24000_Gain6_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs24000_Gain6_Shift 1 /* Shift value */
/* Gain = 7.000000 dB */
-#define HPF_Fs24000_Gain7_A0 -1509 /* Floating point value -0.046051 */
+#define HPF_Fs24000_Gain7_A0 (-1509) /* Floating point value -0.046051 */
#define HPF_Fs24000_Gain7_A1 11826 /* Floating point value 0.360899 */
#define HPF_Fs24000_Gain7_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs24000_Gain7_B1 8780 /* Floating point value 0.267949 */
#define HPF_Fs24000_Gain7_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs24000_Gain7_Shift 2 /* Shift value */
/* Gain = 8.000000 dB */
-#define HPF_Fs24000_Gain8_A0 -2323 /* Floating point value -0.070878 */
+#define HPF_Fs24000_Gain8_A0 (-2323) /* Floating point value -0.070878 */
#define HPF_Fs24000_Gain8_A1 12640 /* Floating point value 0.385727 */
#define HPF_Fs24000_Gain8_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs24000_Gain8_B1 8780 /* Floating point value 0.267949 */
#define HPF_Fs24000_Gain8_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs24000_Gain8_Shift 2 /* Shift value */
/* Gain = 9.000000 dB */
-#define HPF_Fs24000_Gain9_A0 -3235 /* Floating point value -0.098736 */
+#define HPF_Fs24000_Gain9_A0 (-3235) /* Floating point value -0.098736 */
#define HPF_Fs24000_Gain9_A1 13552 /* Floating point value 0.413584 */
#define HPF_Fs24000_Gain9_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs24000_Gain9_B1 8780 /* Floating point value 0.267949 */
#define HPF_Fs24000_Gain9_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs24000_Gain9_Shift 2 /* Shift value */
/* Gain = 10.000000 dB */
-#define HPF_Fs24000_Gain10_A0 -4260 /* Floating point value -0.129992 */
+#define HPF_Fs24000_Gain10_A0 (-4260) /* Floating point value -0.129992 */
#define HPF_Fs24000_Gain10_A1 14577 /* Floating point value 0.444841 */
#define HPF_Fs24000_Gain10_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs24000_Gain10_B1 8780 /* Floating point value 0.267949 */
#define HPF_Fs24000_Gain10_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs24000_Gain10_Shift 2 /* Shift value */
/* Gain = 11.000000 dB */
-#define HPF_Fs24000_Gain11_A0 -5409 /* Floating point value -0.165062 */
+#define HPF_Fs24000_Gain11_A0 (-5409) /* Floating point value -0.165062 */
#define HPF_Fs24000_Gain11_A1 15726 /* Floating point value 0.479911 */
#define HPF_Fs24000_Gain11_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs24000_Gain11_B1 8780 /* Floating point value 0.267949 */
#define HPF_Fs24000_Gain11_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs24000_Gain11_Shift 2 /* Shift value */
/* Gain = 12.000000 dB */
-#define HPF_Fs24000_Gain12_A0 -6698 /* Floating point value -0.204411 */
+#define HPF_Fs24000_Gain12_A0 (-6698) /* Floating point value -0.204411 */
#define HPF_Fs24000_Gain12_A1 17015 /* Floating point value 0.519260 */
#define HPF_Fs24000_Gain12_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs24000_Gain12_B1 8780 /* Floating point value 0.267949 */
#define HPF_Fs24000_Gain12_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs24000_Gain12_Shift 2 /* Shift value */
/* Gain = 13.000000 dB */
-#define HPF_Fs24000_Gain13_A0 -4082 /* Floating point value -0.124576 */
+#define HPF_Fs24000_Gain13_A0 (-4082) /* Floating point value -0.124576 */
#define HPF_Fs24000_Gain13_A1 9253 /* Floating point value 0.282374 */
#define HPF_Fs24000_Gain13_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs24000_Gain13_B1 8780 /* Floating point value 0.267949 */
#define HPF_Fs24000_Gain13_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs24000_Gain13_Shift 3 /* Shift value */
/* Gain = 14.000000 dB */
-#define HPF_Fs24000_Gain14_A0 -4896 /* Floating point value -0.149404 */
+#define HPF_Fs24000_Gain14_A0 (-4896) /* Floating point value -0.149404 */
#define HPF_Fs24000_Gain14_A1 10066 /* Floating point value 0.307202 */
#define HPF_Fs24000_Gain14_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs24000_Gain14_B1 8780 /* Floating point value 0.267949 */
#define HPF_Fs24000_Gain14_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs24000_Gain14_Shift 3 /* Shift value */
/* Gain = 15.000000 dB */
-#define HPF_Fs24000_Gain15_A0 -5808 /* Floating point value -0.177261 */
+#define HPF_Fs24000_Gain15_A0 (-5808) /* Floating point value -0.177261 */
#define HPF_Fs24000_Gain15_A1 10979 /* Floating point value 0.335059 */
#define HPF_Fs24000_Gain15_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs24000_Gain15_B1 8780 /* Floating point value 0.267949 */
@@ -249,105 +249,105 @@
/* Coefficients for sample rate 32000Hz */
/* Gain = 1.000000 dB */
#define HPF_Fs32000_Gain1_A0 17225 /* Floating point value 0.525677 */
-#define HPF_Fs32000_Gain1_A1 -990 /* Floating point value -0.030227 */
+#define HPF_Fs32000_Gain1_A1 (-990) /* Floating point value -0.030227 */
#define HPF_Fs32000_Gain1_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain1_B1 0 /* Floating point value -0.000000 */
#define HPF_Fs32000_Gain1_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain1_Shift 1 /* Shift value */
/* Gain = 2.000000 dB */
#define HPF_Fs32000_Gain2_A0 18337 /* Floating point value 0.559593 */
-#define HPF_Fs32000_Gain2_A1 -2102 /* Floating point value -0.064142 */
+#define HPF_Fs32000_Gain2_A1 (-2102) /* Floating point value -0.064142 */
#define HPF_Fs32000_Gain2_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain2_B1 0 /* Floating point value -0.000000 */
#define HPF_Fs32000_Gain2_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain2_Shift 1 /* Shift value */
/* Gain = 3.000000 dB */
#define HPF_Fs32000_Gain3_A0 19584 /* Floating point value 0.597646 */
-#define HPF_Fs32000_Gain3_A1 -3349 /* Floating point value -0.102196 */
+#define HPF_Fs32000_Gain3_A1 (-3349) /* Floating point value -0.102196 */
#define HPF_Fs32000_Gain3_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain3_B1 0 /* Floating point value -0.000000 */
#define HPF_Fs32000_Gain3_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain3_Shift 1 /* Shift value */
/* Gain = 4.000000 dB */
#define HPF_Fs32000_Gain4_A0 20983 /* Floating point value 0.640343 */
-#define HPF_Fs32000_Gain4_A1 -4748 /* Floating point value -0.144893 */
+#define HPF_Fs32000_Gain4_A1 (-4748) /* Floating point value -0.144893 */
#define HPF_Fs32000_Gain4_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain4_B1 0 /* Floating point value -0.000000 */
#define HPF_Fs32000_Gain4_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain4_Shift 1 /* Shift value */
/* Gain = 5.000000 dB */
#define HPF_Fs32000_Gain5_A0 22553 /* Floating point value 0.688250 */
-#define HPF_Fs32000_Gain5_A1 -6318 /* Floating point value -0.192799 */
+#define HPF_Fs32000_Gain5_A1 (-6318) /* Floating point value -0.192799 */
#define HPF_Fs32000_Gain5_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain5_B1 0 /* Floating point value -0.000000 */
#define HPF_Fs32000_Gain5_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain5_Shift 1 /* Shift value */
/* Gain = 6.000000 dB */
#define HPF_Fs32000_Gain6_A0 24314 /* Floating point value 0.742002 */
-#define HPF_Fs32000_Gain6_A1 -8079 /* Floating point value -0.246551 */
+#define HPF_Fs32000_Gain6_A1 (-8079) /* Floating point value -0.246551 */
#define HPF_Fs32000_Gain6_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain6_B1 0 /* Floating point value -0.000000 */
#define HPF_Fs32000_Gain6_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain6_Shift 1 /* Shift value */
/* Gain = 7.000000 dB */
#define HPF_Fs32000_Gain7_A0 13176 /* Floating point value 0.402109 */
-#define HPF_Fs32000_Gain7_A1 -5040 /* Floating point value -0.153795 */
+#define HPF_Fs32000_Gain7_A1 (-5040) /* Floating point value -0.153795 */
#define HPF_Fs32000_Gain7_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain7_B1 0 /* Floating point value -0.000000 */
#define HPF_Fs32000_Gain7_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain7_Shift 2 /* Shift value */
/* Gain = 8.000000 dB */
#define HPF_Fs32000_Gain8_A0 14288 /* Floating point value 0.436024 */
-#define HPF_Fs32000_Gain8_A1 -6151 /* Floating point value -0.187711 */
+#define HPF_Fs32000_Gain8_A1 (-6151) /* Floating point value -0.187711 */
#define HPF_Fs32000_Gain8_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain8_B1 0 /* Floating point value -0.000000 */
#define HPF_Fs32000_Gain8_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain8_Shift 2 /* Shift value */
/* Gain = 9.000000 dB */
#define HPF_Fs32000_Gain9_A0 15535 /* Floating point value 0.474078 */
-#define HPF_Fs32000_Gain9_A1 -7398 /* Floating point value -0.225764 */
+#define HPF_Fs32000_Gain9_A1 (-7398) /* Floating point value -0.225764 */
#define HPF_Fs32000_Gain9_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain9_B1 0 /* Floating point value -0.000000 */
#define HPF_Fs32000_Gain9_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain9_Shift 2 /* Shift value */
/* Gain = 10.000000 dB */
#define HPF_Fs32000_Gain10_A0 16934 /* Floating point value 0.516774 */
-#define HPF_Fs32000_Gain10_A1 -8797 /* Floating point value -0.268461 */
+#define HPF_Fs32000_Gain10_A1 (-8797) /* Floating point value -0.268461 */
#define HPF_Fs32000_Gain10_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain10_B1 0 /* Floating point value -0.000000 */
#define HPF_Fs32000_Gain10_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain10_Shift 2 /* Shift value */
/* Gain = 11.000000 dB */
#define HPF_Fs32000_Gain11_A0 18503 /* Floating point value 0.564681 */
-#define HPF_Fs32000_Gain11_A1 -10367 /* Floating point value -0.316368 */
+#define HPF_Fs32000_Gain11_A1 (-10367) /* Floating point value -0.316368 */
#define HPF_Fs32000_Gain11_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain11_B1 0 /* Floating point value -0.000000 */
#define HPF_Fs32000_Gain11_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain11_Shift 2 /* Shift value */
/* Gain = 12.000000 dB */
#define HPF_Fs32000_Gain12_A0 20265 /* Floating point value 0.618433 */
-#define HPF_Fs32000_Gain12_A1 -12128 /* Floating point value -0.370120 */
+#define HPF_Fs32000_Gain12_A1 (-12128) /* Floating point value -0.370120 */
#define HPF_Fs32000_Gain12_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain12_B1 0 /* Floating point value -0.000000 */
#define HPF_Fs32000_Gain12_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain12_Shift 2 /* Shift value */
/* Gain = 13.000000 dB */
#define HPF_Fs32000_Gain13_A0 11147 /* Floating point value 0.340178 */
-#define HPF_Fs32000_Gain13_A1 -7069 /* Floating point value -0.215726 */
+#define HPF_Fs32000_Gain13_A1 (-7069) /* Floating point value -0.215726 */
#define HPF_Fs32000_Gain13_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain13_B1 0 /* Floating point value -0.000000 */
#define HPF_Fs32000_Gain13_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain13_Shift 3 /* Shift value */
/* Gain = 14.000000 dB */
#define HPF_Fs32000_Gain14_A0 12258 /* Floating point value 0.374093 */
-#define HPF_Fs32000_Gain14_A1 -8180 /* Floating point value -0.249642 */
+#define HPF_Fs32000_Gain14_A1 (-8180) /* Floating point value -0.249642 */
#define HPF_Fs32000_Gain14_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain14_B1 0 /* Floating point value -0.000000 */
#define HPF_Fs32000_Gain14_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain14_Shift 3 /* Shift value */
/* Gain = 15.000000 dB */
#define HPF_Fs32000_Gain15_A0 13505 /* Floating point value 0.412147 */
-#define HPF_Fs32000_Gain15_A1 -9427 /* Floating point value -0.287695 */
+#define HPF_Fs32000_Gain15_A1 (-9427) /* Floating point value -0.287695 */
#define HPF_Fs32000_Gain15_A2 0 /* Floating point value 0.000000 */
#define HPF_Fs32000_Gain15_B1 0 /* Floating point value -0.000000 */
#define HPF_Fs32000_Gain15_B2 0 /* Floating point value 0.000000 */
@@ -357,107 +357,107 @@
/* Coefficients for sample rate 44100Hz */
/* Gain = 1.000000 dB */
#define HPF_Fs44100_Gain1_A0 17442 /* Floating point value 0.532294 */
-#define HPF_Fs44100_Gain1_A1 -4761 /* Floating point value -0.145294 */
+#define HPF_Fs44100_Gain1_A1 (-4761) /* Floating point value -0.145294 */
#define HPF_Fs44100_Gain1_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain1_B1 -7173 /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain1_B1 (-7173) /* Floating point value -0.218894 */
#define HPF_Fs44100_Gain1_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs44100_Gain1_Shift 1 /* Shift value */
/* Gain = 2.000000 dB */
#define HPF_Fs44100_Gain2_A0 18797 /* Floating point value 0.573633 */
-#define HPF_Fs44100_Gain2_A1 -6116 /* Floating point value -0.186634 */
+#define HPF_Fs44100_Gain2_A1 (-6116) /* Floating point value -0.186634 */
#define HPF_Fs44100_Gain2_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain2_B1 -7173 /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain2_B1 (-7173) /* Floating point value -0.218894 */
#define HPF_Fs44100_Gain2_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs44100_Gain2_Shift 1 /* Shift value */
/* Gain = 3.000000 dB */
#define HPF_Fs44100_Gain3_A0 20317 /* Floating point value 0.620016 */
-#define HPF_Fs44100_Gain3_A1 -7635 /* Floating point value -0.233017 */
+#define HPF_Fs44100_Gain3_A1 (-7635) /* Floating point value -0.233017 */
#define HPF_Fs44100_Gain3_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain3_B1 -7173 /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain3_B1 (-7173) /* Floating point value -0.218894 */
#define HPF_Fs44100_Gain3_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs44100_Gain3_Shift 1 /* Shift value */
/* Gain = 4.000000 dB */
#define HPF_Fs44100_Gain4_A0 22022 /* Floating point value 0.672059 */
-#define HPF_Fs44100_Gain4_A1 -9341 /* Floating point value -0.285060 */
+#define HPF_Fs44100_Gain4_A1 (-9341) /* Floating point value -0.285060 */
#define HPF_Fs44100_Gain4_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain4_B1 -7173 /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain4_B1 (-7173) /* Floating point value -0.218894 */
#define HPF_Fs44100_Gain4_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs44100_Gain4_Shift 1 /* Shift value */
/* Gain = 5.000000 dB */
#define HPF_Fs44100_Gain5_A0 23935 /* Floating point value 0.730452 */
-#define HPF_Fs44100_Gain5_A1 -11254 /* Floating point value -0.343453 */
+#define HPF_Fs44100_Gain5_A1 (-11254) /* Floating point value -0.343453 */
#define HPF_Fs44100_Gain5_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain5_B1 -7173 /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain5_B1 (-7173) /* Floating point value -0.218894 */
#define HPF_Fs44100_Gain5_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs44100_Gain5_Shift 1 /* Shift value */
/* Gain = 6.000000 dB */
#define HPF_Fs44100_Gain6_A0 26082 /* Floating point value 0.795970 */
-#define HPF_Fs44100_Gain6_A1 -13401 /* Floating point value -0.408971 */
+#define HPF_Fs44100_Gain6_A1 (-13401) /* Floating point value -0.408971 */
#define HPF_Fs44100_Gain6_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain6_B1 -7173 /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain6_B1 (-7173) /* Floating point value -0.218894 */
#define HPF_Fs44100_Gain6_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs44100_Gain6_Shift 1 /* Shift value */
/* Gain = 7.000000 dB */
#define HPF_Fs44100_Gain7_A0 14279 /* Floating point value 0.435774 */
-#define HPF_Fs44100_Gain7_A1 -7924 /* Floating point value -0.241815 */
+#define HPF_Fs44100_Gain7_A1 (-7924) /* Floating point value -0.241815 */
#define HPF_Fs44100_Gain7_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain7_B1 -7173 /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain7_B1 (-7173) /* Floating point value -0.218894 */
#define HPF_Fs44100_Gain7_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs44100_Gain7_Shift 2 /* Shift value */
/* Gain = 8.000000 dB */
#define HPF_Fs44100_Gain8_A0 15634 /* Floating point value 0.477113 */
-#define HPF_Fs44100_Gain8_A1 -9278 /* Floating point value -0.283154 */
+#define HPF_Fs44100_Gain8_A1 (-9278) /* Floating point value -0.283154 */
#define HPF_Fs44100_Gain8_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain8_B1 -7173 /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain8_B1 (-7173) /* Floating point value -0.218894 */
#define HPF_Fs44100_Gain8_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs44100_Gain8_Shift 2 /* Shift value */
/* Gain = 9.000000 dB */
#define HPF_Fs44100_Gain9_A0 17154 /* Floating point value 0.523496 */
-#define HPF_Fs44100_Gain9_A1 -10798 /* Floating point value -0.329537 */
+#define HPF_Fs44100_Gain9_A1 (-10798) /* Floating point value -0.329537 */
#define HPF_Fs44100_Gain9_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain9_B1 -7173 /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain9_B1 (-7173) /* Floating point value -0.218894 */
#define HPF_Fs44100_Gain9_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs44100_Gain9_Shift 2 /* Shift value */
/* Gain = 10.000000 dB */
#define HPF_Fs44100_Gain10_A0 18859 /* Floating point value 0.575539 */
-#define HPF_Fs44100_Gain10_A1 -12504 /* Floating point value -0.381580 */
+#define HPF_Fs44100_Gain10_A1 (-12504) /* Floating point value -0.381580 */
#define HPF_Fs44100_Gain10_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain10_B1 -7173 /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain10_B1 (-7173) /* Floating point value -0.218894 */
#define HPF_Fs44100_Gain10_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs44100_Gain10_Shift 2 /* Shift value */
/* Gain = 11.000000 dB */
#define HPF_Fs44100_Gain11_A0 20773 /* Floating point value 0.633932 */
-#define HPF_Fs44100_Gain11_A1 -14417 /* Floating point value -0.439973 */
+#define HPF_Fs44100_Gain11_A1 (-14417) /* Floating point value -0.439973 */
#define HPF_Fs44100_Gain11_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain11_B1 -7173 /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain11_B1 (-7173) /* Floating point value -0.218894 */
#define HPF_Fs44100_Gain11_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs44100_Gain11_Shift 2 /* Shift value */
/* Gain = 12.000000 dB */
#define HPF_Fs44100_Gain12_A0 22920 /* Floating point value 0.699450 */
-#define HPF_Fs44100_Gain12_A1 -16564 /* Floating point value -0.505491 */
+#define HPF_Fs44100_Gain12_A1 (-16564) /* Floating point value -0.505491 */
#define HPF_Fs44100_Gain12_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain12_B1 -7173 /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain12_B1 (-7173) /* Floating point value -0.218894 */
#define HPF_Fs44100_Gain12_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs44100_Gain12_Shift 2 /* Shift value */
/* Gain = 13.000000 dB */
#define HPF_Fs44100_Gain13_A0 12694 /* Floating point value 0.387399 */
-#define HPF_Fs44100_Gain13_A1 -9509 /* Floating point value -0.290189 */
+#define HPF_Fs44100_Gain13_A1 (-9509) /* Floating point value -0.290189 */
#define HPF_Fs44100_Gain13_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain13_B1 -7173 /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain13_B1 (-7173) /* Floating point value -0.218894 */
#define HPF_Fs44100_Gain13_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs44100_Gain13_Shift 3 /* Shift value */
/* Gain = 14.000000 dB */
#define HPF_Fs44100_Gain14_A0 14049 /* Floating point value 0.428738 */
-#define HPF_Fs44100_Gain14_A1 -10864 /* Floating point value -0.331528 */
+#define HPF_Fs44100_Gain14_A1 (-10864) /* Floating point value -0.331528 */
#define HPF_Fs44100_Gain14_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain14_B1 -7173 /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain14_B1 (-7173) /* Floating point value -0.218894 */
#define HPF_Fs44100_Gain14_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs44100_Gain14_Shift 3 /* Shift value */
/* Gain = 15.000000 dB */
#define HPF_Fs44100_Gain15_A0 15569 /* Floating point value 0.475121 */
-#define HPF_Fs44100_Gain15_A1 -12383 /* Floating point value -0.377912 */
+#define HPF_Fs44100_Gain15_A1 (-12383) /* Floating point value -0.377912 */
#define HPF_Fs44100_Gain15_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain15_B1 -7173 /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain15_B1 (-7173) /* Floating point value -0.218894 */
#define HPF_Fs44100_Gain15_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs44100_Gain15_Shift 3 /* Shift value */
@@ -465,107 +465,107 @@
/* Coefficients for sample rate 48000Hz */
/* Gain = 1.000000 dB */
#define HPF_Fs48000_Gain1_A0 17491 /* Floating point value 0.533777 */
-#define HPF_Fs48000_Gain1_A1 -5606 /* Floating point value -0.171082 */
+#define HPF_Fs48000_Gain1_A1 (-5606) /* Floating point value -0.171082 */
#define HPF_Fs48000_Gain1_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain1_B1 -8780 /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain1_B1 (-8780) /* Floating point value -0.267949 */
#define HPF_Fs48000_Gain1_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs48000_Gain1_Shift 1 /* Shift value */
/* Gain = 2.000000 dB */
#define HPF_Fs48000_Gain2_A0 18900 /* Floating point value 0.576779 */
-#define HPF_Fs48000_Gain2_A1 -7015 /* Floating point value -0.214085 */
+#define HPF_Fs48000_Gain2_A1 (-7015) /* Floating point value -0.214085 */
#define HPF_Fs48000_Gain2_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain2_B1 -8780 /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain2_B1 (-8780) /* Floating point value -0.267949 */
#define HPF_Fs48000_Gain2_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs48000_Gain2_Shift 1 /* Shift value */
/* Gain = 3.000000 dB */
#define HPF_Fs48000_Gain3_A0 20481 /* Floating point value 0.625029 */
-#define HPF_Fs48000_Gain3_A1 -8596 /* Floating point value -0.262335 */
+#define HPF_Fs48000_Gain3_A1 (-8596) /* Floating point value -0.262335 */
#define HPF_Fs48000_Gain3_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain3_B1 -8780 /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain3_B1 (-8780) /* Floating point value -0.267949 */
#define HPF_Fs48000_Gain3_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs48000_Gain3_Shift 1 /* Shift value */
/* Gain = 4.000000 dB */
#define HPF_Fs48000_Gain4_A0 22255 /* Floating point value 0.679167 */
-#define HPF_Fs48000_Gain4_A1 -10370 /* Floating point value -0.316472 */
+#define HPF_Fs48000_Gain4_A1 (-10370) /* Floating point value -0.316472 */
#define HPF_Fs48000_Gain4_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain4_B1 -8780 /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain4_B1 (-8780) /* Floating point value -0.267949 */
#define HPF_Fs48000_Gain4_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs48000_Gain4_Shift 1 /* Shift value */
/* Gain = 5.000000 dB */
#define HPF_Fs48000_Gain5_A0 24245 /* Floating point value 0.739910 */
-#define HPF_Fs48000_Gain5_A1 -12361 /* Floating point value -0.377215 */
+#define HPF_Fs48000_Gain5_A1 (-12361) /* Floating point value -0.377215 */
#define HPF_Fs48000_Gain5_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain5_B1 -8780 /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain5_B1 (-8780) /* Floating point value -0.267949 */
#define HPF_Fs48000_Gain5_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs48000_Gain5_Shift 1 /* Shift value */
/* Gain = 6.000000 dB */
#define HPF_Fs48000_Gain6_A0 26479 /* Floating point value 0.808065 */
-#define HPF_Fs48000_Gain6_A1 -14594 /* Floating point value -0.445370 */
+#define HPF_Fs48000_Gain6_A1 (-14594) /* Floating point value -0.445370 */
#define HPF_Fs48000_Gain6_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain6_B1 -8780 /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain6_B1 (-8780) /* Floating point value -0.267949 */
#define HPF_Fs48000_Gain6_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs48000_Gain6_Shift 1 /* Shift value */
/* Gain = 7.000000 dB */
#define HPF_Fs48000_Gain7_A0 14527 /* Floating point value 0.443318 */
-#define HPF_Fs48000_Gain7_A1 -8570 /* Floating point value -0.261540 */
+#define HPF_Fs48000_Gain7_A1 (-8570) /* Floating point value -0.261540 */
#define HPF_Fs48000_Gain7_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain7_B1 -8780 /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain7_B1 (-8780) /* Floating point value -0.267949 */
#define HPF_Fs48000_Gain7_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs48000_Gain7_Shift 2 /* Shift value */
/* Gain = 8.000000 dB */
#define HPF_Fs48000_Gain8_A0 15936 /* Floating point value 0.486321 */
-#define HPF_Fs48000_Gain8_A1 -9979 /* Floating point value -0.304543 */
+#define HPF_Fs48000_Gain8_A1 (-9979) /* Floating point value -0.304543 */
#define HPF_Fs48000_Gain8_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain8_B1 -8780 /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain8_B1 (-8780) /* Floating point value -0.267949 */
#define HPF_Fs48000_Gain8_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs48000_Gain8_Shift 2 /* Shift value */
/* Gain = 9.000000 dB */
#define HPF_Fs48000_Gain9_A0 17517 /* Floating point value 0.534571 */
-#define HPF_Fs48000_Gain9_A1 -11560 /* Floating point value -0.352793 */
+#define HPF_Fs48000_Gain9_A1 (-11560) /* Floating point value -0.352793 */
#define HPF_Fs48000_Gain9_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain9_B1 -8780 /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain9_B1 (-8780) /* Floating point value -0.267949 */
#define HPF_Fs48000_Gain9_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs48000_Gain9_Shift 2 /* Shift value */
/* Gain = 10.000000 dB */
#define HPF_Fs48000_Gain10_A0 19291 /* Floating point value 0.588708 */
-#define HPF_Fs48000_Gain10_A1 -13334 /* Floating point value -0.406930 */
+#define HPF_Fs48000_Gain10_A1 (-13334) /* Floating point value -0.406930 */
#define HPF_Fs48000_Gain10_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain10_B1 -8780 /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain10_B1 (-8780) /* Floating point value -0.267949 */
#define HPF_Fs48000_Gain10_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs48000_Gain10_Shift 2 /* Shift value */
/* Gain = 11.000000 dB */
#define HPF_Fs48000_Gain11_A0 21281 /* Floating point value 0.649452 */
-#define HPF_Fs48000_Gain11_A1 -15325 /* Floating point value -0.467674 */
+#define HPF_Fs48000_Gain11_A1 (-15325) /* Floating point value -0.467674 */
#define HPF_Fs48000_Gain11_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain11_B1 -8780 /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain11_B1 (-8780) /* Floating point value -0.267949 */
#define HPF_Fs48000_Gain11_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs48000_Gain11_Shift 2 /* Shift value */
/* Gain = 12.000000 dB */
#define HPF_Fs48000_Gain12_A0 23515 /* Floating point value 0.717607 */
-#define HPF_Fs48000_Gain12_A1 -17558 /* Floating point value -0.535829 */
+#define HPF_Fs48000_Gain12_A1 (-17558) /* Floating point value -0.535829 */
#define HPF_Fs48000_Gain12_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain12_B1 -8780 /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain12_B1 (-8780) /* Floating point value -0.267949 */
#define HPF_Fs48000_Gain12_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs48000_Gain12_Shift 2 /* Shift value */
/* Gain = 13.000000 dB */
#define HPF_Fs48000_Gain13_A0 13041 /* Floating point value 0.397982 */
-#define HPF_Fs48000_Gain13_A1 -10056 /* Floating point value -0.306877 */
+#define HPF_Fs48000_Gain13_A1 (-10056) /* Floating point value -0.306877 */
#define HPF_Fs48000_Gain13_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain13_B1 -8780 /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain13_B1 (-8780) /* Floating point value -0.267949 */
#define HPF_Fs48000_Gain13_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs48000_Gain13_Shift 3 /* Shift value */
/* Gain = 14.000000 dB */
#define HPF_Fs48000_Gain14_A0 14450 /* Floating point value 0.440984 */
-#define HPF_Fs48000_Gain14_A1 -11465 /* Floating point value -0.349880 */
+#define HPF_Fs48000_Gain14_A1 (-11465) /* Floating point value -0.349880 */
#define HPF_Fs48000_Gain14_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain14_B1 -8780 /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain14_B1 (-8780) /* Floating point value -0.267949 */
#define HPF_Fs48000_Gain14_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs48000_Gain14_Shift 3 /* Shift value */
/* Gain = 15.000000 dB */
#define HPF_Fs48000_Gain15_A0 16031 /* Floating point value 0.489234 */
-#define HPF_Fs48000_Gain15_A1 -13046 /* Floating point value -0.398130 */
+#define HPF_Fs48000_Gain15_A1 (-13046) /* Floating point value -0.398130 */
#define HPF_Fs48000_Gain15_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain15_B1 -8780 /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain15_B1 (-8780) /* Floating point value -0.267949 */
#define HPF_Fs48000_Gain15_B2 0 /* Floating point value 0.000000 */
#define HPF_Fs48000_Gain15_Shift 3 /* Shift value */
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h b/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h
index 2d1cf42..2e85f77 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h
@@ -81,7 +81,7 @@
#define LVM_TE_MIN_EFFECTLEVEL 0 /*TE Minimum EffectLevel*/
#define LVM_TE_MAX_EFFECTLEVEL 15 /*TE Maximum Effect level*/
-#define LVM_VC_MIN_EFFECTLEVEL -96 /*VC Minimum EffectLevel*/
+#define LVM_VC_MIN_EFFECTLEVEL (-96) /*VC Minimum EffectLevel*/
#define LVM_VC_MAX_EFFECTLEVEL 0 /*VC Maximum Effect level*/
#define LVM_BE_MIN_EFFECTLEVEL 0 /*BE Minimum EffectLevel*/
@@ -89,7 +89,7 @@
#define LVM_EQNB_MIN_BAND_FREQ 20 /*EQNB Minimum Band Frequency*/
#define LVM_EQNB_MAX_BAND_FREQ 24000 /*EQNB Maximum Band Frequency*/
-#define LVM_EQNB_MIN_BAND_GAIN -15 /*EQNB Minimum Band Frequency*/
+#define LVM_EQNB_MIN_BAND_GAIN (-15) /*EQNB Minimum Band Frequency*/
#define LVM_EQNB_MAX_BAND_GAIN 15 /*EQNB Maximum Band Frequency*/
#define LVM_EQNB_MIN_QFACTOR 25 /*EQNB Minimum Q Factor*/
#define LVM_EQNB_MAX_QFACTOR 1200 /*EQNB Maximum Q Factor*/
@@ -103,7 +103,7 @@
#define LVM_VC_MIXER_TIME 100 /*VC mixer time*/
#define LVM_VC_BALANCE_MAX 96 /*VC balance max value*/
-#define LVM_VC_BALANCE_MIN -96 /*VC balance min value*/
+#define LVM_VC_BALANCE_MIN (-96) /*VC balance min value*/
/* Algorithm masks */
#define LVM_CS_MASK 1
diff --git a/media/libeffects/lvm/lib/Common/lib/LVM_Types.h b/media/libeffects/lvm/lib/Common/lib/LVM_Types.h
index 0c6fb25..68c55f7 100644
--- a/media/libeffects/lvm/lib/Common/lib/LVM_Types.h
+++ b/media/libeffects/lvm/lib/Common/lib/LVM_Types.h
@@ -73,10 +73,10 @@
#define LVM_MEM_EXTERNAL 8 /* External (slow) access memory */
/* Platform specific */
-#define LVM_PERSISTENT LVM_MEM_PARTITION0+LVM_MEM_PERSISTENT+LVM_MEM_INTERNAL
-#define LVM_PERSISTENT_DATA LVM_MEM_PARTITION1+LVM_MEM_PERSISTENT+LVM_MEM_INTERNAL
-#define LVM_PERSISTENT_COEF LVM_MEM_PARTITION2+LVM_MEM_PERSISTENT+LVM_MEM_INTERNAL
-#define LVM_SCRATCH LVM_MEM_PARTITION3+LVM_MEM_SCRATCH+LVM_MEM_INTERNAL
+#define LVM_PERSISTENT (LVM_MEM_PARTITION0+LVM_MEM_PERSISTENT+LVM_MEM_INTERNAL)
+#define LVM_PERSISTENT_DATA (LVM_MEM_PARTITION1+LVM_MEM_PERSISTENT+LVM_MEM_INTERNAL)
+#define LVM_PERSISTENT_COEF (LVM_MEM_PARTITION2+LVM_MEM_PERSISTENT+LVM_MEM_INTERNAL)
+#define LVM_SCRATCH (LVM_MEM_PARTITION3+LVM_MEM_SCRATCH+LVM_MEM_INTERNAL)
/****************************************************************************************/
/* */
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h
index 87d7145..95212f2 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h
@@ -27,21 +27,21 @@
/************************************************************************************/
#define LVEQNB_GAINSHIFT 11 /* As a power of 2 */
-#define LVEQNB_Gain_Neg15_dB -1684 /* Floating point value -0.822172 */
-#define LVEQNB_Gain_Neg14_dB -1639 /* Floating point value -0.800474 */
-#define LVEQNB_Gain_Neg13_dB -1590 /* Floating point value -0.776128 */
-#define LVEQNB_Gain_Neg12_dB -1534 /* Floating point value -0.748811 */
-#define LVEQNB_Gain_Neg11_dB -1471 /* Floating point value -0.718162 */
-#define LVEQNB_Gain_Neg10_dB -1400 /* Floating point value -0.683772 */
-#define LVEQNB_Gain_Neg9_dB -1321 /* Floating point value -0.645187 */
-#define LVEQNB_Gain_Neg8_dB -1233 /* Floating point value -0.601893 */
-#define LVEQNB_Gain_Neg7_dB -1133 /* Floating point value -0.553316 */
-#define LVEQNB_Gain_Neg6_dB -1022 /* Floating point value -0.498813 */
-#define LVEQNB_Gain_Neg5_dB -896 /* Floating point value -0.437659 */
-#define LVEQNB_Gain_Neg4_dB -756 /* Floating point value -0.369043 */
-#define LVEQNB_Gain_Neg3_dB -598 /* Floating point value -0.292054 */
-#define LVEQNB_Gain_Neg2_dB -421 /* Floating point value -0.205672 */
-#define LVEQNB_Gain_Neg1_dB -223 /* Floating point value -0.108749 */
+#define LVEQNB_Gain_Neg15_dB (-1684) /* Floating point value -0.822172 */
+#define LVEQNB_Gain_Neg14_dB (-1639) /* Floating point value -0.800474 */
+#define LVEQNB_Gain_Neg13_dB (-1590) /* Floating point value -0.776128 */
+#define LVEQNB_Gain_Neg12_dB (-1534) /* Floating point value -0.748811 */
+#define LVEQNB_Gain_Neg11_dB (-1471) /* Floating point value -0.718162 */
+#define LVEQNB_Gain_Neg10_dB (-1400) /* Floating point value -0.683772 */
+#define LVEQNB_Gain_Neg9_dB (-1321) /* Floating point value -0.645187 */
+#define LVEQNB_Gain_Neg8_dB (-1233) /* Floating point value -0.601893 */
+#define LVEQNB_Gain_Neg7_dB (-1133) /* Floating point value -0.553316 */
+#define LVEQNB_Gain_Neg6_dB (-1022) /* Floating point value -0.498813 */
+#define LVEQNB_Gain_Neg5_dB (-896) /* Floating point value -0.437659 */
+#define LVEQNB_Gain_Neg4_dB (-756) /* Floating point value -0.369043 */
+#define LVEQNB_Gain_Neg3_dB (-598) /* Floating point value -0.292054 */
+#define LVEQNB_Gain_Neg2_dB (-421) /* Floating point value -0.205672 */
+#define LVEQNB_Gain_Neg1_dB (-223) /* Floating point value -0.108749 */
#define LVEQNB_Gain_0_dB 0 /* Floating point value 0.000000 */
#define LVEQNB_Gain_1_dB 250 /* Floating point value 0.122018 */
#define LVEQNB_Gain_2_dB 530 /* Floating point value 0.258925 */
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h
index 1d8bedd..03522fb 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h
@@ -52,7 +52,7 @@
#define LVPSA_NBANDSMIN 1 /* Minimum number of frequency band */
#define LVPSA_NBANDSMAX 30 /* Maximum number of frequency band */
#define LVPSA_MAXCENTERFREQ 20000 /* Maximum possible center frequency */
-#define LVPSA_MINPOSTGAIN -15 /* Minimum possible post gain */
+#define LVPSA_MINPOSTGAIN (-15) /* Minimum possible post gain */
#define LVPSA_MAXPOSTGAIN 15 /* Maximum possible post gain */
#define LVPSA_MINQFACTOR 25 /* Minimum possible Q factor */
#define LVPSA_MAXQFACTOR 1200 /* Maximum possible Q factor */
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h
index 1d55281..3e640cb 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h
@@ -27,127 +27,127 @@
/* Stereo Enhancer coefficients for 8000 Hz sample rate, scaled with 0.161258 */
#define CS_MIDDLE_8000_A0 7462 /* Floating point value 0.227720 */
-#define CS_MIDDLE_8000_A1 -7049 /* Floating point value -0.215125 */
+#define CS_MIDDLE_8000_A1 (-7049) /* Floating point value -0.215125 */
#define CS_MIDDLE_8000_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_8000_B1 -30209 /* Floating point value -0.921899 */
+#define CS_MIDDLE_8000_B1 (-30209) /* Floating point value -0.921899 */
#define CS_MIDDLE_8000_B2 0 /* Floating point value 0.000000 */
#define CS_MIDDLE_8000_SCALE 15
#define CS_SIDE_8000_A0 20036 /* Floating point value 0.611441 */
-#define CS_SIDE_8000_A1 -12463 /* Floating point value -0.380344 */
-#define CS_SIDE_8000_A2 -7573 /* Floating point value -0.231097 */
-#define CS_SIDE_8000_B1 -20397 /* Floating point value -0.622470 */
-#define CS_SIDE_8000_B2 -4285 /* Floating point value -0.130759 */
+#define CS_SIDE_8000_A1 (-12463) /* Floating point value -0.380344 */
+#define CS_SIDE_8000_A2 (-7573) /* Floating point value -0.231097 */
+#define CS_SIDE_8000_B1 (-20397) /* Floating point value -0.622470 */
+#define CS_SIDE_8000_B2 (-4285) /* Floating point value -0.130759 */
#define CS_SIDE_8000_SCALE 15
/* Stereo Enhancer coefficients for 11025Hz sample rate, scaled with 0.162943 */
#define CS_MIDDLE_11025_A0 7564 /* Floating point value 0.230838 */
-#define CS_MIDDLE_11025_A1 -7260 /* Floating point value -0.221559 */
+#define CS_MIDDLE_11025_A1 (-7260) /* Floating point value -0.221559 */
#define CS_MIDDLE_11025_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_11025_B1 -30902 /* Floating point value -0.943056 */
+#define CS_MIDDLE_11025_B1 (-30902) /* Floating point value -0.943056 */
#define CS_MIDDLE_11025_B2 0 /* Floating point value 0.000000 */
#define CS_MIDDLE_11025_SCALE 15
#define CS_SIDE_11025_A0 18264 /* Floating point value 0.557372 */
-#define CS_SIDE_11025_A1 -12828 /* Floating point value -0.391490 */
-#define CS_SIDE_11025_A2 -5436 /* Floating point value -0.165881 */
-#define CS_SIDE_11025_B1 -28856 /* Floating point value -0.880608 */
+#define CS_SIDE_11025_A1 (-12828) /* Floating point value -0.391490 */
+#define CS_SIDE_11025_A2 (-5436) /* Floating point value -0.165881 */
+#define CS_SIDE_11025_B1 (-28856) /* Floating point value -0.880608 */
#define CS_SIDE_11025_B2 1062 /* Floating point value 0.032397 */
#define CS_SIDE_11025_SCALE 15
/* Stereo Enhancer coefficients for 12000Hz sample rate, scaled with 0.162191 */
#define CS_MIDDLE_12000_A0 7534 /* Floating point value 0.229932 */
-#define CS_MIDDLE_12000_A1 -7256 /* Floating point value -0.221436 */
+#define CS_MIDDLE_12000_A1 (-7256) /* Floating point value -0.221436 */
#define CS_MIDDLE_12000_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_12000_B1 -31051 /* Floating point value -0.947616 */
+#define CS_MIDDLE_12000_B1 (-31051) /* Floating point value -0.947616 */
#define CS_MIDDLE_12000_B2 0 /* Floating point value 0.000000 */
#define CS_MIDDLE_12000_SCALE 15
#define CS_SIDE_12000_A0 18298 /* Floating point value 0.558398 */
-#define CS_SIDE_12000_A1 -12852 /* Floating point value -0.392211 */
-#define CS_SIDE_12000_A2 -5446 /* Floating point value -0.166187 */
-#define CS_SIDE_12000_B1 -29247 /* Floating point value -0.892550 */
+#define CS_SIDE_12000_A1 (-12852) /* Floating point value -0.392211 */
+#define CS_SIDE_12000_A2 (-5446) /* Floating point value -0.166187 */
+#define CS_SIDE_12000_B1 (-29247) /* Floating point value -0.892550 */
#define CS_SIDE_12000_B2 1077 /* Floating point value 0.032856 */
#define CS_SIDE_12000_SCALE 15
/* Stereo Enhancer coefficients for 16000Hz sample rate, scaled with 0.162371 */
#define CS_MIDDLE_16000_A0 7558 /* Floating point value 0.230638 */
-#define CS_MIDDLE_16000_A1 -7348 /* Floating point value -0.224232 */
+#define CS_MIDDLE_16000_A1 (-7348) /* Floating point value -0.224232 */
#define CS_MIDDLE_16000_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_16000_B1 -31475 /* Floating point value -0.960550 */
+#define CS_MIDDLE_16000_B1 (-31475) /* Floating point value -0.960550 */
#define CS_MIDDLE_16000_B2 0 /* Floating point value 0.000000 */
#define CS_MIDDLE_16000_SCALE 15
#define CS_SIDE_16000_A0 8187 /* Floating point value 0.499695 */
-#define CS_SIDE_16000_A1 -5825 /* Floating point value -0.355543 */
-#define CS_SIDE_16000_A2 -2362 /* Floating point value -0.144152 */
-#define CS_SIDE_16000_B1 -17216 /* Floating point value -1.050788 */
+#define CS_SIDE_16000_A1 (-5825) /* Floating point value -0.355543 */
+#define CS_SIDE_16000_A2 (-2362) /* Floating point value -0.144152 */
+#define CS_SIDE_16000_B1 (-17216) /* Floating point value -1.050788 */
#define CS_SIDE_16000_B2 2361 /* Floating point value 0.144104 */
#define CS_SIDE_16000_SCALE 14
/* Stereo Enhancer coefficients for 22050Hz sample rate, scaled with 0.160781 */
#define CS_MIDDLE_22050_A0 7496 /* Floating point value 0.228749 */
-#define CS_MIDDLE_22050_A1 -7344 /* Floating point value -0.224128 */
+#define CS_MIDDLE_22050_A1 (-7344) /* Floating point value -0.224128 */
#define CS_MIDDLE_22050_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_22050_B1 -31826 /* Floating point value -0.971262 */
+#define CS_MIDDLE_22050_B1 (-31826) /* Floating point value -0.971262 */
#define CS_MIDDLE_22050_B2 0 /* Floating point value 0.000000 */
#define CS_MIDDLE_22050_SCALE 15
#define CS_SIDE_22050_A0 7211 /* Floating point value 0.440112 */
-#define CS_SIDE_22050_A1 -4278 /* Floating point value -0.261096 */
-#define CS_SIDE_22050_A2 -2933 /* Floating point value -0.179016 */
-#define CS_SIDE_22050_B1 -18297 /* Floating point value -1.116786 */
+#define CS_SIDE_22050_A1 (-4278) /* Floating point value -0.261096 */
+#define CS_SIDE_22050_A2 (-2933) /* Floating point value -0.179016 */
+#define CS_SIDE_22050_B1 (-18297) /* Floating point value -1.116786 */
#define CS_SIDE_22050_B2 2990 /* Floating point value 0.182507 */
#define CS_SIDE_22050_SCALE 14
/* Stereo Enhancer coefficients for 24000Hz sample rate, scaled with 0.161882 */
#define CS_MIDDLE_24000_A0 7550 /* Floating point value 0.230395 */
-#define CS_MIDDLE_24000_A1 -7409 /* Floating point value -0.226117 */
+#define CS_MIDDLE_24000_A1 (-7409) /* Floating point value -0.226117 */
#define CS_MIDDLE_24000_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_24000_B1 -31902 /* Floating point value -0.973573 */
+#define CS_MIDDLE_24000_B1 (-31902) /* Floating point value -0.973573 */
#define CS_MIDDLE_24000_B2 0 /* Floating point value 0.000000 */
#define CS_MIDDLE_24000_SCALE 15
#define CS_SIDE_24000_A0 6796 /* Floating point value 0.414770 */
-#define CS_SIDE_24000_A1 -4705 /* Floating point value -0.287182 */
-#define CS_SIDE_24000_A2 -2090 /* Floating point value -0.127588 */
-#define CS_SIDE_24000_B1 -20147 /* Floating point value -1.229648 */
+#define CS_SIDE_24000_A1 (-4705) /* Floating point value -0.287182 */
+#define CS_SIDE_24000_A2 (-2090) /* Floating point value -0.127588 */
+#define CS_SIDE_24000_B1 (-20147) /* Floating point value -1.229648 */
#define CS_SIDE_24000_B2 4623 /* Floating point value 0.282177 */
#define CS_SIDE_24000_SCALE 14
/* Stereo Enhancer coefficients for 32000Hz sample rate, scaled with 0.160322 */
#define CS_MIDDLE_32000_A0 7484 /* Floating point value 0.228400 */
-#define CS_MIDDLE_32000_A1 -7380 /* Floating point value -0.225214 */
+#define CS_MIDDLE_32000_A1 (-7380) /* Floating point value -0.225214 */
#define CS_MIDDLE_32000_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_32000_B1 -32117 /* Floating point value -0.980126 */
+#define CS_MIDDLE_32000_B1 (-32117) /* Floating point value -0.980126 */
#define CS_MIDDLE_32000_B2 0 /* Floating point value 0.000000 */
#define CS_MIDDLE_32000_SCALE 15
#define CS_SIDE_32000_A0 5973 /* Floating point value 0.364579 */
-#define CS_SIDE_32000_A1 -3397 /* Floating point value -0.207355 */
-#define CS_SIDE_32000_A2 -2576 /* Floating point value -0.157224 */
-#define CS_SIDE_32000_B1 -20877 /* Floating point value -1.274231 */
+#define CS_SIDE_32000_A1 (-3397) /* Floating point value -0.207355 */
+#define CS_SIDE_32000_A2 (-2576) /* Floating point value -0.157224 */
+#define CS_SIDE_32000_B1 (-20877) /* Floating point value -1.274231 */
#define CS_SIDE_32000_B2 5120 /* Floating point value 0.312495 */
#define CS_SIDE_32000_SCALE 14
/* Stereo Enhancer coefficients for 44100Hz sample rate, scaled with 0.163834 */
#define CS_MIDDLE_44100_A0 7654 /* Floating point value 0.233593 */
-#define CS_MIDDLE_44100_A1 -7577 /* Floating point value -0.231225 */
+#define CS_MIDDLE_44100_A1 (-7577) /* Floating point value -0.231225 */
#define CS_MIDDLE_44100_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_44100_B1 -32294 /* Floating point value -0.985545 */
+#define CS_MIDDLE_44100_B1 (-32294) /* Floating point value -0.985545 */
#define CS_MIDDLE_44100_B2 0 /* Floating point value 0.000000 */
#define CS_MIDDLE_44100_SCALE 15
#define CS_SIDE_44100_A0 4662 /* Floating point value 0.284573 */
-#define CS_SIDE_44100_A1 -4242 /* Floating point value -0.258910 */
-#define CS_SIDE_44100_A2 -420 /* Floating point value -0.025662 */
-#define CS_SIDE_44100_B1 -25760 /* Floating point value -1.572248 */
+#define CS_SIDE_44100_A1 (-4242) /* Floating point value -0.258910 */
+#define CS_SIDE_44100_A2 (-420) /* Floating point value -0.025662 */
+#define CS_SIDE_44100_B1 (-25760) /* Floating point value -1.572248 */
#define CS_SIDE_44100_B2 9640 /* Floating point value 0.588399 */
#define CS_SIDE_44100_SCALE 14
/* Stereo Enhancer coefficients for 48000Hz sample rate, scaled with 0.164402 */
#define CS_MIDDLE_48000_A0 7682 /* Floating point value 0.234445 */
-#define CS_MIDDLE_48000_A1 -7611 /* Floating point value -0.232261 */
+#define CS_MIDDLE_48000_A1 (-7611) /* Floating point value -0.232261 */
#define CS_MIDDLE_48000_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_48000_B1 -32333 /* Floating point value -0.986713 */
+#define CS_MIDDLE_48000_B1 (-32333) /* Floating point value -0.986713 */
#define CS_MIDDLE_48000_B2 0 /* Floating point value 0.000000 */
#define CS_MIDDLE_48000_SCALE 15
#define CS_SIDE_48000_A0 4466 /* Floating point value 0.272606 */
-#define CS_SIDE_48000_A1 -4374 /* Floating point value -0.266952 */
-#define CS_SIDE_48000_A2 -93 /* Floating point value -0.005654 */
-#define CS_SIDE_48000_B1 -26495 /* Floating point value -1.617141 */
+#define CS_SIDE_48000_A1 (-4374) /* Floating point value -0.266952 */
+#define CS_SIDE_48000_A2 (-93) /* Floating point value -0.005654 */
+#define CS_SIDE_48000_B1 (-26495) /* Floating point value -1.617141 */
#define CS_SIDE_48000_B2 10329 /* Floating point value 0.630405 */
#define CS_SIDE_48000_SCALE 14
@@ -171,73 +171,73 @@
/* Reverb coefficients for 8000 Hz sample rate, scaled with 1.038030 */
#define CS_REVERB_8000_A0 21865 /* Floating point value 0.667271 */
-#define CS_REVERB_8000_A1 -21865 /* Floating point value -0.667271 */
+#define CS_REVERB_8000_A1 (-21865) /* Floating point value -0.667271 */
#define CS_REVERB_8000_A2 0 /* Floating point value 0.000000 */
-#define CS_REVERB_8000_B1 -21895 /* Floating point value -0.668179 */
+#define CS_REVERB_8000_B1 (-21895) /* Floating point value -0.668179 */
#define CS_REVERB_8000_B2 0 /* Floating point value 0.000000 */
#define CS_REVERB_8000_SCALE 15
/* Reverb coefficients for 11025Hz sample rate, scaled with 1.038030 */
#define CS_REVERB_11025_A0 22926 /* Floating point value 0.699638 */
-#define CS_REVERB_11025_A1 -22926 /* Floating point value -0.699638 */
+#define CS_REVERB_11025_A1 (-22926) /* Floating point value -0.699638 */
#define CS_REVERB_11025_A2 0 /* Floating point value 0.000000 */
-#define CS_REVERB_11025_B1 -24546 /* Floating point value -0.749096 */
+#define CS_REVERB_11025_B1 (-24546) /* Floating point value -0.749096 */
#define CS_REVERB_11025_B2 0 /* Floating point value 0.000000 */
#define CS_REVERB_11025_SCALE 15
/* Reverb coefficients for 12000Hz sample rate, scaled with 1.038030 */
#define CS_REVERB_12000_A0 23165 /* Floating point value 0.706931 */
-#define CS_REVERB_12000_A1 -23165 /* Floating point value -0.706931 */
+#define CS_REVERB_12000_A1 (-23165) /* Floating point value -0.706931 */
#define CS_REVERB_12000_A2 0 /* Floating point value 0.000000 */
-#define CS_REVERB_12000_B1 -25144 /* Floating point value -0.767327 */
+#define CS_REVERB_12000_B1 (-25144) /* Floating point value -0.767327 */
#define CS_REVERB_12000_B2 0 /* Floating point value 0.000000 */
#define CS_REVERB_12000_SCALE 15
/* Reverb coefficients for 16000Hz sample rate, scaled with 1.038030 */
#define CS_REVERB_16000_A0 23864 /* Floating point value 0.728272 */
-#define CS_REVERB_16000_A1 -23864 /* Floating point value -0.728272 */
+#define CS_REVERB_16000_A1 (-23864) /* Floating point value -0.728272 */
#define CS_REVERB_16000_A2 0 /* Floating point value 0.000000 */
-#define CS_REVERB_16000_B1 -26892 /* Floating point value -0.820679 */
+#define CS_REVERB_16000_B1 (-26892) /* Floating point value -0.820679 */
#define CS_REVERB_16000_B2 0 /* Floating point value 0.000000 */
#define CS_REVERB_16000_SCALE 15
/* Reverb coefficients for 22050Hz sample rate, scaled with 1.038030 */
#define CS_REVERB_22050_A0 16921 /* Floating point value 0.516396 */
#define CS_REVERB_22050_A1 0 /* Floating point value 0.000000 */
-#define CS_REVERB_22050_A2 -16921 /* Floating point value -0.516396 */
-#define CS_REVERB_22050_B1 -16991 /* Floating point value -0.518512 */
-#define CS_REVERB_22050_B2 -9535 /* Floating point value -0.290990 */
+#define CS_REVERB_22050_A2 (-16921) /* Floating point value -0.516396 */
+#define CS_REVERB_22050_B1 (-16991) /* Floating point value -0.518512 */
+#define CS_REVERB_22050_B2 (-9535) /* Floating point value -0.290990 */
#define CS_REVERB_22050_SCALE 15
/* Reverb coefficients for 24000Hz sample rate, scaled with 1.038030 */
#define CS_REVERB_24000_A0 15714 /* Floating point value 0.479565 */
#define CS_REVERB_24000_A1 0 /* Floating point value 0.000000 */
-#define CS_REVERB_24000_A2 -15714 /* Floating point value -0.479565 */
-#define CS_REVERB_24000_B1 -20898 /* Floating point value -0.637745 */
-#define CS_REVERB_24000_B2 -6518 /* Floating point value -0.198912 */
+#define CS_REVERB_24000_A2 (-15714) /* Floating point value -0.479565 */
+#define CS_REVERB_24000_B1 (-20898) /* Floating point value -0.637745 */
+#define CS_REVERB_24000_B2 (-6518) /* Floating point value -0.198912 */
#define CS_REVERB_24000_SCALE 15
/* Reverb coefficients for 32000Hz sample rate, scaled with 1.038030 */
#define CS_REVERB_32000_A0 12463 /* Floating point value 0.380349 */
#define CS_REVERB_32000_A1 0 /* Floating point value 0.000000 */
-#define CS_REVERB_32000_A2 -12463 /* Floating point value -0.380349 */
-#define CS_REVERB_32000_B1 -31158 /* Floating point value -0.950873 */
+#define CS_REVERB_32000_A2 (-12463) /* Floating point value -0.380349 */
+#define CS_REVERB_32000_B1 (-31158) /* Floating point value -0.950873 */
#define CS_REVERB_32000_B2 1610 /* Floating point value 0.049127 */
#define CS_REVERB_32000_SCALE 15
/* Reverb coefficients for 44100Hz sample rate, scaled with 1.038030 */
#define CS_REVERB_44100_A0 4872 /* Floating point value 0.297389 */
#define CS_REVERB_44100_A1 0 /* Floating point value 0.000000 */
-#define CS_REVERB_44100_A2 -4872 /* Floating point value -0.297389 */
-#define CS_REVERB_44100_B1 -19668 /* Floating point value -1.200423 */
+#define CS_REVERB_44100_A2 (-4872) /* Floating point value -0.297389 */
+#define CS_REVERB_44100_B1 (-19668) /* Floating point value -1.200423 */
#define CS_REVERB_44100_B2 4203 /* Floating point value 0.256529 */
#define CS_REVERB_44100_SCALE 14
/* Reverb coefficients for 48000Hz sample rate, scaled with 1.038030 */
#define CS_REVERB_48000_A0 4566 /* Floating point value 0.278661 */
#define CS_REVERB_48000_A1 0 /* Floating point value 0.000000 */
-#define CS_REVERB_48000_A2 -4566 /* Floating point value -0.278661 */
-#define CS_REVERB_48000_B1 -20562 /* Floating point value -1.254993 */
+#define CS_REVERB_48000_A2 (-4566) /* Floating point value -0.278661 */
+#define CS_REVERB_48000_B1 (-20562) /* Floating point value -1.254993 */
#define CS_REVERB_48000_B2 4970 /* Floating point value 0.303347 */
#define CS_REVERB_48000_SCALE 14
@@ -257,128 +257,128 @@
/* Equaliser coefficients for 8000 Hz sample rate, CS scaled with 1.038497 and CSEX scaled with 0.775480 */
#define CS_EQUALISER_8000_A0 20698 /* Floating point value 1.263312 */
-#define CS_EQUALISER_8000_A1 -9859 /* Floating point value -0.601748 */
-#define CS_EQUALISER_8000_A2 -4599 /* Floating point value -0.280681 */
-#define CS_EQUALISER_8000_B1 -7797 /* Floating point value -0.475865 */
-#define CS_EQUALISER_8000_B2 -6687 /* Floating point value -0.408154 */
+#define CS_EQUALISER_8000_A1 (-9859) /* Floating point value -0.601748 */
+#define CS_EQUALISER_8000_A2 (-4599) /* Floating point value -0.280681 */
+#define CS_EQUALISER_8000_B1 (-7797) /* Floating point value -0.475865 */
+#define CS_EQUALISER_8000_B2 (-6687) /* Floating point value -0.408154 */
#define CS_EQUALISER_8000_SCALE 14
#define CSEX_EQUALISER_8000_A0 30912 /* Floating point value 0.943357 */
-#define CSEX_EQUALISER_8000_A1 -14724 /* Floating point value -0.449345 */
-#define CSEX_EQUALISER_8000_A2 -6868 /* Floating point value -0.209594 */
-#define CSEX_EQUALISER_8000_B1 -15593 /* Floating point value -0.475865 */
-#define CSEX_EQUALISER_8000_B2 -13374 /* Floating point value -0.408154 */
+#define CSEX_EQUALISER_8000_A1 (-14724) /* Floating point value -0.449345 */
+#define CSEX_EQUALISER_8000_A2 (-6868) /* Floating point value -0.209594 */
+#define CSEX_EQUALISER_8000_B1 (-15593) /* Floating point value -0.475865 */
+#define CSEX_EQUALISER_8000_B2 (-13374) /* Floating point value -0.408154 */
#define CSEX_EQUALISER_8000_SCALE 15
/* Equaliser coefficients for 11025Hz sample rate, CS scaled with 1.027761 and CSEX scaled with 0.767463 */
#define CS_EQUALISER_11025_A0 18041 /* Floating point value 1.101145 */
#define CS_EQUALISER_11025_A1 2278 /* Floating point value 0.139020 */
-#define CS_EQUALISER_11025_A2 -14163 /* Floating point value -0.864423 */
+#define CS_EQUALISER_11025_A2 (-14163) /* Floating point value -0.864423 */
#define CS_EQUALISER_11025_B1 402 /* Floating point value 0.024541 */
-#define CS_EQUALISER_11025_B2 -14892 /* Floating point value -0.908930 */
+#define CS_EQUALISER_11025_B2 (-14892) /* Floating point value -0.908930 */
#define CS_EQUALISER_11025_SCALE 14
#define CSEX_EQUALISER_11025_A0 31983 /* Floating point value 0.976058 */
-#define CSEX_EQUALISER_11025_A1 -22784 /* Floating point value -0.695326 */
-#define CSEX_EQUALISER_11025_A2 -2976 /* Floating point value -0.090809 */
-#define CSEX_EQUALISER_11025_B1 -20008 /* Floating point value -0.610594 */
-#define CSEX_EQUALISER_11025_B2 -10196 /* Floating point value -0.311149 */
+#define CSEX_EQUALISER_11025_A1 (-22784) /* Floating point value -0.695326 */
+#define CSEX_EQUALISER_11025_A2 (-2976) /* Floating point value -0.090809 */
+#define CSEX_EQUALISER_11025_B1 (-20008) /* Floating point value -0.610594 */
+#define CSEX_EQUALISER_11025_B2 (-10196) /* Floating point value -0.311149 */
#define CSEX_EQUALISER_11025_SCALE 15
/* Equaliser coefficients for 12000Hz sample rate, CS scaled with 1.032521 and CSEX scaled with 0.771017 */
#define CS_EQUALISER_12000_A0 20917 /* Floating point value 1.276661 */
-#define CS_EQUALISER_12000_A1 -16671 /* Floating point value -1.017519 */
-#define CS_EQUALISER_12000_A2 -723 /* Floating point value -0.044128 */
-#define CS_EQUALISER_12000_B1 -11954 /* Floating point value -0.729616 */
-#define CS_EQUALISER_12000_B2 -3351 /* Floating point value -0.204532 */
+#define CS_EQUALISER_12000_A1 (-16671) /* Floating point value -1.017519 */
+#define CS_EQUALISER_12000_A2 (-723) /* Floating point value -0.044128 */
+#define CS_EQUALISER_12000_B1 (-11954) /* Floating point value -0.729616 */
+#define CS_EQUALISER_12000_B2 (-3351) /* Floating point value -0.204532 */
#define CS_EQUALISER_12000_SCALE 14
#define CSEX_EQUALISER_12000_A0 16500 /* Floating point value 1.007095 */
-#define CSEX_EQUALISER_12000_A1 -14285 /* Floating point value -0.871912 */
+#define CSEX_EQUALISER_12000_A1 (-14285) /* Floating point value -0.871912 */
#define CSEX_EQUALISER_12000_A2 381 /* Floating point value 0.023232 */
-#define CSEX_EQUALISER_12000_B1 -12220 /* Floating point value -0.745857 */
-#define CSEX_EQUALISER_12000_B2 -3099 /* Floating point value -0.189171 */
+#define CSEX_EQUALISER_12000_B1 (-12220) /* Floating point value -0.745857 */
+#define CSEX_EQUALISER_12000_B2 (-3099) /* Floating point value -0.189171 */
#define CSEX_EQUALISER_12000_SCALE 14
/* Equaliser coefficients for 16000Hz sample rate, CS scaled with 1.031378 and CSEX scaled with 0.770164 */
#define CS_EQUALISER_16000_A0 20998 /* Floating point value 1.281629 */
-#define CS_EQUALISER_16000_A1 -17627 /* Floating point value -1.075872 */
-#define CS_EQUALISER_16000_A2 -678 /* Floating point value -0.041365 */
-#define CS_EQUALISER_16000_B1 -11882 /* Floating point value -0.725239 */
-#define CS_EQUALISER_16000_B2 -3676 /* Floating point value -0.224358 */
+#define CS_EQUALISER_16000_A1 (-17627) /* Floating point value -1.075872 */
+#define CS_EQUALISER_16000_A2 (-678) /* Floating point value -0.041365 */
+#define CS_EQUALISER_16000_B1 (-11882) /* Floating point value -0.725239 */
+#define CS_EQUALISER_16000_B2 (-3676) /* Floating point value -0.224358 */
#define CS_EQUALISER_16000_SCALE 14
#define CSEX_EQUALISER_16000_A0 17713 /* Floating point value 1.081091 */
-#define CSEX_EQUALISER_16000_A1 -14208 /* Floating point value -0.867183 */
-#define CSEX_EQUALISER_16000_A2 -1151 /* Floating point value -0.070247 */
-#define CSEX_EQUALISER_16000_B1 -8440 /* Floating point value -0.515121 */
-#define CSEX_EQUALISER_16000_B2 -6978 /* Floating point value -0.425893 */
+#define CSEX_EQUALISER_16000_A1 (-14208) /* Floating point value -0.867183 */
+#define CSEX_EQUALISER_16000_A2 (-1151) /* Floating point value -0.070247 */
+#define CSEX_EQUALISER_16000_B1 (-8440) /* Floating point value -0.515121 */
+#define CSEX_EQUALISER_16000_B2 (-6978) /* Floating point value -0.425893 */
#define CSEX_EQUALISER_16000_SCALE 14
/* Equaliser coefficients for 22050Hz sample rate, CS scaled with 1.041576 and CSEX scaled with 0.777779 */
#define CS_EQUALISER_22050_A0 22751 /* Floating point value 1.388605 */
-#define CS_EQUALISER_22050_A1 -21394 /* Floating point value -1.305799 */
+#define CS_EQUALISER_22050_A1 (-21394) /* Floating point value -1.305799 */
#define CS_EQUALISER_22050_A2 654 /* Floating point value 0.039922 */
-#define CS_EQUALISER_22050_B1 -11788 /* Floating point value -0.719494 */
-#define CS_EQUALISER_22050_B2 -3985 /* Floating point value -0.243245 */
+#define CS_EQUALISER_22050_B1 (-11788) /* Floating point value -0.719494 */
+#define CS_EQUALISER_22050_B2 (-3985) /* Floating point value -0.243245 */
#define CS_EQUALISER_22050_SCALE 14
#define CSEX_EQUALISER_22050_A0 20855 /* Floating point value 1.272910 */
-#define CSEX_EQUALISER_22050_A1 -21971 /* Floating point value -1.341014 */
+#define CSEX_EQUALISER_22050_A1 (-21971) /* Floating point value -1.341014 */
#define CSEX_EQUALISER_22050_A2 2744 /* Floating point value 0.167462 */
-#define CSEX_EQUALISER_22050_B1 -10063 /* Floating point value -0.614219 */
-#define CSEX_EQUALISER_22050_B2 -5659 /* Floating point value -0.345384 */
+#define CSEX_EQUALISER_22050_B1 (-10063) /* Floating point value -0.614219 */
+#define CSEX_EQUALISER_22050_B2 (-5659) /* Floating point value -0.345384 */
#define CSEX_EQUALISER_22050_SCALE 14
/* Equaliser coefficients for 24000Hz sample rate, CS scaled with 1.034495 and CSEX scaled with 0.772491 */
#define CS_EQUALISER_24000_A0 23099 /* Floating point value 1.409832 */
-#define CS_EQUALISER_24000_A1 -23863 /* Floating point value -1.456506 */
+#define CS_EQUALISER_24000_A1 (-23863) /* Floating point value -1.456506 */
#define CS_EQUALISER_24000_A2 2481 /* Floating point value 0.151410 */
-#define CS_EQUALISER_24000_B1 -13176 /* Floating point value -0.804201 */
-#define CS_EQUALISER_24000_B2 -2683 /* Floating point value -0.163783 */
+#define CS_EQUALISER_24000_B1 (-13176) /* Floating point value -0.804201 */
+#define CS_EQUALISER_24000_B2 (-2683) /* Floating point value -0.163783 */
#define CS_EQUALISER_24000_SCALE 14
#define CSEX_EQUALISER_24000_A0 21286 /* Floating point value 1.299198 */
-#define CSEX_EQUALISER_24000_A1 -23797 /* Floating point value -1.452447 */
+#define CSEX_EQUALISER_24000_A1 (-23797) /* Floating point value -1.452447 */
#define CSEX_EQUALISER_24000_A2 3940 /* Floating point value 0.240489 */
-#define CSEX_EQUALISER_24000_B1 -10966 /* Floating point value -0.669303 */
-#define CSEX_EQUALISER_24000_B2 -4833 /* Floating point value -0.294984 */
+#define CSEX_EQUALISER_24000_B1 (-10966) /* Floating point value -0.669303 */
+#define CSEX_EQUALISER_24000_B2 (-4833) /* Floating point value -0.294984 */
#define CSEX_EQUALISER_24000_SCALE 14
/* Equaliser coefficients for 32000Hz sample rate, CS scaled with 1.044559 and CSEX scaled with 0.780006 */
#define CS_EQUALISER_32000_A0 25575 /* Floating point value 1.560988 */
-#define CS_EQUALISER_32000_A1 -30765 /* Floating point value -1.877724 */
+#define CS_EQUALISER_32000_A1 (-30765) /* Floating point value -1.877724 */
#define CS_EQUALISER_32000_A2 6386 /* Floating point value 0.389741 */
-#define CS_EQUALISER_32000_B1 -14867 /* Floating point value -0.907410 */
-#define CS_EQUALISER_32000_B2 -1155 /* Floating point value -0.070489 */
+#define CS_EQUALISER_32000_B1 (-14867) /* Floating point value -0.907410 */
+#define CS_EQUALISER_32000_B2 (-1155) /* Floating point value -0.070489 */
#define CS_EQUALISER_32000_SCALE 14
#define CSEX_EQUALISER_32000_A0 14623 /* Floating point value 1.785049 */
-#define CSEX_EQUALISER_32000_A1 -18297 /* Floating point value -2.233497 */
+#define CSEX_EQUALISER_32000_A1 (-18297) /* Floating point value -2.233497 */
#define CSEX_EQUALISER_32000_A2 4313 /* Floating point value 0.526431 */
-#define CSEX_EQUALISER_32000_B1 -3653 /* Floating point value -0.445939 */
-#define CSEX_EQUALISER_32000_B2 -4280 /* Floating point value -0.522446 */
+#define CSEX_EQUALISER_32000_B1 (-3653) /* Floating point value -0.445939 */
+#define CSEX_EQUALISER_32000_B2 (-4280) /* Floating point value -0.522446 */
#define CSEX_EQUALISER_32000_SCALE 13
/* Equaliser coefficients for 44100Hz sample rate, CS scaled with 1.022170 and CSEX scaled with 0.763288 */
#define CS_EQUALISER_44100_A0 13304 /* Floating point value 1.623993 */
-#define CS_EQUALISER_44100_A1 -18602 /* Floating point value -2.270743 */
+#define CS_EQUALISER_44100_A1 (-18602) /* Floating point value -2.270743 */
#define CS_EQUALISER_44100_A2 5643 /* Floating point value 0.688829 */
-#define CS_EQUALISER_44100_B1 -9152 /* Floating point value -1.117190 */
+#define CS_EQUALISER_44100_B1 (-9152) /* Floating point value -1.117190 */
#define CS_EQUALISER_44100_B2 1067 /* Floating point value 0.130208 */
#define CS_EQUALISER_44100_SCALE 13
#define CSEX_EQUALISER_44100_A0 16616 /* Floating point value 2.028315 */
-#define CSEX_EQUALISER_44100_A1 -23613 /* Floating point value -2.882459 */
+#define CSEX_EQUALISER_44100_A1 (-23613) /* Floating point value -2.882459 */
#define CSEX_EQUALISER_44100_A2 7410 /* Floating point value 0.904535 */
-#define CSEX_EQUALISER_44100_B1 -4860 /* Floating point value -0.593308 */
-#define CSEX_EQUALISER_44100_B2 -3161 /* Floating point value -0.385816 */
+#define CSEX_EQUALISER_44100_B1 (-4860) /* Floating point value -0.593308 */
+#define CSEX_EQUALISER_44100_B2 (-3161) /* Floating point value -0.385816 */
#define CSEX_EQUALISER_44100_SCALE 13
/* Equaliser coefficients for 48000Hz sample rate, CS scaled with 1.018635 and CSEX scaled with 0.760648 */
#define CS_EQUALISER_48000_A0 13445 /* Floating point value 1.641177 */
-#define CS_EQUALISER_48000_A1 -19372 /* Floating point value -2.364687 */
+#define CS_EQUALISER_48000_A1 (-19372) /* Floating point value -2.364687 */
#define CS_EQUALISER_48000_A2 6225 /* Floating point value 0.759910 */
-#define CS_EQUALISER_48000_B1 -9558 /* Floating point value -1.166774 */
+#define CS_EQUALISER_48000_B1 (-9558) /* Floating point value -1.166774 */
#define CS_EQUALISER_48000_B2 1459 /* Floating point value 0.178074 */
#define CS_EQUALISER_48000_SCALE 13
#define CSEX_EQUALISER_48000_A0 17200 /* Floating point value 2.099655 */
-#define CSEX_EQUALISER_48000_A1 -25110 /* Floating point value -3.065220 */
+#define CSEX_EQUALISER_48000_A1 (-25110) /* Floating point value -3.065220 */
#define CSEX_EQUALISER_48000_A2 8277 /* Floating point value 1.010417 */
-#define CSEX_EQUALISER_48000_B1 -5194 /* Floating point value -0.634021 */
-#define CSEX_EQUALISER_48000_B2 -2845 /* Floating point value -0.347332 */
+#define CSEX_EQUALISER_48000_B1 (-5194) /* Floating point value -0.634021 */
+#define CSEX_EQUALISER_48000_B2 (-2845) /* Floating point value -0.347332 */
#define CSEX_EQUALISER_48000_SCALE 13
diff --git a/media/libeffects/lvm/wrapper/Android.mk b/media/libeffects/lvm/wrapper/Android.mk
index 68ba34c..4e38e3d 100644
--- a/media/libeffects/lvm/wrapper/Android.mk
+++ b/media/libeffects/lvm/wrapper/Android.mk
@@ -18,6 +18,7 @@
LOCAL_STATIC_LIBRARIES += libmusicbundle
LOCAL_SHARED_LIBRARIES := \
+ liblog \
libcutils \
libdl
@@ -47,6 +48,7 @@
LOCAL_STATIC_LIBRARIES += libreverb
LOCAL_SHARED_LIBRARIES := \
+ liblog \
libcutils \
libdl
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
index c0d7c6c..d5fb6e7 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
@@ -16,7 +16,7 @@
*/
#define LOG_TAG "Bundle"
-#define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
+#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array)[0])
//#define LOG_NDEBUG 0
#include <assert.h>
@@ -25,28 +25,28 @@
#include <stdlib.h>
#include <string.h>
-#include <cutils/log.h>
+#include <log/log.h>
+
#include "EffectBundle.h"
#include "math.h"
-
// effect_handle_t interface implementation for bass boost
extern "C" const struct effect_interface_s gLvmEffectInterface;
#define LVM_ERROR_CHECK(LvmStatus, callingFunc, calledFunc){\
- if (LvmStatus == LVM_NULLADDRESS){\
+ if ((LvmStatus) == LVM_NULLADDRESS){\
ALOGV("\tLVM_ERROR : Parameter error - "\
"null pointer returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
}\
- if (LvmStatus == LVM_ALIGNMENTERROR){\
+ if ((LvmStatus) == LVM_ALIGNMENTERROR){\
ALOGV("\tLVM_ERROR : Parameter error - "\
"bad alignment returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
}\
- if (LvmStatus == LVM_INVALIDNUMSAMPLES){\
+ if ((LvmStatus) == LVM_INVALIDNUMSAMPLES){\
ALOGV("\tLVM_ERROR : Parameter error - "\
"bad number of samples returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
}\
- if (LvmStatus == LVM_OUTOFRANGE){\
+ if ((LvmStatus) == LVM_OUTOFRANGE){\
ALOGV("\tLVM_ERROR : Parameter error - "\
"out of range returned by %s in %s\n", callingFunc, calledFunc);\
}\
diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
index 4dc8b45..fc82dd1 100644
--- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
+++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
@@ -16,7 +16,7 @@
*/
#define LOG_TAG "Reverb"
-#define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
+#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array)[0])
//#define LOG_NDEBUG 0
#include <assert.h>
@@ -25,7 +25,8 @@
#include <stdlib.h>
#include <string.h>
-#include <cutils/log.h>
+#include <log/log.h>
+
#include "EffectReverb.h"
// from Reverb/lib
#include "LVREV.h"
@@ -34,15 +35,15 @@
extern "C" const struct effect_interface_s gReverbInterface;
#define LVM_ERROR_CHECK(LvmStatus, callingFunc, calledFunc){\
- if (LvmStatus == LVREV_NULLADDRESS){\
+ if ((LvmStatus) == LVREV_NULLADDRESS){\
ALOGV("\tLVREV_ERROR : Parameter error - "\
"null pointer returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
}\
- if (LvmStatus == LVREV_INVALIDNUMSAMPLES){\
+ if ((LvmStatus) == LVREV_INVALIDNUMSAMPLES){\
ALOGV("\tLVREV_ERROR : Parameter error - "\
"bad number of samples returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
}\
- if (LvmStatus == LVREV_OUTOFRANGE){\
+ if ((LvmStatus) == LVREV_OUTOFRANGE){\
ALOGV("\tLVREV_ERROR : Parameter error - "\
"out of range returned by %s in %s\n", callingFunc, calledFunc);\
}\
diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h
index 7c15b18..8165f5a 100644
--- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h
+++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h
@@ -30,7 +30,7 @@
#define LVREV_MAX_REVERB_LEVEL 2000
#define LVREV_MAX_FRAME_SIZE 2560
#define LVREV_CUP_LOAD_ARM9E 470 // Expressed in 0.1 MIPS
-#define LVREV_MEM_USAGE 71+(LVREV_MAX_FRAME_SIZE>>7) // Expressed in kB
+#define LVREV_MEM_USAGE (71+(LVREV_MAX_FRAME_SIZE>>7)) // Expressed in kB
//#define LVM_PCM
typedef struct _LPFPair_t
diff --git a/media/libeffects/preprocessing/Android.mk b/media/libeffects/preprocessing/Android.mk
index 4e4b094..bd67aa1 100644
--- a/media/libeffects/preprocessing/Android.mk
+++ b/media/libeffects/preprocessing/Android.mk
@@ -16,8 +16,6 @@
external/webrtc/webrtc/modules/audio_processing/include \
$(call include-path-for, audio-effects)
-LOCAL_C_INCLUDES += $(call include-path-for, speex)
-
LOCAL_SHARED_LIBRARIES := \
libwebrtc_audio_preprocessing \
libspeexresampler \
diff --git a/media/libeffects/proxy/EffectProxy.cpp b/media/libeffects/proxy/EffectProxy.cpp
index 62d3fd3..0eddc15 100644
--- a/media/libeffects/proxy/EffectProxy.cpp
+++ b/media/libeffects/proxy/EffectProxy.cpp
@@ -17,13 +17,16 @@
#define LOG_TAG "EffectProxy"
//#define LOG_NDEBUG 0
-#include <cutils/log.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <new>
+
#include <EffectProxy.h>
+
+#include <log/log.h>
#include <utils/threads.h>
+
#include <media/EffectsFactoryApi.h>
namespace android {
@@ -91,6 +94,7 @@
delete[] pContext->sube;
delete[] pContext->desc;
delete[] pContext->aeli;
+ delete pContext;
return -EINVAL;
}
// Check which is the HW descriptor and copy the descriptors
diff --git a/media/libeffects/testlibs/EffectEqualizer.cpp b/media/libeffects/testlibs/EffectEqualizer.cpp
index 3cb13f2..db4d009 100644
--- a/media/libeffects/testlibs/EffectEqualizer.cpp
+++ b/media/libeffects/testlibs/EffectEqualizer.cpp
@@ -18,17 +18,20 @@
#define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
//
#define LOG_NDEBUG 0
-#include <cutils/log.h>
+
#include <assert.h>
#include <stdlib.h>
#include <string.h>
+
#include <new>
+
+#include <log/log.h>
+
#include "AudioEqualizer.h"
#include "AudioBiquadFilter.h"
#include "AudioFormatAdapter.h"
#include <audio_effects/effect_equalizer.h>
-
// effect_handle_t interface implementation for equalizer effect
extern "C" const struct effect_interface_s gEqualizerInterface;
diff --git a/media/libeffects/testlibs/EffectReverb.c b/media/libeffects/testlibs/EffectReverb.c
index f056d19..fce9bed 100644
--- a/media/libeffects/testlibs/EffectReverb.c
+++ b/media/libeffects/testlibs/EffectReverb.c
@@ -16,10 +16,13 @@
#define LOG_TAG "EffectReverb"
//#define LOG_NDEBUG 0
-#include <cutils/log.h>
+
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
-#include <stdbool.h>
+
+#include <log/log.h>
+
#include "EffectReverb.h"
#include "EffectsMath.h"
diff --git a/media/libeffects/testlibs/EffectsMath.c b/media/libeffects/testlibs/EffectsMath.c
index 41ec662..efd9e87 100644
--- a/media/libeffects/testlibs/EffectsMath.c
+++ b/media/libeffects/testlibs/EffectsMath.c
@@ -15,9 +15,11 @@
*/
#define LOG_TAG "EFFECTSMATH"
//#define LOG_NDEBUG 0
-#include <cutils/log.h>
+
#include <assert.h>
+#include <android/log.h>
+
#include "EffectsMath.h"
// gLogTab contains pre-calculated values of log2(1 + ai5*2^-1 + ai4*2^-2 + ai3*2^-3 + ai2*2^-4 + ai1*2^-5 + ai0*2^-6)
diff --git a/media/libeffects/visualizer/EffectVisualizer.cpp b/media/libeffects/visualizer/EffectVisualizer.cpp
index b7d27d6..6a126ef 100644
--- a/media/libeffects/visualizer/EffectVisualizer.cpp
+++ b/media/libeffects/visualizer/EffectVisualizer.cpp
@@ -16,17 +16,19 @@
#define LOG_TAG "EffectVisualizer"
//#define LOG_NDEBUG 0
-#include <log/log.h>
+
#include <assert.h>
#include <inttypes.h>
+#include <math.h>
#include <stdlib.h>
#include <string.h>
-#include <new>
#include <time.h>
-#include <math.h>
-#include <audio_effects/effect_visualizer.h>
-#include <cutils/log.h>
+#include <new>
+
+#include <log/log.h>
+
+#include <audio_effects/effect_visualizer.h>
extern "C" {
diff --git a/media/libmedia/Android.bp b/media/libmedia/Android.bp
new file mode 100644
index 0000000..7fde4b2
--- /dev/null
+++ b/media/libmedia/Android.bp
@@ -0,0 +1,10 @@
+cc_library_static {
+ name: "libmedia_helper",
+ srcs: ["AudioParameter.cpp"],
+ cflags: [
+ "-Werror",
+ "-Wno-error=deprecated-declarations",
+ "-Wall",
+ ],
+ clang: true,
+}
diff --git a/media/libmedia/Android.mk b/media/libmedia/Android.mk
index 2bdfd43..3ba7ec1 100644
--- a/media/libmedia/Android.mk
+++ b/media/libmedia/Android.mk
@@ -3,38 +3,17 @@
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
- AudioParameter.cpp
-LOCAL_MODULE:= libmedia_helper
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_CFLAGS += -Werror -Wno-error=deprecated-declarations -Wall
-LOCAL_CLANG := true
-
-include $(BUILD_STATIC_LIBRARY)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- AudioTrack.cpp \
- AudioTrackShared.cpp \
- IAudioFlinger.cpp \
- IAudioFlingerClient.cpp \
- IAudioTrack.cpp \
- IAudioRecord.cpp \
ICrypto.cpp \
IDataSource.cpp \
IDrm.cpp \
IDrmClient.cpp \
IHDCP.cpp \
- AudioRecord.cpp \
- AudioSystem.cpp \
mediaplayer.cpp \
IMediaCodecList.cpp \
IMediaCodecService.cpp \
IMediaDrmService.cpp \
IMediaHTTPConnection.cpp \
IMediaHTTPService.cpp \
- IMediaLogService.cpp \
IMediaExtractor.cpp \
IMediaExtractorService.cpp \
IMediaPlayerService.cpp \
@@ -55,11 +34,8 @@
IMediaMetadataRetriever.cpp \
mediametadataretriever.cpp \
MidiIoWrapper.cpp \
- ToneGenerator.cpp \
JetPlayer.cpp \
IOMX.cpp \
- IAudioPolicyService.cpp \
- IAudioPolicyServiceClient.cpp \
MediaScanner.cpp \
MediaScannerClient.cpp \
CharacterEncodingDetector.cpp \
@@ -67,18 +43,15 @@
MediaProfiles.cpp \
MediaResource.cpp \
MediaResourcePolicy.cpp \
- IEffect.cpp \
- IEffectClient.cpp \
- AudioEffect.cpp \
Visualizer.cpp \
- MemoryLeakTrackUtil.cpp \
StringArray.cpp \
- AudioPolicy.cpp
LOCAL_SHARED_LIBRARIES := \
libui liblog libcutils libutils libbinder libsonivox libicuuc libicui18n libexpat \
libcamera_client libstagefright_foundation \
- libgui libdl libaudioutils libnbaio
+ libgui libdl libaudioutils libaudioclient
+
+LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libbinder
LOCAL_WHOLE_STATIC_LIBRARIES := libmedia_helper
diff --git a/media/libmedia/ICrypto.cpp b/media/libmedia/ICrypto.cpp
index 302e6ee..7b261be 100644
--- a/media/libmedia/ICrypto.cpp
+++ b/media/libmedia/ICrypto.cpp
@@ -39,7 +39,7 @@
};
struct BpCrypto : public BpInterface<ICrypto> {
- BpCrypto(const sp<IBinder> &impl)
+ explicit BpCrypto(const sp<IBinder> &impl)
: BpInterface<ICrypto>(impl) {
}
diff --git a/media/libmedia/IDataSource.cpp b/media/libmedia/IDataSource.cpp
index 51c9938..7df3b65 100644
--- a/media/libmedia/IDataSource.cpp
+++ b/media/libmedia/IDataSource.cpp
@@ -39,7 +39,8 @@
};
struct BpDataSource : public BpInterface<IDataSource> {
- BpDataSource(const sp<IBinder>& impl) : BpInterface<IDataSource>(impl) {}
+ explicit BpDataSource(const sp<IBinder>& impl)
+ : BpInterface<IDataSource>(impl) {}
virtual sp<IMemory> getIMemory() {
Parcel data, reply;
diff --git a/media/libmedia/IDrm.cpp b/media/libmedia/IDrm.cpp
index 51a1130..c4558c6 100644
--- a/media/libmedia/IDrm.cpp
+++ b/media/libmedia/IDrm.cpp
@@ -59,7 +59,7 @@
};
struct BpDrm : public BpInterface<IDrm> {
- BpDrm(const sp<IBinder> &impl)
+ explicit BpDrm(const sp<IBinder> &impl)
: BpInterface<IDrm>(impl) {
}
diff --git a/media/libmedia/IDrmClient.cpp b/media/libmedia/IDrmClient.cpp
index 490c6ed..444201f 100644
--- a/media/libmedia/IDrmClient.cpp
+++ b/media/libmedia/IDrmClient.cpp
@@ -35,7 +35,7 @@
class BpDrmClient: public BpInterface<IDrmClient>
{
public:
- BpDrmClient(const sp<IBinder>& impl)
+ explicit BpDrmClient(const sp<IBinder>& impl)
: BpInterface<IDrmClient>(impl)
{
}
diff --git a/media/libmedia/IHDCP.cpp b/media/libmedia/IHDCP.cpp
index f3a8902..21e35f6 100644
--- a/media/libmedia/IHDCP.cpp
+++ b/media/libmedia/IHDCP.cpp
@@ -37,7 +37,7 @@
};
struct BpHDCPObserver : public BpInterface<IHDCPObserver> {
- BpHDCPObserver(const sp<IBinder> &impl)
+ explicit BpHDCPObserver(const sp<IBinder> &impl)
: BpInterface<IHDCPObserver>(impl) {
}
@@ -58,7 +58,7 @@
IMPLEMENT_META_INTERFACE(HDCPObserver, "android.hardware.IHDCPObserver");
struct BpHDCP : public BpInterface<IHDCP> {
- BpHDCP(const sp<IBinder> &impl)
+ explicit BpHDCP(const sp<IBinder> &impl)
: BpInterface<IHDCP>(impl) {
}
diff --git a/media/libmedia/IMediaCodecList.cpp b/media/libmedia/IMediaCodecList.cpp
index 737f50c..806f46d 100644
--- a/media/libmedia/IMediaCodecList.cpp
+++ b/media/libmedia/IMediaCodecList.cpp
@@ -38,7 +38,7 @@
class BpMediaCodecList: public BpInterface<IMediaCodecList>
{
public:
- BpMediaCodecList(const sp<IBinder>& impl)
+ explicit BpMediaCodecList(const sp<IBinder>& impl)
: BpInterface<IMediaCodecList>(impl)
{
}
diff --git a/media/libmedia/IMediaExtractor.cpp b/media/libmedia/IMediaExtractor.cpp
index 72d1d7c..4be1118 100644
--- a/media/libmedia/IMediaExtractor.cpp
+++ b/media/libmedia/IMediaExtractor.cpp
@@ -209,11 +209,16 @@
for (size_t i = 0; i < tracks.size(); i++) {
const String8 desc = trackDescriptions.itemAt(i);
str.appendFormat(" track {%s} ", desc.string());
- const sp<IMediaSource> source = tracks.itemAt(i).promote();
- if (source == NULL) {
- str.append(": deleted\n");
+ wp<IMediaSource> wSource = tracks.itemAt(i);
+ if (wSource == NULL) {
+ str.append(": null\n");
} else {
- str.appendFormat(": active\n");
+ const sp<IMediaSource> source = wSource.promote();
+ if (source == NULL) {
+ str.append(": deleted\n");
+ } else {
+ str.appendFormat(": active\n");
+ }
}
}
return str;
@@ -232,9 +237,14 @@
if (extractor != NULL && extractor == ex) {
if (instance.tracks.size() > 5) {
instance.tracks.resize(5);
+ instance.trackDescriptions.resize(5);
}
instance.tracks.push_front(source);
- instance.trackDescriptions.add(source->getFormat()->toString());
+ if (source != NULL) {
+ instance.trackDescriptions.push_front(source->getFormat()->toString());
+ } else {
+ instance.trackDescriptions.push_front(String8::empty());
+ }
break;
}
}
diff --git a/media/libmedia/IMediaHTTPConnection.cpp b/media/libmedia/IMediaHTTPConnection.cpp
index 0dda0be9..e4b717b 100644
--- a/media/libmedia/IMediaHTTPConnection.cpp
+++ b/media/libmedia/IMediaHTTPConnection.cpp
@@ -38,7 +38,7 @@
};
struct BpMediaHTTPConnection : public BpInterface<IMediaHTTPConnection> {
- BpMediaHTTPConnection(const sp<IBinder> &impl)
+ explicit BpMediaHTTPConnection(const sp<IBinder> &impl)
: BpInterface<IMediaHTTPConnection>(impl) {
}
diff --git a/media/libmedia/IMediaHTTPService.cpp b/media/libmedia/IMediaHTTPService.cpp
index 0c16a2b..062a07a 100644
--- a/media/libmedia/IMediaHTTPService.cpp
+++ b/media/libmedia/IMediaHTTPService.cpp
@@ -30,7 +30,7 @@
};
struct BpMediaHTTPService : public BpInterface<IMediaHTTPService> {
- BpMediaHTTPService(const sp<IBinder> &impl)
+ explicit BpMediaHTTPService(const sp<IBinder> &impl)
: BpInterface<IMediaHTTPService>(impl) {
}
diff --git a/media/libmedia/IMediaMetadataRetriever.cpp b/media/libmedia/IMediaMetadataRetriever.cpp
index 0bee8d3..7058ee8 100644
--- a/media/libmedia/IMediaMetadataRetriever.cpp
+++ b/media/libmedia/IMediaMetadataRetriever.cpp
@@ -75,7 +75,7 @@
class BpMediaMetadataRetriever: public BpInterface<IMediaMetadataRetriever>
{
public:
- BpMediaMetadataRetriever(const sp<IBinder>& impl)
+ explicit BpMediaMetadataRetriever(const sp<IBinder>& impl)
: BpInterface<IMediaMetadataRetriever>(impl)
{
}
diff --git a/media/libmedia/IMediaPlayer.cpp b/media/libmedia/IMediaPlayer.cpp
index 519a1fd..f8345e4 100644
--- a/media/libmedia/IMediaPlayer.cpp
+++ b/media/libmedia/IMediaPlayer.cpp
@@ -72,7 +72,7 @@
class BpMediaPlayer: public BpInterface<IMediaPlayer>
{
public:
- BpMediaPlayer(const sp<IBinder>& impl)
+ explicit BpMediaPlayer(const sp<IBinder>& impl)
: BpInterface<IMediaPlayer>(impl)
{
}
diff --git a/media/libmedia/IMediaPlayerClient.cpp b/media/libmedia/IMediaPlayerClient.cpp
index d608386..bbf8475 100644
--- a/media/libmedia/IMediaPlayerClient.cpp
+++ b/media/libmedia/IMediaPlayerClient.cpp
@@ -30,7 +30,7 @@
class BpMediaPlayerClient: public BpInterface<IMediaPlayerClient>
{
public:
- BpMediaPlayerClient(const sp<IBinder>& impl)
+ explicit BpMediaPlayerClient(const sp<IBinder>& impl)
: BpInterface<IMediaPlayerClient>(impl)
{
}
diff --git a/media/libmedia/IMediaPlayerService.cpp b/media/libmedia/IMediaPlayerService.cpp
index 7590c1b..a01852c 100644
--- a/media/libmedia/IMediaPlayerService.cpp
+++ b/media/libmedia/IMediaPlayerService.cpp
@@ -50,7 +50,7 @@
class BpMediaPlayerService: public BpInterface<IMediaPlayerService>
{
public:
- BpMediaPlayerService(const sp<IBinder>& impl)
+ explicit BpMediaPlayerService(const sp<IBinder>& impl)
: BpInterface<IMediaPlayerService>(impl)
{
}
diff --git a/media/libmedia/IMediaRecorder.cpp b/media/libmedia/IMediaRecorder.cpp
index cded55c..a6860e2 100644
--- a/media/libmedia/IMediaRecorder.cpp
+++ b/media/libmedia/IMediaRecorder.cpp
@@ -63,7 +63,7 @@
class BpMediaRecorder: public BpInterface<IMediaRecorder>
{
public:
- BpMediaRecorder(const sp<IBinder>& impl)
+ explicit BpMediaRecorder(const sp<IBinder>& impl)
: BpInterface<IMediaRecorder>(impl)
{
}
diff --git a/media/libmedia/IMediaRecorderClient.cpp b/media/libmedia/IMediaRecorderClient.cpp
index 6795d23..a76f934 100644
--- a/media/libmedia/IMediaRecorderClient.cpp
+++ b/media/libmedia/IMediaRecorderClient.cpp
@@ -30,7 +30,7 @@
class BpMediaRecorderClient: public BpInterface<IMediaRecorderClient>
{
public:
- BpMediaRecorderClient(const sp<IBinder>& impl)
+ explicit BpMediaRecorderClient(const sp<IBinder>& impl)
: BpInterface<IMediaRecorderClient>(impl)
{
}
diff --git a/media/libmedia/IOMX.cpp b/media/libmedia/IOMX.cpp
index 1090a83..beca464 100644
--- a/media/libmedia/IOMX.cpp
+++ b/media/libmedia/IOMX.cpp
@@ -66,7 +66,7 @@
class BpOMX : public BpInterface<IOMX> {
public:
- BpOMX(const sp<IBinder> &impl)
+ explicit BpOMX(const sp<IBinder> &impl)
: BpInterface<IOMX>(impl) {
}
@@ -630,7 +630,7 @@
////////////////////////////////////////////////////////////////////////////////
#define CHECK_OMX_INTERFACE(interface, data, reply) \
- do { if (!data.enforceInterface(interface::getInterfaceDescriptor())) { \
+ do { if (!(data).enforceInterface(interface::getInterfaceDescriptor())) { \
ALOGW("Call incorrectly routed to " #interface); \
return PERMISSION_DENIED; \
} } while (0)
@@ -758,7 +758,7 @@
params = mmap(NULL, allocSize, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1 /* fd */, 0 /* offset */);
}
- if (params != MAP_FAILED) {
+ if (params != MAP_FAILED && params != NULL) {
err = data.read(params, size);
if (err != OK) {
android_errorWriteLog(0x534e4554, "26914474");
@@ -1231,7 +1231,7 @@
class BpOMXObserver : public BpInterface<IOMXObserver> {
public:
- BpOMXObserver(const sp<IBinder> &impl)
+ explicit BpOMXObserver(const sp<IBinder> &impl)
: BpInterface<IOMXObserver>(impl) {
}
diff --git a/media/libmedia/IRemoteDisplay.cpp b/media/libmedia/IRemoteDisplay.cpp
index 869d11a..85c7bd6 100644
--- a/media/libmedia/IRemoteDisplay.cpp
+++ b/media/libmedia/IRemoteDisplay.cpp
@@ -30,7 +30,7 @@
class BpRemoteDisplay: public BpInterface<IRemoteDisplay>
{
public:
- BpRemoteDisplay(const sp<IBinder>& impl)
+ explicit BpRemoteDisplay(const sp<IBinder>& impl)
: BpInterface<IRemoteDisplay>(impl)
{
}
diff --git a/media/libmedia/IRemoteDisplayClient.cpp b/media/libmedia/IRemoteDisplayClient.cpp
index bedeb6c..ca67665 100644
--- a/media/libmedia/IRemoteDisplayClient.cpp
+++ b/media/libmedia/IRemoteDisplayClient.cpp
@@ -32,7 +32,7 @@
class BpRemoteDisplayClient: public BpInterface<IRemoteDisplayClient>
{
public:
- BpRemoteDisplayClient(const sp<IBinder>& impl)
+ explicit BpRemoteDisplayClient(const sp<IBinder>& impl)
: BpInterface<IRemoteDisplayClient>(impl)
{
}
diff --git a/media/libmedia/IResourceManagerClient.cpp b/media/libmedia/IResourceManagerClient.cpp
index b3f56e8..1fea479 100644
--- a/media/libmedia/IResourceManagerClient.cpp
+++ b/media/libmedia/IResourceManagerClient.cpp
@@ -31,7 +31,7 @@
class BpResourceManagerClient: public BpInterface<IResourceManagerClient>
{
public:
- BpResourceManagerClient(const sp<IBinder> &impl)
+ explicit BpResourceManagerClient(const sp<IBinder> &impl)
: BpInterface<IResourceManagerClient>(impl)
{
}
diff --git a/media/libmedia/IResourceManagerService.cpp b/media/libmedia/IResourceManagerService.cpp
index 6cb4440..95f7d2e 100644
--- a/media/libmedia/IResourceManagerService.cpp
+++ b/media/libmedia/IResourceManagerService.cpp
@@ -58,7 +58,7 @@
class BpResourceManagerService : public BpInterface<IResourceManagerService>
{
public:
- BpResourceManagerService(const sp<IBinder> &impl)
+ explicit BpResourceManagerService(const sp<IBinder> &impl)
: BpInterface<IResourceManagerService>(impl)
{
}
diff --git a/media/libmedia/IStreamSource.cpp b/media/libmedia/IStreamSource.cpp
index 8c0905c..ba0a272 100644
--- a/media/libmedia/IStreamSource.cpp
+++ b/media/libmedia/IStreamSource.cpp
@@ -51,7 +51,7 @@
};
struct BpStreamSource : public BpInterface<IStreamSource> {
- BpStreamSource(const sp<IBinder> &impl)
+ explicit BpStreamSource(const sp<IBinder> &impl)
: BpInterface<IStreamSource>(impl) {
}
@@ -145,7 +145,7 @@
////////////////////////////////////////////////////////////////////////////////
struct BpStreamListener : public BpInterface<IStreamListener> {
- BpStreamListener(const sp<IBinder> &impl)
+ explicit BpStreamListener(const sp<IBinder> &impl)
: BpInterface<IStreamListener>(impl) {
}
diff --git a/media/libmedia/MediaUtils.cpp b/media/libmedia/MediaUtils.cpp
index a02ca65..dc2bc82 100644
--- a/media/libmedia/MediaUtils.cpp
+++ b/media/libmedia/MediaUtils.cpp
@@ -31,6 +31,11 @@
size_t numberOfBytes,
size_t percentageOfTotalMem) {
+ if (running_with_asan()) {
+ ALOGW("Running with ASan, skip enforcing memory limitations.");
+ return;
+ }
+
long pageSize = sysconf(_SC_PAGESIZE);
long numPages = sysconf(_SC_PHYS_PAGES);
size_t maxMem = SIZE_MAX;
diff --git a/media/libmedia/MediaUtils.h b/media/libmedia/MediaUtils.h
index f80dd30..a678bcc 100644
--- a/media/libmedia/MediaUtils.h
+++ b/media/libmedia/MediaUtils.h
@@ -19,6 +19,12 @@
namespace android {
+extern "C" void __asan_init(void) __attribute__((weak));
+
+static inline int running_with_asan() {
+ return &__asan_init != 0;
+}
+
/**
Limit the amount of memory a process can allocate using setrlimit(RLIMIT_AS).
The value to use will be read from the specified system property, or if the
diff --git a/media/libmediaplayerservice/Android.mk b/media/libmediaplayerservice/Android.mk
index 8d86366..93064c3 100644
--- a/media/libmediaplayerservice/Android.mk
+++ b/media/libmediaplayerservice/Android.mk
@@ -19,7 +19,6 @@
LOCAL_SHARED_LIBRARIES := \
libbinder \
- libcamera_client \
libcrypto \
libcutils \
libdrmframework \
@@ -27,22 +26,23 @@
libdl \
libgui \
libmedia \
+ libaudioclient \
libmediautils \
libmemunreachable \
- libsonivox \
libstagefright \
libstagefright_foundation \
libstagefright_httplive \
libstagefright_omx \
libstagefright_wfd \
libutils \
- libvorbisidec \
LOCAL_STATIC_LIBRARIES := \
libstagefright_nuplayer \
libstagefright_rtsp \
libstagefright_timedtext \
+LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libmedia
+
LOCAL_C_INCLUDES := \
$(TOP)/frameworks/av/media/libstagefright/include \
$(TOP)/frameworks/av/media/libstagefright/rtsp \
@@ -53,7 +53,6 @@
$(TOP)/frameworks/native/include/media/openmax \
$(TOP)/frameworks/native/include/media/hardware \
$(TOP)/external/tremolo/Tremolo \
- libcore/include \
LOCAL_CFLAGS += -Werror -Wno-error=deprecated-declarations -Wall
LOCAL_CLANG := true
diff --git a/media/libmediaplayerservice/HDCP.h b/media/libmediaplayerservice/HDCP.h
index 26ddc86..83c61b5 100644
--- a/media/libmediaplayerservice/HDCP.h
+++ b/media/libmediaplayerservice/HDCP.h
@@ -24,7 +24,7 @@
namespace android {
struct HDCP : public BnHDCP {
- HDCP(bool createEncryptionModule);
+ explicit HDCP(bool createEncryptionModule);
virtual ~HDCP();
virtual status_t setObserver(const sp<IHDCPObserver> &observer);
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index bd16e91..95c91d1 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -307,7 +307,7 @@
return recorder;
}
-void MediaPlayerService::removeMediaRecorderClient(wp<MediaRecorderClient> client)
+void MediaPlayerService::removeMediaRecorderClient(const wp<MediaRecorderClient>& client)
{
Mutex::Autolock lock(mLock);
mMediaRecorderClients.remove(client);
@@ -552,7 +552,7 @@
return NO_ERROR;
}
-void MediaPlayerService::removeClient(wp<Client> client)
+void MediaPlayerService::removeClient(const wp<Client>& client)
{
Mutex::Autolock lock(mLock);
mClients.remove(client);
diff --git a/media/libmediaplayerservice/MediaPlayerService.h b/media/libmediaplayerservice/MediaPlayerService.h
index 7a41d9c..601b046 100644
--- a/media/libmediaplayerservice/MediaPlayerService.h
+++ b/media/libmediaplayerservice/MediaPlayerService.h
@@ -169,7 +169,7 @@
class CallbackData {
friend AudioOutput;
public:
- CallbackData(AudioOutput *cookie) {
+ explicit CallbackData(AudioOutput *cookie) {
mData = cookie;
mSwitching = false;
}
@@ -212,7 +212,7 @@
// IMediaPlayerService interface
virtual sp<IMediaRecorder> createMediaRecorder(const String16 &opPackageName);
- void removeMediaRecorderClient(wp<MediaRecorderClient> client);
+ void removeMediaRecorderClient(const wp<MediaRecorderClient>& client);
virtual sp<IMediaMetadataRetriever> createMetadataRetriever();
virtual sp<IMediaPlayer> create(const sp<IMediaPlayerClient>& client,
@@ -226,7 +226,7 @@
const sp<IRemoteDisplayClient>& client, const String8& iface);
virtual status_t dump(int fd, const Vector<String16>& args);
- void removeClient(wp<Client> client);
+ void removeClient(const wp<Client>& client);
bool hasClient(wp<Client> client);
enum {
diff --git a/media/libmediaplayerservice/MediaRecorderClient.h b/media/libmediaplayerservice/MediaRecorderClient.h
index eceb653..b2d0f0e 100644
--- a/media/libmediaplayerservice/MediaRecorderClient.h
+++ b/media/libmediaplayerservice/MediaRecorderClient.h
@@ -22,7 +22,7 @@
namespace android {
-class MediaRecorderBase;
+struct MediaRecorderBase;
class MediaPlayerService;
class ICameraRecordingProxy;
class IGraphicBufferProducer;
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp
index bd1fd7c..cdb0a7b 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.cpp
+++ b/media/libmediaplayerservice/StagefrightRecorder.cpp
@@ -1493,7 +1493,7 @@
}
status_t StagefrightRecorder::setupVideoEncoder(
- sp<MediaSource> cameraSource,
+ const sp<MediaSource> &cameraSource,
sp<MediaCodecSource> *source) {
source->clear();
diff --git a/media/libmediaplayerservice/StagefrightRecorder.h b/media/libmediaplayerservice/StagefrightRecorder.h
index d7f43bc..4dbd039 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.h
+++ b/media/libmediaplayerservice/StagefrightRecorder.h
@@ -44,7 +44,7 @@
struct ALooper;
struct StagefrightRecorder : public MediaRecorderBase {
- StagefrightRecorder(const String16 &opPackageName);
+ explicit StagefrightRecorder(const String16 &opPackageName);
virtual ~StagefrightRecorder();
virtual status_t init();
@@ -59,9 +59,9 @@
virtual status_t setPreviewSurface(const sp<IGraphicBufferProducer>& surface);
virtual status_t setInputSurface(const sp<IGraphicBufferConsumer>& surface);
virtual status_t setOutputFile(int fd, int64_t offset, int64_t length);
- virtual status_t setParameters(const String8& params);
- virtual status_t setListener(const sp<IMediaRecorderClient>& listener);
- virtual status_t setClientName(const String16& clientName);
+ virtual status_t setParameters(const String8 ¶ms);
+ virtual status_t setListener(const sp<IMediaRecorderClient> &listener);
+ virtual status_t setClientName(const String16 &clientName);
virtual status_t prepare();
virtual status_t start();
virtual status_t pause();
@@ -70,7 +70,7 @@
virtual status_t close();
virtual status_t reset();
virtual status_t getMaxAmplitude(int *max);
- virtual status_t dump(int fd, const Vector<String16>& args) const;
+ virtual status_t dump(int fd, const Vector<String16> &args) const;
// Querying a SurfaceMediaSourcer
virtual sp<IGraphicBufferProducer> querySurfaceMediaSource() const;
@@ -158,7 +158,7 @@
status_t setupMediaSource(sp<MediaSource> *mediaSource);
status_t setupCameraSource(sp<CameraSource> *cameraSource);
status_t setupAudioEncoder(const sp<MediaWriter>& writer);
- status_t setupVideoEncoder(sp<MediaSource> cameraSource, sp<MediaCodecSource> *source);
+ status_t setupVideoEncoder(const sp<MediaSource>& cameraSource, sp<MediaCodecSource> *source);
// Encoding parameter handling utilities
status_t setParameter(const String8 &key, const String8 &value);
diff --git a/media/libmediaplayerservice/nuplayer/Android.mk b/media/libmediaplayerservice/nuplayer/Android.mk
index cd20837..3ea2159 100644
--- a/media/libmediaplayerservice/nuplayer/Android.mk
+++ b/media/libmediaplayerservice/nuplayer/Android.mk
@@ -34,6 +34,8 @@
LOCAL_CLANG := true
+LOCAL_SHARED_LIBRARIES := libmedia
+
LOCAL_MODULE:= libstagefright_nuplayer
LOCAL_MODULE_TAGS := eng
diff --git a/media/libmediaplayerservice/nuplayer/GenericSource.cpp b/media/libmediaplayerservice/nuplayer/GenericSource.cpp
index af2d0f3..57a7286 100644
--- a/media/libmediaplayerservice/nuplayer/GenericSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/GenericSource.cpp
@@ -691,6 +691,12 @@
break;
}
+ case kWhatGetTrackInfo:
+ {
+ onGetTrackInfo(msg);
+ break;
+ }
+
case kWhatSelectTrack:
{
onSelectTrack(msg);
@@ -741,8 +747,8 @@
uint32_t sendWhat,
media_track_type type,
int32_t curGen,
- sp<AnotherPacketSource> packets,
- sp<AMessage> msg) {
+ const sp<AnotherPacketSource>& packets,
+ const sp<AMessage>& msg) {
int32_t msgGeneration;
CHECK(msg->findInt32("generation", &msgGeneration));
if (msgGeneration != curGen) {
@@ -775,8 +781,8 @@
uint32_t what,
media_track_type type,
int32_t curGen,
- sp<AnotherPacketSource> packets,
- sp<AMessage> msg) {
+ const sp<AnotherPacketSource>& packets,
+ const sp<AMessage>& msg) {
int32_t msgGeneration;
CHECK(msg->findInt32("generation", &msgGeneration));
if (msgGeneration != curGen) {
@@ -851,7 +857,7 @@
}
}
-void NuPlayer::GenericSource::onGetFormatMeta(sp<AMessage> msg) const {
+void NuPlayer::GenericSource::onGetFormatMeta(const sp<AMessage>& msg) const {
int32_t audio;
CHECK(msg->findInt32("audio", &audio));
@@ -960,6 +966,34 @@
}
sp<AMessage> NuPlayer::GenericSource::getTrackInfo(size_t trackIndex) const {
+ sp<AMessage> msg = new AMessage(kWhatGetTrackInfo, this);
+ msg->setSize("trackIndex", trackIndex);
+
+ sp<AMessage> response;
+ sp<RefBase> format;
+ status_t err = msg->postAndAwaitResponse(&response);
+ if (err == OK && response != NULL) {
+ CHECK(response->findObject("format", &format));
+ return static_cast<AMessage*>(format.get());
+ } else {
+ return NULL;
+ }
+}
+
+void NuPlayer::GenericSource::onGetTrackInfo(const sp<AMessage>& msg) const {
+ size_t trackIndex;
+ CHECK(msg->findSize("trackIndex", &trackIndex));
+
+ sp<AMessage> response = new AMessage;
+ sp<AMessage> format = doGetTrackInfo(trackIndex);
+ response->setObject("format", format);
+
+ sp<AReplyToken> replyID;
+ CHECK(msg->senderAwaitsResponse(&replyID));
+ response->postReply(replyID);
+}
+
+sp<AMessage> NuPlayer::GenericSource::doGetTrackInfo(size_t trackIndex) const {
size_t trackCount = mSources.size();
if (trackIndex >= trackCount) {
return NULL;
@@ -1023,7 +1057,7 @@
}
}
-void NuPlayer::GenericSource::onGetSelectedTrack(sp<AMessage> msg) const {
+void NuPlayer::GenericSource::onGetSelectedTrack(const sp<AMessage>& msg) const {
int32_t tmpType;
CHECK(msg->findInt32("type", &tmpType));
media_track_type type = (media_track_type)tmpType;
@@ -1079,7 +1113,7 @@
return err;
}
-void NuPlayer::GenericSource::onSelectTrack(sp<AMessage> msg) {
+void NuPlayer::GenericSource::onSelectTrack(const sp<AMessage>& msg) {
int32_t trackIndex, select;
int64_t timeUs;
CHECK(msg->findInt32("trackIndex", &trackIndex));
@@ -1199,7 +1233,7 @@
return err;
}
-void NuPlayer::GenericSource::onSeek(sp<AMessage> msg) {
+void NuPlayer::GenericSource::onSeek(const sp<AMessage>& msg) {
int64_t seekTimeUs;
CHECK(msg->findInt64("seekTimeUs", &seekTimeUs));
@@ -1358,7 +1392,7 @@
}
}
-void NuPlayer::GenericSource::onReadBuffer(sp<AMessage> msg) {
+void NuPlayer::GenericSource::onReadBuffer(const sp<AMessage>& msg) {
int32_t tmpType;
CHECK(msg->findInt32("trackType", &tmpType));
media_track_type trackType = (media_track_type)tmpType;
diff --git a/media/libmediaplayerservice/nuplayer/GenericSource.h b/media/libmediaplayerservice/nuplayer/GenericSource.h
index 2fd703e..e92a2ae 100644
--- a/media/libmediaplayerservice/nuplayer/GenericSource.h
+++ b/media/libmediaplayerservice/nuplayer/GenericSource.h
@@ -117,7 +117,7 @@
// When necessary, it will send out buffering events to the player.
struct BufferingMonitor : public AHandler {
public:
- BufferingMonitor(const sp<AMessage> ¬ify);
+ explicit BufferingMonitor(const sp<AMessage> ¬ify);
// Set up state.
void prepare(const sp<NuCachedSource2> &cachedSource,
@@ -248,23 +248,26 @@
void finishPrepareAsync();
status_t startSources();
- void onGetFormatMeta(sp<AMessage> msg) const;
+ void onGetFormatMeta(const sp<AMessage>& msg) const;
sp<MetaData> doGetFormatMeta(bool audio) const;
- void onGetSelectedTrack(sp<AMessage> msg) const;
+ void onGetTrackInfo(const sp<AMessage>& msg) const;
+ sp<AMessage> doGetTrackInfo(size_t trackIndex) const;
+
+ void onGetSelectedTrack(const sp<AMessage>& msg) const;
ssize_t doGetSelectedTrack(media_track_type type) const;
- void onSelectTrack(sp<AMessage> msg);
+ void onSelectTrack(const sp<AMessage>& msg);
status_t doSelectTrack(size_t trackIndex, bool select, int64_t timeUs);
- void onSeek(sp<AMessage> msg);
+ void onSeek(const sp<AMessage>& msg);
status_t doSeek(int64_t seekTimeUs);
void onPrepareAsync();
void fetchTextData(
uint32_t what, media_track_type type,
- int32_t curGen, sp<AnotherPacketSource> packets, sp<AMessage> msg);
+ int32_t curGen, const sp<AnotherPacketSource>& packets, const sp<AMessage>& msg);
void sendGlobalTextData(
uint32_t what,
@@ -272,7 +275,7 @@
void sendTextData(
uint32_t what, media_track_type type,
- int32_t curGen, sp<AnotherPacketSource> packets, sp<AMessage> msg);
+ int32_t curGen, const sp<AnotherPacketSource>& packets, const sp<AMessage>& msg);
sp<ABuffer> mediaBufferToABuffer(
MediaBuffer *mbuf,
@@ -281,7 +284,7 @@
int64_t *actualTimeUs = NULL);
void postReadBuffer(media_track_type trackType);
- void onReadBuffer(sp<AMessage> msg);
+ void onReadBuffer(const sp<AMessage>& msg);
void readBuffer(
media_track_type trackType,
int64_t seekTimeUs = -1ll, int64_t *actualTimeUs = NULL, bool formatChange = false);
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index dc4e5d4..4e16fba 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -69,7 +69,7 @@
};
struct NuPlayer::SeekAction : public Action {
- SeekAction(int64_t seekTimeUs)
+ explicit SeekAction(int64_t seekTimeUs)
: mSeekTimeUs(seekTimeUs) {
}
@@ -84,7 +84,7 @@
};
struct NuPlayer::ResumeDecoderAction : public Action {
- ResumeDecoderAction(bool needNotify)
+ explicit ResumeDecoderAction(bool needNotify)
: mNeedNotify(needNotify) {
}
@@ -99,7 +99,7 @@
};
struct NuPlayer::SetSurfaceAction : public Action {
- SetSurfaceAction(const sp<Surface> &surface)
+ explicit SetSurfaceAction(const sp<Surface> &surface)
: mSurface(surface) {
}
@@ -131,7 +131,7 @@
};
struct NuPlayer::PostMessageAction : public Action {
- PostMessageAction(const sp<AMessage> &msg)
+ explicit PostMessageAction(const sp<AMessage> &msg)
: mMessage(msg) {
}
@@ -150,7 +150,7 @@
struct NuPlayer::SimpleAction : public Action {
typedef void (NuPlayer::*ActionFunc)();
- SimpleAction(ActionFunc func)
+ explicit SimpleAction(ActionFunc func)
: mFunc(func) {
}
@@ -428,7 +428,7 @@
void NuPlayer::writeTrackInfo(
- Parcel* reply, const sp<AMessage> format) const {
+ Parcel* reply, const sp<AMessage>& format) const {
if (format == NULL) {
ALOGE("NULL format");
return;
@@ -1802,8 +1802,10 @@
// Make sure we don't continue to scan sources until we finish flushing.
++mScanSourcesGeneration;
if (mScanSourcesPending) {
- mDeferredActions.push_back(
- new SimpleAction(&NuPlayer::performScanSources));
+ if (!needShutdown) {
+ mDeferredActions.push_back(
+ new SimpleAction(&NuPlayer::performScanSources));
+ }
mScanSourcesPending = false;
}
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.h b/media/libmediaplayerservice/nuplayer/NuPlayer.h
index ae17c76..a002f6f 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.h
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.h
@@ -33,7 +33,7 @@
struct NuPlayerDriver;
struct NuPlayer : public AHandler {
- NuPlayer(pid_t pid);
+ explicit NuPlayer(pid_t pid);
void setUID(uid_t uid);
@@ -280,7 +280,7 @@
void sendTimedMetaData(const sp<ABuffer> &buffer);
void sendTimedTextData(const sp<ABuffer> &buffer);
- void writeTrackInfo(Parcel* reply, const sp<AMessage> format) const;
+ void writeTrackInfo(Parcel* reply, const sp<AMessage>& format) const;
DISALLOW_EVIL_CONSTRUCTORS(NuPlayer);
};
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerCCDecoder.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerCCDecoder.cpp
index 13716cf..978d360 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerCCDecoder.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerCCDecoder.cpp
@@ -256,6 +256,12 @@
payload_size += last_byte;
} while (last_byte == 0xFF);
+ if (payload_size > SIZE_MAX / 8
+ || !br.atLeastNumBitsLeft(payload_size * 8)) {
+ ALOGV("Malformed SEI payload");
+ break;
+ }
+
// sei_payload()
if (payload_type == 4) {
bool isCC = false;
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerCCDecoder.h b/media/libmediaplayerservice/nuplayer/NuPlayerCCDecoder.h
index a297334..f310f37 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerCCDecoder.h
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerCCDecoder.h
@@ -33,7 +33,7 @@
kTrackTypeCEA708,
};
- CCDecoder(const sp<AMessage> ¬ify);
+ explicit CCDecoder(const sp<AMessage> ¬ify);
size_t getTrackCount() const;
sp<AMessage> getTrackInfo(size_t index) const;
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDecoderBase.h b/media/libmediaplayerservice/nuplayer/NuPlayerDecoderBase.h
index a334ec5..9966144 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerDecoderBase.h
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerDecoderBase.h
@@ -30,7 +30,7 @@
class Surface;
struct NuPlayer::DecoderBase : public AHandler {
- DecoderBase(const sp<AMessage> ¬ify);
+ explicit DecoderBase(const sp<AMessage> ¬ify);
void configure(const sp<AMessage> &format);
void init();
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.h b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.h
index 26d3a60..58008f0 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.h
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.h
@@ -24,7 +24,7 @@
struct NuPlayer;
struct NuPlayerDriver : public MediaPlayerInterface {
- NuPlayerDriver(pid_t pid);
+ explicit NuPlayerDriver(pid_t pid);
virtual status_t initCheck();
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerSource.h b/media/libmediaplayerservice/nuplayer/NuPlayerSource.h
index 0176eafa..3a96138 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerSource.h
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerSource.h
@@ -59,7 +59,7 @@
// The provides message is used to notify the player about various
// events.
- Source(const sp<AMessage> ¬ify)
+ explicit Source(const sp<AMessage> ¬ify)
: mNotify(notify) {
}
diff --git a/media/libmediaplayerservice/nuplayer/StreamingSource.cpp b/media/libmediaplayerservice/nuplayer/StreamingSource.cpp
index a7c5cf4..7f9f913 100644
--- a/media/libmediaplayerservice/nuplayer/StreamingSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/StreamingSource.cpp
@@ -228,6 +228,10 @@
}
sp<MetaData> meta = source->getFormat();
+ if (meta == NULL) {
+ format->setInt32("err", -EWOULDBLOCK);
+ return format;
+ }
status_t err = convertMetaDataToMessage(meta, &format);
if (err != OK) { // format may have been cleared on error
format = new AMessage;
diff --git a/media/libnbaio/Android.bp b/media/libnbaio/Android.bp
new file mode 100644
index 0000000..615b541
--- /dev/null
+++ b/media/libnbaio/Android.bp
@@ -0,0 +1,36 @@
+cc_library_shared {
+ name: "libnbaio",
+ srcs: [
+ "AudioBufferProviderSource.cpp",
+ "AudioStreamOutSink.cpp",
+ "AudioStreamInSource.cpp",
+ "NBAIO.cpp",
+ "MonoPipe.cpp",
+ "MonoPipeReader.cpp",
+ "Pipe.cpp",
+ "PipeReader.cpp",
+ "SourceAudioBufferProvider.cpp",
+
+ "NBLog.cpp",
+ ],
+
+ // libsndfile license is incompatible; uncomment to use for local debug only
+ // srcs: [
+ // "LibsndfileSink.cpp",
+ // "LibsndfileSource.cpp",
+ // ],
+ // static_libs: ["libsndfile"],
+
+ shared_libs: [
+ "libaudioutils",
+ "libbinder",
+ "libcutils",
+ "libutils",
+ "liblog",
+ ],
+
+ cflags: [
+ "-Werror",
+ "-Wall",
+ ],
+}
diff --git a/media/libnbaio/Android.mk b/media/libnbaio/Android.mk
deleted file mode 100644
index e2f416b..0000000
--- a/media/libnbaio/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- AudioBufferProviderSource.cpp \
- AudioStreamOutSink.cpp \
- AudioStreamInSource.cpp \
- NBAIO.cpp \
- MonoPipe.cpp \
- MonoPipeReader.cpp \
- Pipe.cpp \
- PipeReader.cpp \
- SourceAudioBufferProvider.cpp
-
-LOCAL_SRC_FILES += NBLog.cpp
-
-# libsndfile license is incompatible; uncomment to use for local debug only
-#LOCAL_SRC_FILES += LibsndfileSink.cpp LibsndfileSource.cpp
-#LOCAL_C_INCLUDES += path/to/libsndfile/src
-#LOCAL_STATIC_LIBRARIES += libsndfile
-
-LOCAL_MODULE := libnbaio
-
-LOCAL_SHARED_LIBRARIES := \
- libaudioutils \
- libbinder \
- libcutils \
- libutils \
- liblog
-
-LOCAL_C_INCLUDES := $(call include-path-for, audio-utils)
-
-LOCAL_CFLAGS := -Werror -Wall
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 37fd5a5..e7057ce 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -216,7 +216,7 @@
////////////////////////////////////////////////////////////////////////////////
struct ACodec::BaseState : public AState {
- BaseState(ACodec *codec, const sp<AState> &parentState = NULL);
+ explicit BaseState(ACodec *codec, const sp<AState> &parentState = NULL);
protected:
enum PortMode {
@@ -267,7 +267,7 @@
////////////////////////////////////////////////////////////////////////////////
struct ACodec::DeathNotifier : public IBinder::DeathRecipient {
- DeathNotifier(const sp<AMessage> ¬ify)
+ explicit DeathNotifier(const sp<AMessage> ¬ify)
: mNotify(notify) {
}
@@ -285,7 +285,7 @@
};
struct ACodec::UninitializedState : public ACodec::BaseState {
- UninitializedState(ACodec *codec);
+ explicit UninitializedState(ACodec *codec);
protected:
virtual bool onMessageReceived(const sp<AMessage> &msg);
@@ -303,7 +303,7 @@
////////////////////////////////////////////////////////////////////////////////
struct ACodec::LoadedState : public ACodec::BaseState {
- LoadedState(ACodec *codec);
+ explicit LoadedState(ACodec *codec);
protected:
virtual bool onMessageReceived(const sp<AMessage> &msg);
@@ -326,7 +326,7 @@
////////////////////////////////////////////////////////////////////////////////
struct ACodec::LoadedToIdleState : public ACodec::BaseState {
- LoadedToIdleState(ACodec *codec);
+ explicit LoadedToIdleState(ACodec *codec);
protected:
virtual bool onMessageReceived(const sp<AMessage> &msg);
@@ -342,7 +342,7 @@
////////////////////////////////////////////////////////////////////////////////
struct ACodec::IdleToExecutingState : public ACodec::BaseState {
- IdleToExecutingState(ACodec *codec);
+ explicit IdleToExecutingState(ACodec *codec);
protected:
virtual bool onMessageReceived(const sp<AMessage> &msg);
@@ -356,7 +356,7 @@
////////////////////////////////////////////////////////////////////////////////
struct ACodec::ExecutingState : public ACodec::BaseState {
- ExecutingState(ACodec *codec);
+ explicit ExecutingState(ACodec *codec);
void submitRegularOutputBuffers();
void submitOutputMetaBuffers();
@@ -386,7 +386,7 @@
////////////////////////////////////////////////////////////////////////////////
struct ACodec::OutputPortSettingsChangedState : public ACodec::BaseState {
- OutputPortSettingsChangedState(ACodec *codec);
+ explicit OutputPortSettingsChangedState(ACodec *codec);
protected:
virtual PortMode getPortMode(OMX_U32 portIndex);
@@ -403,7 +403,7 @@
////////////////////////////////////////////////////////////////////////////////
struct ACodec::ExecutingToIdleState : public ACodec::BaseState {
- ExecutingToIdleState(ACodec *codec);
+ explicit ExecutingToIdleState(ACodec *codec);
protected:
virtual bool onMessageReceived(const sp<AMessage> &msg);
@@ -425,7 +425,7 @@
////////////////////////////////////////////////////////////////////////////////
struct ACodec::IdleToLoadedState : public ACodec::BaseState {
- IdleToLoadedState(ACodec *codec);
+ explicit IdleToLoadedState(ACodec *codec);
protected:
virtual bool onMessageReceived(const sp<AMessage> &msg);
@@ -440,7 +440,7 @@
////////////////////////////////////////////////////////////////////////////////
struct ACodec::FlushingState : public ACodec::BaseState {
- FlushingState(ACodec *codec);
+ explicit FlushingState(ACodec *codec);
protected:
virtual bool onMessageReceived(const sp<AMessage> &msg);
@@ -494,7 +494,8 @@
////////////////////////////////////////////////////////////////////////////////
ACodec::ACodec()
- : mQuirks(0),
+ : mSampleRate(0),
+ mQuirks(0),
mNode(0),
mUsingNativeWindow(false),
mNativeWindowUsageBits(0),
@@ -2782,6 +2783,7 @@
} else {
ALOGW("did not set AudioAndroidAacPresentation due to error %d when setting AudioAac", res);
}
+ mSampleRate = sampleRate;
return res;
}
@@ -5473,8 +5475,14 @@
CHECK(mOutputFormat->findString("mime", &mime));
if (mime == MEDIA_MIMETYPE_AUDIO_RAW && (mEncoderDelay || mEncoderPadding)) {
- int32_t channelCount;
+ int32_t channelCount, sampleRate;
CHECK(mOutputFormat->findInt32("channel-count", &channelCount));
+ CHECK(mOutputFormat->findInt32("sample-rate", &sampleRate));
+ if (mSampleRate != 0 && sampleRate != 0) {
+ mEncoderDelay = mEncoderDelay * sampleRate / mSampleRate;
+ mEncoderPadding = mEncoderPadding * sampleRate / mSampleRate;
+ mSampleRate = sampleRate;
+ }
if (mSkipCutBuffer != NULL) {
size_t prevbufsize = mSkipCutBuffer->size();
if (prevbufsize != 0) {
diff --git a/media/libstagefright/Android.bp b/media/libstagefright/Android.bp
new file mode 100644
index 0000000..3d9341b
--- /dev/null
+++ b/media/libstagefright/Android.bp
@@ -0,0 +1 @@
+subdirs = ["foundation"]
diff --git a/media/libstagefright/Android.mk b/media/libstagefright/Android.mk
index 3848502..604ad7c 100644
--- a/media/libstagefright/Android.mk
+++ b/media/libstagefright/Android.mk
@@ -72,6 +72,8 @@
$(TOP)/external/flac/include \
$(TOP)/external/tremolo \
$(TOP)/external/libvpx/libwebm \
+ $(TOP)/external/icu/icu4c/source/common \
+ $(TOP)/external/icu/icu4c/source/i18n \
$(TOP)/system/netd/include \
$(call include-path-for, audio-utils)
@@ -84,23 +86,16 @@
libdrmframework \
libexpat \
libgui \
- libicui18n \
- libicuuc \
liblog \
libmedia \
+ libaudioclient \
libmediautils \
libnetd_client \
- libopus \
libsonivox \
- libssl \
libstagefright_omx \
- libstagefright_yuv \
- libsync \
libui \
libutils \
libvorbisidec \
- libz \
- libpowermanager
LOCAL_STATIC_LIBRARIES := \
libstagefright_color_conversion \
@@ -118,12 +113,12 @@
libmedia_helper \
LOCAL_SHARED_LIBRARIES += \
- libstagefright_enc_common \
- libstagefright_avc_common \
libstagefright_foundation \
libdl \
libRScpp \
+LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libmedia
+
LOCAL_CFLAGS += -Wno-multichar -Werror -Wno-error=deprecated-declarations -Wall
# enable experiments only in userdebug and eng builds
diff --git a/media/libstagefright/CallbackDataSource.cpp b/media/libstagefright/CallbackDataSource.cpp
index 0df7da4..0434bab 100644
--- a/media/libstagefright/CallbackDataSource.cpp
+++ b/media/libstagefright/CallbackDataSource.cpp
@@ -51,7 +51,7 @@
}
ssize_t CallbackDataSource::readAt(off64_t offset, void* data, size_t size) {
- if (mMemory == NULL) {
+ if (mMemory == NULL || data == NULL) {
return -1;
}
diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp
index 893da89..408ad7a 100644
--- a/media/libstagefright/CameraSource.cpp
+++ b/media/libstagefright/CameraSource.cpp
@@ -47,7 +47,7 @@
static const int64_t CAMERA_SOURCE_TIMEOUT_NS = 3000000000LL;
struct CameraSourceListener : public CameraListener {
- CameraSourceListener(const sp<CameraSource> &source);
+ explicit CameraSourceListener(const sp<CameraSource> &source);
virtual void notify(int32_t msgType, int32_t ext1, int32_t ext2);
virtual void postData(int32_t msgType, const sp<IMemory> &dataPtr,
diff --git a/media/libstagefright/DataURISource.cpp b/media/libstagefright/DataURISource.cpp
index 2a61c3a..3dc345f 100644
--- a/media/libstagefright/DataURISource.cpp
+++ b/media/libstagefright/DataURISource.cpp
@@ -28,7 +28,7 @@
return NULL;
}
- char *commaPos = strrchr(uri, ',');
+ const char *commaPos = strrchr(uri, ',');
if (commaPos == NULL) {
return NULL;
diff --git a/media/libstagefright/FLACExtractor.cpp b/media/libstagefright/FLACExtractor.cpp
index 13b66f3..1b88e5d 100644
--- a/media/libstagefright/FLACExtractor.cpp
+++ b/media/libstagefright/FLACExtractor.cpp
@@ -73,7 +73,11 @@
class FLACParser : public RefBase {
public:
- FLACParser(
+ enum {
+ kMaxChannels = 8,
+ };
+
+ explicit FLACParser(
const sp<DataSource> &dataSource,
// If metadata pointers aren't provided, we don't fill them
const sp<MetaData> &fileMetadata = 0,
@@ -122,7 +126,7 @@
// media buffers
size_t mMaxBufferSize;
MediaBufferGroup *mGroup;
- void (*mCopy)(short *dst, const int *const *src, unsigned nSamples, unsigned nChannels);
+ void (*mCopy)(short *dst, const int * src[kMaxChannels], unsigned nSamples, unsigned nChannels);
// handle to underlying libFLAC parser
FLAC__StreamDecoder *mDecoder;
@@ -139,7 +143,7 @@
bool mWriteRequested;
bool mWriteCompleted;
FLAC__FrameHeader mWriteHeader;
- const FLAC__int32 * const *mWriteBuffer;
+ FLAC__int32 const * mWriteBuffer[kMaxChannels];
// most recent error reported by libFLAC parser
FLAC__StreamDecoderErrorStatus mErrorStatus;
@@ -323,7 +327,7 @@
mWriteRequested = false;
// FLAC parser doesn't free or realloc buffer until next frame or finish
mWriteHeader = frame->header;
- mWriteBuffer = buffer;
+ memmove(mWriteBuffer, buffer, sizeof(const FLAC__int32 * const) * getChannels());
mWriteCompleted = true;
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
} else {
@@ -382,7 +386,7 @@
static void copyMono8(
short *dst,
- const int *const *src,
+ const int * src[FLACParser::kMaxChannels],
unsigned nSamples,
unsigned /* nChannels */) {
for (unsigned i = 0; i < nSamples; ++i) {
@@ -392,7 +396,7 @@
static void copyStereo8(
short *dst,
- const int *const *src,
+ const int * src[FLACParser::kMaxChannels],
unsigned nSamples,
unsigned /* nChannels */) {
for (unsigned i = 0; i < nSamples; ++i) {
@@ -401,7 +405,7 @@
}
}
-static void copyMultiCh8(short *dst, const int *const *src, unsigned nSamples, unsigned nChannels)
+static void copyMultiCh8(short *dst, const int * src[FLACParser::kMaxChannels], unsigned nSamples, unsigned nChannels)
{
for (unsigned i = 0; i < nSamples; ++i) {
for (unsigned c = 0; c < nChannels; ++c) {
@@ -412,7 +416,7 @@
static void copyMono16(
short *dst,
- const int *const *src,
+ const int * src[FLACParser::kMaxChannels],
unsigned nSamples,
unsigned /* nChannels */) {
for (unsigned i = 0; i < nSamples; ++i) {
@@ -422,7 +426,7 @@
static void copyStereo16(
short *dst,
- const int *const *src,
+ const int * src[FLACParser::kMaxChannels],
unsigned nSamples,
unsigned /* nChannels */) {
for (unsigned i = 0; i < nSamples; ++i) {
@@ -431,7 +435,7 @@
}
}
-static void copyMultiCh16(short *dst, const int *const *src, unsigned nSamples, unsigned nChannels)
+static void copyMultiCh16(short *dst, const int * src[FLACParser::kMaxChannels], unsigned nSamples, unsigned nChannels)
{
for (unsigned i = 0; i < nSamples; ++i) {
for (unsigned c = 0; c < nChannels; ++c) {
@@ -444,7 +448,7 @@
static void copyMono24(
short *dst,
- const int *const *src,
+ const int * src[FLACParser::kMaxChannels],
unsigned nSamples,
unsigned /* nChannels */) {
for (unsigned i = 0; i < nSamples; ++i) {
@@ -454,7 +458,7 @@
static void copyStereo24(
short *dst,
- const int *const *src,
+ const int * src[FLACParser::kMaxChannels],
unsigned nSamples,
unsigned /* nChannels */) {
for (unsigned i = 0; i < nSamples; ++i) {
@@ -463,7 +467,7 @@
}
}
-static void copyMultiCh24(short *dst, const int *const *src, unsigned nSamples, unsigned nChannels)
+static void copyMultiCh24(short *dst, const int * src[FLACParser::kMaxChannels], unsigned nSamples, unsigned nChannels)
{
for (unsigned i = 0; i < nSamples; ++i) {
for (unsigned c = 0; c < nChannels; ++c) {
@@ -474,7 +478,7 @@
static void copyTrespass(
short * /* dst */,
- const int *const * /* src */,
+ const int *[FLACParser::kMaxChannels] /* src */,
unsigned /* nSamples */,
unsigned /* nChannels */) {
TRESPASS();
@@ -499,7 +503,6 @@
mStreamInfoValid(false),
mWriteRequested(false),
mWriteCompleted(false),
- mWriteBuffer(NULL),
mErrorStatus((FLAC__StreamDecoderErrorStatus) -1)
{
ALOGV("FLACParser::FLACParser");
@@ -555,7 +558,7 @@
}
if (mStreamInfoValid) {
// check channel count
- if (getChannels() == 0 || getChannels() > 8) {
+ if (getChannels() == 0 || getChannels() > kMaxChannels) {
ALOGE("unsupported channel count %u", getChannels());
return NO_INIT;
}
@@ -591,7 +594,7 @@
static const struct {
unsigned mChannels;
unsigned mBitsPerSample;
- void (*mCopy)(short *dst, const int *const *src, unsigned nSamples, unsigned nChannels);
+ void (*mCopy)(short *dst, const int * src[kMaxChannels], unsigned nSamples, unsigned nChannels);
} table[] = {
{ 1, 8, copyMono8 },
{ 2, 8, copyStereo8 },
diff --git a/media/libstagefright/MPEG2TSWriter.cpp b/media/libstagefright/MPEG2TSWriter.cpp
index a9e8846..931b280 100644
--- a/media/libstagefright/MPEG2TSWriter.cpp
+++ b/media/libstagefright/MPEG2TSWriter.cpp
@@ -35,7 +35,7 @@
namespace android {
struct MPEG2TSWriter::SourceInfo : public AHandler {
- SourceInfo(const sp<IMediaSource> &source);
+ explicit SourceInfo(const sp<IMediaSource> &source);
void start(const sp<AMessage> ¬ify);
void stop();
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp
index f42fbcf..9392e7d 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -184,7 +184,7 @@
// Each MPEG4DataSource caches the sampletable metadata for a single track.
struct MPEG4DataSource : public DataSource {
- MPEG4DataSource(const sp<DataSource> &source);
+ explicit MPEG4DataSource(const sp<DataSource> &source);
virtual status_t initCheck() const;
virtual ssize_t readAt(off64_t offset, void *data, size_t size);
@@ -602,7 +602,7 @@
// Reads an encoded integer 7 bits at a time until it encounters the high bit clear.
static int32_t readSize(off64_t offset,
- const sp<DataSource> DataSource, uint8_t *numOfBytes) {
+ const sp<DataSource> &DataSource, uint8_t *numOfBytes) {
uint32_t size = 0;
uint8_t data;
bool moreData = true;
@@ -1018,7 +1018,9 @@
while (cur && cur->next != mLastTrack) {
cur = cur->next;
}
- cur->next = NULL;
+ if (cur) {
+ cur->next = NULL;
+ }
delete mLastTrack;
mLastTrack = cur;
}
@@ -3887,7 +3889,12 @@
return OK;
}
if (smplcnt > mCurrentSampleInfoAllocSize) {
- mCurrentSampleInfoSizes = (uint8_t*) realloc(mCurrentSampleInfoSizes, smplcnt);
+ uint8_t * newPtr = (uint8_t*) realloc(mCurrentSampleInfoSizes, smplcnt);
+ if (newPtr == NULL) {
+ ALOGE("failed to realloc %u -> %u", mCurrentSampleInfoAllocSize, smplcnt);
+ return NO_MEMORY;
+ }
+ mCurrentSampleInfoSizes = newPtr;
mCurrentSampleInfoAllocSize = smplcnt;
}
@@ -3926,6 +3933,7 @@
if (entrycount > mCurrentSampleInfoOffsetsAllocSize) {
uint64_t *newPtr = (uint64_t *)realloc(mCurrentSampleInfoOffsets, entrycount * 8);
if (newPtr == NULL) {
+ ALOGE("failed to realloc %u -> %u", mCurrentSampleInfoOffsetsAllocSize, entrycount * 8);
return NO_MEMORY;
}
mCurrentSampleInfoOffsets = newPtr;
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp
old mode 100644
new mode 100755
index 5e96c2b..9de5c26
--- a/media/libstagefright/MPEG4Writer.cpp
+++ b/media/libstagefright/MPEG4Writer.cpp
@@ -643,7 +643,7 @@
if (mMaxFileDurationLimitUs != 0) {
if (bitRate > 0) {
int64_t size2 =
- ((mMaxFileDurationLimitUs * bitRate * 6) / 1000 / 8000000);
+ ((mMaxFileDurationLimitUs / 1000) * bitRate * 6) / 8000000;
if (mMaxFileSizeLimitBytes != 0 && mIsFileSizeLimitExplicitlyRequested) {
// When both file size and duration limits are set,
// we use the smaller limit of the two.
@@ -3085,7 +3085,7 @@
mOwner->writeInt16(primaries);
mOwner->writeInt16(transfer);
mOwner->writeInt16(coeffs);
- mOwner->writeInt8(fullRange ? 128 : 0);
+ mOwner->writeInt8(int8_t(fullRange ? 0x80 : 0x0));
mOwner->endBox(); // colr
}
}
@@ -3288,13 +3288,22 @@
void MPEG4Writer::Track::writeMdhdBox(uint32_t now) {
int64_t trakDurationUs = getDurationUs();
+ int64_t mdhdDuration = (trakDurationUs * mTimeScale + 5E5) / 1E6;
mOwner->beginBox("mdhd");
- mOwner->writeInt32(0); // version=0, flags=0
- mOwner->writeInt32(now); // creation time
- mOwner->writeInt32(now); // modification time
- mOwner->writeInt32(mTimeScale); // media timescale
- int32_t mdhdDuration = (trakDurationUs * mTimeScale + 5E5) / 1E6;
- mOwner->writeInt32(mdhdDuration); // use media timescale
+
+ if (mdhdDuration > UINT32_MAX) {
+ mOwner->writeInt32((1 << 24)); // version=1, flags=0
+ mOwner->writeInt64((int64_t)now); // creation time
+ mOwner->writeInt64((int64_t)now); // modification time
+ mOwner->writeInt32(mTimeScale); // media timescale
+ mOwner->writeInt64(mdhdDuration); // media timescale
+ } else {
+ mOwner->writeInt32(0); // version=0, flags=0
+ mOwner->writeInt32(now); // creation time
+ mOwner->writeInt32(now); // modification time
+ mOwner->writeInt32(mTimeScale); // media timescale
+ mOwner->writeInt32((int32_t)mdhdDuration); // use media timescale
+ }
// Language follows the three letter standard ISO-639-2/T
// 'e', 'n', 'g' for "English", for instance.
// Each character is packed as the difference between its ASCII value and 0x60.
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index e476424..b088775 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -53,7 +53,7 @@
namespace android {
-static int64_t getId(sp<IResourceManagerClient> client) {
+static int64_t getId(const sp<IResourceManagerClient> &client) {
return (int64_t) client.get();
}
@@ -65,7 +65,7 @@
static const int kMaxReclaimWaitTimeInUs = 500000; // 0.5s
struct ResourceManagerClient : public BnResourceManagerClient {
- ResourceManagerClient(MediaCodec* codec) : mMediaCodec(codec) {}
+ explicit ResourceManagerClient(MediaCodec* codec) : mMediaCodec(codec) {}
virtual bool reclaimResource() {
sp<MediaCodec> codec = mMediaCodec.promote();
@@ -142,7 +142,7 @@
void MediaCodec::ResourceManagerServiceProxy::addResource(
int64_t clientId,
- const sp<IResourceManagerClient> client,
+ const sp<IResourceManagerClient> &client,
const Vector<MediaResource> &resources) {
Mutex::Autolock _l(mLock);
if (mService == NULL) {
@@ -2569,7 +2569,7 @@
//static
size_t MediaCodec::CreateFramesRenderedMessage(
- std::list<FrameRenderTracker::Info> done, sp<AMessage> &msg) {
+ const std::list<FrameRenderTracker::Info> &done, sp<AMessage> &msg) {
size_t index = 0;
for (std::list<FrameRenderTracker::Info>::const_iterator it = done.cbegin();
diff --git a/media/libstagefright/MediaCodecList.cpp b/media/libstagefright/MediaCodecList.cpp
index 0fb5072..23d49f0 100644
--- a/media/libstagefright/MediaCodecList.cpp
+++ b/media/libstagefright/MediaCodecList.cpp
@@ -182,7 +182,7 @@
void MediaCodecList::parseTopLevelXMLFile(const char *codecs_xml, bool ignore_errors) {
// get href_base
- char *href_base_end = strrchr(codecs_xml, '/');
+ const char *href_base_end = strrchr(codecs_xml, '/');
if (href_base_end != NULL) {
mHrefBase = AString(codecs_xml, href_base_end - codecs_xml + 1);
}
@@ -888,18 +888,18 @@
return -ENOENT;
}
-static status_t limitFoundMissingAttr(AString name, const char *attr, bool found = true) {
+static status_t limitFoundMissingAttr(const AString &name, const char *attr, bool found = true) {
ALOGE("limit '%s' with %s'%s' attribute", name.c_str(),
(found ? "" : "no "), attr);
return -EINVAL;
}
-static status_t limitError(AString name, const char *msg) {
+static status_t limitError(const AString &name, const char *msg) {
ALOGE("limit '%s' %s", name.c_str(), msg);
return -EINVAL;
}
-static status_t limitInvalidAttr(AString name, const char *attr, AString value) {
+static status_t limitInvalidAttr(const AString &name, const char *attr, const AString &value) {
ALOGE("limit '%s' with invalid '%s' attribute (%s)", name.c_str(),
attr, value.c_str());
return -EINVAL;
@@ -1165,13 +1165,15 @@
CHECK(info != NULL);
AString componentName = info->getCodecName();
- if (!((flags & kHardwareCodecsOnly) && !isSoftwareCodec(componentName))) {
+ if ((flags & kHardwareCodecsOnly) && isSoftwareCodec(componentName)) {
+ ALOGV("skipping SW codec '%s'", componentName.c_str());
+ } else {
matches->push(componentName);
ALOGV("matching '%s'", componentName.c_str());
}
}
- if (flags & kPreferSoftwareCodecs) {
+ if (flags & kPreferSoftwareCodecs || property_get_bool("debug.stagefright.swcodec", false)) {
matches->sort(compareSoftwareCodecsFirst);
}
}
diff --git a/media/libstagefright/MediaCodecListOverrides.cpp b/media/libstagefright/MediaCodecListOverrides.cpp
index 4ec36b5..33795f3 100644
--- a/media/libstagefright/MediaCodecListOverrides.cpp
+++ b/media/libstagefright/MediaCodecListOverrides.cpp
@@ -49,7 +49,7 @@
static const int kMaxInstances = 32;
// TODO: move MediaCodecInfo to C++. Until then, some temp methods to parse out info.
-static bool getMeasureSize(sp<MediaCodecInfo::Capabilities> caps, int32_t *width, int32_t *height) {
+static bool getMeasureSize(const sp<MediaCodecInfo::Capabilities> &caps, int32_t *width, int32_t *height) {
AString sizeRange;
if (!caps->getDetails()->findString("size-range", &sizeRange)) {
return false;
@@ -72,7 +72,7 @@
return (*width > 0) && (*height > 0);
}
-static void getMeasureBitrate(sp<MediaCodecInfo::Capabilities> caps, int32_t *bitrate) {
+static void getMeasureBitrate(const sp<MediaCodecInfo::Capabilities> &caps, int32_t *bitrate) {
// Until have native MediaCodecInfo, we cannot get bitrates based on profile/levels.
// We use 200000 as default value for our measurement.
*bitrate = 200000;
@@ -90,7 +90,7 @@
}
static sp<AMessage> getMeasureFormat(
- bool isEncoder, AString mime, sp<MediaCodecInfo::Capabilities> caps) {
+ bool isEncoder, const AString &mime, const sp<MediaCodecInfo::Capabilities> &caps) {
sp<AMessage> format = new AMessage();
format->setString("mime", mime);
@@ -128,7 +128,7 @@
}
static size_t doProfileEncoderInputBuffers(
- AString name, AString mime, sp<MediaCodecInfo::Capabilities> caps) {
+ const AString &name, const AString &mime, const sp<MediaCodecInfo::Capabilities> &caps) {
ALOGV("doProfileEncoderInputBuffers: name %s, mime %s", name.c_str(), mime.c_str());
sp<AMessage> format = getMeasureFormat(true /* isEncoder */, mime, caps);
@@ -183,7 +183,7 @@
}
static size_t doProfileCodecs(
- bool isEncoder, AString name, AString mime, sp<MediaCodecInfo::Capabilities> caps) {
+ bool isEncoder, const AString &name, const AString &mime, const sp<MediaCodecInfo::Capabilities> &caps) {
sp<AMessage> format = getMeasureFormat(isEncoder, mime, caps);
if (format == NULL) {
return 0;
@@ -337,7 +337,7 @@
global_results->add(kPolicySupportsMultipleSecureCodecs, supportMultipleSecureCodecs);
}
-static AString globalResultsToXml(const CodecSettings& results) {
+static AString globalResultsToXml(const CodecSettings &results) {
AString ret;
for (size_t i = 0; i < results.size(); ++i) {
AString setting = AStringPrintf(
@@ -349,7 +349,7 @@
return ret;
}
-static AString codecResultsToXml(const KeyedVector<AString, CodecSettings>& results) {
+static AString codecResultsToXml(const KeyedVector<AString, CodecSettings> &results) {
AString ret;
for (size_t i = 0; i < results.size(); ++i) {
AString name;
@@ -362,7 +362,7 @@
name.c_str(),
mime.c_str());
ret.append(codec);
- CodecSettings settings = results.valueAt(i);
+ const CodecSettings &settings = results.valueAt(i);
for (size_t i = 0; i < settings.size(); ++i) {
// WARNING: we assume all the settings are "Limit". Currently we have only one type
// of setting in this case, which is "max-supported-instances".
@@ -379,9 +379,9 @@
void exportResultsToXML(
const char *fileName,
- const CodecSettings& global_results,
- const KeyedVector<AString, CodecSettings>& encoder_results,
- const KeyedVector<AString, CodecSettings>& decoder_results) {
+ const CodecSettings &global_results,
+ const KeyedVector<AString, CodecSettings> &encoder_results,
+ const KeyedVector<AString, CodecSettings> &decoder_results) {
if (global_results.size() == 0 && encoder_results.size() == 0 && decoder_results.size() == 0) {
return;
}
diff --git a/media/libstagefright/MediaCodecSource.cpp b/media/libstagefright/MediaCodecSource.cpp
index ea5ef06..35c07ca 100644
--- a/media/libstagefright/MediaCodecSource.cpp
+++ b/media/libstagefright/MediaCodecSource.cpp
@@ -47,7 +47,7 @@
const int kStopTimeoutUs = 300000; // allow 1 sec for shutting down encoder
struct MediaCodecSource::Puller : public AHandler {
- Puller(const sp<MediaSource> &source);
+ explicit Puller(const sp<MediaSource> &source);
void interruptSource();
status_t start(const sp<MetaData> &meta, const sp<AMessage> ¬ify);
diff --git a/media/libstagefright/NuCachedSource2.cpp b/media/libstagefright/NuCachedSource2.cpp
index 453db03..afd6ffb 100644
--- a/media/libstagefright/NuCachedSource2.cpp
+++ b/media/libstagefright/NuCachedSource2.cpp
@@ -31,7 +31,7 @@
namespace android {
struct PageCache {
- PageCache(size_t pageSize);
+ explicit PageCache(size_t pageSize);
~PageCache();
struct Page {
diff --git a/media/libstagefright/OggExtractor.cpp b/media/libstagefright/OggExtractor.cpp
index 37e8e9c..0343786 100644
--- a/media/libstagefright/OggExtractor.cpp
+++ b/media/libstagefright/OggExtractor.cpp
@@ -46,7 +46,7 @@
namespace android {
struct OggSource : public MediaSource {
- OggSource(const sp<OggExtractor> &extractor);
+ explicit OggSource(const sp<OggExtractor> &extractor);
virtual sp<MetaData> getFormat();
@@ -164,7 +164,7 @@
};
struct MyVorbisExtractor : public MyOggExtractor {
- MyVorbisExtractor(const sp<DataSource> &source)
+ explicit MyVorbisExtractor(const sp<DataSource> &source)
: MyOggExtractor(source,
MEDIA_MIMETYPE_AUDIO_VORBIS,
/* numHeaders */ 3,
@@ -192,7 +192,7 @@
static const int32_t kOpusSampleRate = 48000;
static const int64_t kOpusSeekPreRollUs = 80000; // 80 ms
- MyOpusExtractor(const sp<DataSource> &source)
+ explicit MyOpusExtractor(const sp<DataSource> &source)
: MyOggExtractor(source, MEDIA_MIMETYPE_AUDIO_OPUS, /*numHeaders*/ 2, kOpusSeekPreRollUs),
mChannelCount(0),
mCodecDelay(0),
diff --git a/media/libstagefright/SampleTable.cpp b/media/libstagefright/SampleTable.cpp
index ee5fdf0..5ce2b76 100644
--- a/media/libstagefright/SampleTable.cpp
+++ b/media/libstagefright/SampleTable.cpp
@@ -215,6 +215,11 @@
status_t SampleTable::setSampleToChunkParams(
off64_t data_offset, size_t data_size) {
if (mSampleToChunkOffset >= 0) {
+ // already set
+ return ERROR_MALFORMED;
+ }
+
+ if (data_offset < 0) {
return ERROR_MALFORMED;
}
diff --git a/media/libstagefright/SurfaceMediaSource.cpp b/media/libstagefright/SurfaceMediaSource.cpp
index 15ff569..4f1ef30 100644
--- a/media/libstagefright/SurfaceMediaSource.cpp
+++ b/media/libstagefright/SurfaceMediaSource.cpp
@@ -112,7 +112,7 @@
Mutex::Autolock lock(mMutex);
result.append(buffer);
- mConsumer->dump(result, "");
+ mConsumer->dumpState(result, "");
}
status_t SurfaceMediaSource::setFrameRate(int32_t fps)
diff --git a/media/libstagefright/Utils.cpp b/media/libstagefright/Utils.cpp
index 1c76ad7..36be7a0 100644
--- a/media/libstagefright/Utils.cpp
+++ b/media/libstagefright/Utils.cpp
@@ -1070,7 +1070,7 @@
return res != NULL && res < data + length - 4 ? res : &data[length];
}
-static size_t reassembleAVCC(const sp<ABuffer> &csd0, const sp<ABuffer> csd1, char *avcc) {
+static size_t reassembleAVCC(const sp<ABuffer> &csd0, const sp<ABuffer> &csd1, char *avcc) {
avcc[0] = 1; // version
avcc[1] = 0x64; // profile (default to high)
avcc[2] = 0; // constraints (default to none)
@@ -1713,7 +1713,7 @@
|| (t0.mSeq == t1.mSeq && t0.mTimeUs < t1.mTimeUs);
}
-void writeToAMessage(sp<AMessage> msg, const AudioPlaybackRate &rate) {
+void writeToAMessage(const sp<AMessage> &msg, const AudioPlaybackRate &rate) {
msg->setFloat("speed", rate.mSpeed);
msg->setFloat("pitch", rate.mPitch);
msg->setInt32("audio-fallback-mode", rate.mFallbackMode);
@@ -1728,7 +1728,7 @@
CHECK(msg->findInt32("audio-stretch-mode", (int32_t *)&rate->mStretchMode));
}
-void writeToAMessage(sp<AMessage> msg, const AVSyncSettings &sync, float videoFpsHint) {
+void writeToAMessage(const sp<AMessage> &msg, const AVSyncSettings &sync, float videoFpsHint) {
msg->setInt32("sync-source", sync.mSource);
msg->setInt32("audio-adjust-mode", sync.mAudioAdjustMode);
msg->setFloat("tolerance", sync.mTolerance);
diff --git a/media/libstagefright/WAVExtractor.cpp b/media/libstagefright/WAVExtractor.cpp
index 1f04fa0..780b746 100644
--- a/media/libstagefright/WAVExtractor.cpp
+++ b/media/libstagefright/WAVExtractor.cpp
@@ -45,7 +45,7 @@
};
static const char* WAVEEXT_SUBFORMAT = "\x00\x00\x00\x00\x10\x00\x80\x00\x00\xAA\x00\x38\x9B\x71";
-
+static const char* AMBISONIC_SUBFORMAT = "\x00\x00\x21\x07\xD3\x11\x86\x44\xC8\xC1\xCA\x00\x00\x00";
static uint32_t U32_LE_AT(const uint8_t *ptr) {
return ptr[3] << 24 | ptr[2] << 16 | ptr[1] << 8 | ptr[0];
@@ -250,7 +250,8 @@
// In a WAVE_EXT header, the first two bytes of the GUID stored at byte 24 contain
// the sample format, using the same definitions as a regular WAV header
mWaveFormat = U16_LE_AT(&formatSpec[24]);
- if (memcmp(&formatSpec[26], WAVEEXT_SUBFORMAT, 14)) {
+ if (memcmp(&formatSpec[26], WAVEEXT_SUBFORMAT, 14) &&
+ memcmp(&formatSpec[26], AMBISONIC_SUBFORMAT, 14)) {
ALOGE("unsupported GUID");
return ERROR_UNSUPPORTED;
}
diff --git a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
index ff76bc8..1c5e3c6 100644
--- a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
+++ b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
@@ -36,7 +36,7 @@
#define DRC_DEFAULT_MOBILE_DRC_CUT 127 /* maximum compression of dynamic range for mobile conf */
#define DRC_DEFAULT_MOBILE_DRC_BOOST 127 /* maximum compression of dynamic range for mobile conf */
#define DRC_DEFAULT_MOBILE_DRC_HEAVY 1 /* switch for heavy compression for mobile conf */
-#define DRC_DEFAULT_MOBILE_ENC_LEVEL -1 /* encoder target level; -1 => the value is unknown, otherwise dB step value (e.g. 64 for -16 dB) */
+#define DRC_DEFAULT_MOBILE_ENC_LEVEL (-1) /* encoder target level; -1 => the value is unknown, otherwise dB step value (e.g. 64 for -16 dB) */
#define MAX_CHANNEL_COUNT 8 /* maximum number of audio channels that can be decoded */
// names of properties that can be used to override the default DRC settings
#define PROP_DRC_OVERRIDE_REF_LEVEL "aac_drc_reference_level"
diff --git a/media/libstagefright/codecs/aacenc/Android.mk b/media/libstagefright/codecs/aacenc/Android.mk
index 266f01b..71c374b 100644
--- a/media/libstagefright/codecs/aacenc/Android.mk
+++ b/media/libstagefright/codecs/aacenc/Android.mk
@@ -64,7 +64,10 @@
LOCAL_STATIC_LIBRARIES :=
-LOCAL_SHARED_LIBRARIES :=
+# libstagefright links this static library, so it probably isn't appropriate to
+# link libstagefright. However, this library includes libstagefright headers,
+# and needs libbinder to be able to do so correctly.
+LOCAL_SHARED_LIBRARIES := libbinder
LOCAL_C_INCLUDES := \
frameworks/av/include \
diff --git a/media/libstagefright/codecs/aacenc/basic_op/oper_32b.c b/media/libstagefright/codecs/aacenc/basic_op/oper_32b.c
index 4fd16a1..78f032b 100644
--- a/media/libstagefright/codecs/aacenc/basic_op/oper_32b.c
+++ b/media/libstagefright/codecs/aacenc/basic_op/oper_32b.c
@@ -234,10 +234,10 @@
}
#define step(shift) \
- if ((0x40000000l >> shift) + root <= value) \
+ if ((0x40000000l >> (shift)) + root <= value) \
{ \
- value -= (0x40000000l >> shift) + root; \
- root = (root >> 1) | (0x40000000l >> shift); \
+ value -= (0x40000000l >> (shift)) + root; \
+ root = (root >> 1) | (0x40000000l >> (shift)); \
} else { \
root = root >> 1; \
}
diff --git a/media/libstagefright/codecs/aacenc/basic_op/typedefs.h b/media/libstagefright/codecs/aacenc/basic_op/typedefs.h
index 6059237..80d350d 100644
--- a/media/libstagefright/codecs/aacenc/basic_op/typedefs.h
+++ b/media/libstagefright/codecs/aacenc/basic_op/typedefs.h
@@ -89,11 +89,11 @@
#endif
#ifndef min
-#define min(a,b) ( a < b ? a : b)
+#define min(a,b) ( (a) < (b) ? (a) : (b))
#endif
#ifndef max
-#define max(a,b) ( a > b ? a : b)
+#define max(a,b) ( (a) > (b) ? (a) : (b))
#endif
#ifdef ARM_INASM
diff --git a/media/libstagefright/codecs/aacenc/inc/psy_const.h b/media/libstagefright/codecs/aacenc/inc/psy_const.h
index 19fb9b2..0b9f8c3 100644
--- a/media/libstagefright/codecs/aacenc/inc/psy_const.h
+++ b/media/libstagefright/codecs/aacenc/inc/psy_const.h
@@ -73,7 +73,7 @@
#define TRANSFORM_OFFSET_LONG 0
#define TRANSFORM_OFFSET_SHORT 448
-#define LOG_NORM_PCM -15
+#define LOG_NORM_PCM (-15)
#define NUM_SAMPLE_RATES 12
diff --git a/media/libstagefright/codecs/aacenc/src/bit_cnt.c b/media/libstagefright/codecs/aacenc/src/bit_cnt.c
index 9fe511c..65b035e 100644
--- a/media/libstagefright/codecs/aacenc/src/bit_cnt.c
+++ b/media/libstagefright/codecs/aacenc/src/bit_cnt.c
@@ -23,10 +23,10 @@
#include "bit_cnt.h"
#include "aac_rom.h"
-#define HI_LTAB(a) (a>>8)
-#define LO_LTAB(a) (a & 0xff)
+#define HI_LTAB(a) ((a)>>8)
+#define LO_LTAB(a) ((a) & 0xff)
-#define EXPAND(a) ((((Word32)(a&0xff00)) << 8)|(Word32)(a&0xff))
+#define EXPAND(a) ((((Word32)((a)&0xff00)) << 8)|(Word32)((a)&0xff))
/*****************************************************************************
diff --git a/media/libstagefright/codecs/aacenc/src/transform.c b/media/libstagefright/codecs/aacenc/src/transform.c
index 0080810..5de2b96 100644
--- a/media/libstagefright/codecs/aacenc/src/transform.c
+++ b/media/libstagefright/codecs/aacenc/src/transform.c
@@ -30,8 +30,8 @@
#define SQRT1_2 0x5a82799a /* sqrt(1/2) in Q31 */
#define swap2(p0,p1) \
t = p0; t1 = *(&(p0)+1); \
- p0 = p1; *(&(p0)+1) = *(&(p1)+1); \
- p1 = t; *(&(p1)+1) = t1
+ (p0) = p1; *(&(p0)+1) = *(&(p1)+1); \
+ (p1) = t; *(&(p1)+1) = t1
/*********************************************************************************
*
diff --git a/media/libstagefright/codecs/amrnb/common/src/az_lsp.cpp b/media/libstagefright/codecs/amrnb/common/src/az_lsp.cpp
index 459c3c3..f3098f5 100644
--- a/media/libstagefright/codecs/amrnb/common/src/az_lsp.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/az_lsp.cpp
@@ -103,7 +103,7 @@
; Include all pre-processor statements here. Include conditional
; compile variables also.
----------------------------------------------------------------------------*/
-#define NC M/2 /* M = LPC order, NC = M/2 */
+#define NC (M/2) /* M = LPC order, NC = M/2 */
/*----------------------------------------------------------------------------
; LOCAL FUNCTION DEFINITIONS
diff --git a/media/libstagefright/codecs/amrnb/common/src/gc_pred.cpp b/media/libstagefright/codecs/amrnb/common/src/gc_pred.cpp
index 1c8a700..731dc52 100644
--- a/media/libstagefright/codecs/amrnb/common/src/gc_pred.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/gc_pred.cpp
@@ -69,8 +69,8 @@
#define MEAN_ENER_MR122 783741L /* 36/(20*log10(2)) (Q17) */
/* minimum quantized energy: -14 dB */
-#define MIN_ENERGY -14336 /* 14 Q10 */
-#define MIN_ENERGY_MR122 -2381 /* 14 / (20*log10(2)) Q10 */
+#define MIN_ENERGY (-14336) /* 14 Q10 */
+#define MIN_ENERGY_MR122 (-2381) /* 14 / (20*log10(2)) Q10 */
/*----------------------------------------------------------------------------
; LOCAL FUNCTION DEFINITIONS
diff --git a/media/libstagefright/codecs/amrnb/dec/src/a_refl.cpp b/media/libstagefright/codecs/amrnb/dec/src/a_refl.cpp
index 696d2da..5a47510 100644
--- a/media/libstagefright/codecs/amrnb/dec/src/a_refl.cpp
+++ b/media/libstagefright/codecs/amrnb/dec/src/a_refl.cpp
@@ -59,6 +59,7 @@
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
+#define LOG_TAG "a_refl"
#include <log/log.h>
#include "a_refl.h"
diff --git a/media/libstagefright/codecs/amrwb/src/dtx.h b/media/libstagefright/codecs/amrwb/src/dtx.h
index a81f089..cf686a0 100644
--- a/media/libstagefright/codecs/amrwb/src/dtx.h
+++ b/media/libstagefright/codecs/amrwb/src/dtx.h
@@ -77,7 +77,7 @@
#define DTX_HANG_CONST 7 /* yields eight frames of SP HANGOVER */
#define INV_MED_THRESH 14564
#define ISF_GAP 128 /* 50 */
-#define ONE_MINUS_ISF_GAP 16384 - ISF_GAP
+#define ONE_MINUS_ISF_GAP (16384 - ISF_GAP)
#define ISF_GAP 128
#define ISF_DITH_GAP 448
diff --git a/media/libstagefright/codecs/amrwb/src/homing_amr_wb_dec.cpp b/media/libstagefright/codecs/amrwb/src/homing_amr_wb_dec.cpp
index f032a08..dde3e43 100644
--- a/media/libstagefright/codecs/amrwb/src/homing_amr_wb_dec.cpp
+++ b/media/libstagefright/codecs/amrwb/src/homing_amr_wb_dec.cpp
@@ -105,15 +105,15 @@
#define NUM_OF_SPMODES 9
#define PRML 15
-#define PRMN_7k NBBITS_7k/PRML + 1
-#define PRMN_9k NBBITS_9k/PRML + 1
-#define PRMN_12k NBBITS_12k/PRML + 1
-#define PRMN_14k NBBITS_14k/PRML + 1
-#define PRMN_16k NBBITS_16k/PRML + 1
-#define PRMN_18k NBBITS_18k/PRML + 1
-#define PRMN_20k NBBITS_20k/PRML + 1
-#define PRMN_23k NBBITS_23k/PRML + 1
-#define PRMN_24k NBBITS_24k/PRML + 1
+#define PRMN_7k (NBBITS_7k/PRML + 1)
+#define PRMN_9k (NBBITS_9k/PRML + 1)
+#define PRMN_12k (NBBITS_12k/PRML + 1)
+#define PRMN_14k (NBBITS_14k/PRML + 1)
+#define PRMN_16k (NBBITS_16k/PRML + 1)
+#define PRMN_18k (NBBITS_18k/PRML + 1)
+#define PRMN_20k (NBBITS_20k/PRML + 1)
+#define PRMN_23k (NBBITS_23k/PRML + 1)
+#define PRMN_24k (NBBITS_24k/PRML + 1)
/*----------------------------------------------------------------------------
; LOCAL FUNCTION DEFINITIONS
diff --git a/media/libstagefright/codecs/amrwb/src/pvamrwb_math_op.h b/media/libstagefright/codecs/amrwb/src/pvamrwb_math_op.h
index 8951e5c..2143c9a 100644
--- a/media/libstagefright/codecs/amrwb/src/pvamrwb_math_op.h
+++ b/media/libstagefright/codecs/amrwb/src/pvamrwb_math_op.h
@@ -119,8 +119,8 @@
#define norm_s( x) (normalize_amr_wb( x) - 16)
-#define extract_h( x) (int16)(x>>16)
-#define L_deposit_h( x) (int32)(x<<16)
+#define extract_h( x) (int16)((x)>>16)
+#define L_deposit_h( x) (int32)((x)<<16)
#ifdef __cplusplus
diff --git a/media/libstagefright/codecs/amrwb/src/pvamrwbdecoder_basic_op.h b/media/libstagefright/codecs/amrwb/src/pvamrwbdecoder_basic_op.h
index df239d2..88ff9bc 100644
--- a/media/libstagefright/codecs/amrwb/src/pvamrwbdecoder_basic_op.h
+++ b/media/libstagefright/codecs/amrwb/src/pvamrwbdecoder_basic_op.h
@@ -56,8 +56,8 @@
#define MAX_32 (int32)0x7fffffffL
#define MIN_32 (int32)0x80000000L
-#define MAX_16 (int16)+32767 /* 0x7fff */
-#define MIN_16 (int16)-32768 /* 0x8000 */
+#define MAX_16 ((int16)+32767) /* 0x7fff */
+#define MIN_16 ((int16)-32768) /* 0x8000 */
diff --git a/media/libstagefright/codecs/amrwb/src/pvamrwbdecoder_cnst.h b/media/libstagefright/codecs/amrwb/src/pvamrwbdecoder_cnst.h
index ecf1bf3..3981ce3 100644
--- a/media/libstagefright/codecs/amrwb/src/pvamrwbdecoder_cnst.h
+++ b/media/libstagefright/codecs/amrwb/src/pvamrwbdecoder_cnst.h
@@ -130,7 +130,7 @@
#define EHF_MASK (int16)0x0008 /* homing frame pattern */
-#define BIT_0 (int16)-127
+#define BIT_0 ((int16)-127)
#define BIT_1 (int16)127
#define BIT_0_ITU (int16)0x007F
#define BIT_1_ITU (int16)0x0081
diff --git a/media/libstagefright/codecs/amrwbenc/inc/basic_op.h b/media/libstagefright/codecs/amrwbenc/inc/basic_op.h
index 8165f69..80ad7f1 100644
--- a/media/libstagefright/codecs/amrwbenc/inc/basic_op.h
+++ b/media/libstagefright/codecs/amrwbenc/inc/basic_op.h
@@ -25,8 +25,8 @@
#define MAX_32 (Word32)0x7fffffffL
#define MIN_32 (Word32)0x80000000L
-#define MAX_16 (Word16)+32767 /* 0x7fff */
-#define MIN_16 (Word16)-32768 /* 0x8000 */
+#define MAX_16 ((Word16)+32767) /* 0x7fff */
+#define MIN_16 ((Word16)-32768) /* 0x8000 */
#define static_vo static __inline
@@ -41,23 +41,23 @@
#define L_negate(L_var1) (((L_var1) == (MIN_32)) ? (MAX_32) : (-(L_var1))) /* Long negate, 2*/
-#define extract_h(a) ((Word16)(a >> 16))
-#define extract_l(x) (Word16)((x))
-#define add1(a,b) (a + b)
-#define vo_L_msu(a,b,c) ( a - (( b * c ) << 1) )
+#define extract_h(a) ((Word16)((a) >> 16))
+#define extract_l(x) (Word16)((x))
+#define add1(a,b) ((a) + (b))
+#define vo_L_msu(a,b,c) ((a) - (((b) * (c)) << 1))
#define vo_mult32(a, b) ((a) * (b))
-#define vo_mult(a,b) (( a * b ) >> 15 )
-#define vo_L_mult(a,b) (((a) * (b)) << 1)
-#define vo_shr_r(var1, var2) ((var1+((Word16)(1L<<(var2-1))))>>var2)
-#define vo_sub(a,b) (a - b)
+#define vo_mult(a,b) (((a) * (b)) >> 15)
+#define vo_L_mult(a,b) (((a) * (b)) << 1)
+#define vo_shr_r(var1, var2) (((var1)+((Word16)(1L<<((var2)-1))))>>(var2))
+#define vo_sub(a,b) ((a) - (b))
#define vo_L_deposit_h(a) ((Word32)((a) << 16))
-#define vo_round(a) ((((a) >> 15) + 1) >> 1)
+#define vo_round(a) ((((a) >> 15) + 1) >> 1)
#define vo_extract_l(a) ((Word16)(a))
-#define vo_L_add(a,b) (a + b)
-#define vo_L_sub(a,b) (a - b)
-#define vo_mult_r(a,b) (((( a * b ) >> 14) + 1 ) >> 1 )
-#define vo_negate(a) (-a)
-#define vo_L_shr_r(L_var1, var2) ((L_var1+((Word32)(1L<<(var2-1))))>>var2)
+#define vo_L_add(a,b) ((a) + (b))
+#define vo_L_sub(a,b) ((a) - (b))
+#define vo_mult_r(a,b) (((( (a) * (b) ) >> 14) + 1 ) >> 1 )
+#define vo_negate(a) (-(a))
+#define vo_L_shr_r(L_var1, var2) (((L_var1)+((Word32)(1L<<((var2)-1))))>>(var2))
/*___________________________________________________________________________
@@ -765,7 +765,7 @@
break;
}
}
- L_var1 <<=1 ;
+ L_var1 *= 2 ;
L_var_out = L_var1;
}
return (L_var_out);
diff --git a/media/libstagefright/codecs/amrwbenc/inc/bits.h b/media/libstagefright/codecs/amrwbenc/inc/bits.h
index ff9c0c1..57e71f7 100644
--- a/media/libstagefright/codecs/amrwbenc/inc/bits.h
+++ b/media/libstagefright/codecs/amrwbenc/inc/bits.h
@@ -42,7 +42,7 @@
#define NBBITS_SID 35
#define NB_BITS_MAX NBBITS_24k
-#define BIT_0 (Word16)-127
+#define BIT_0 ((Word16)-127)
#define BIT_1 (Word16)127
#define BIT_0_ITU (Word16)0x007F
#define BIT_1_ITU (Word16)0x0081
diff --git a/media/libstagefright/codecs/amrwbenc/inc/dtx.h b/media/libstagefright/codecs/amrwbenc/inc/dtx.h
index 82a9bf4..7d7ebd8 100644
--- a/media/libstagefright/codecs/amrwbenc/inc/dtx.h
+++ b/media/libstagefright/codecs/amrwbenc/inc/dtx.h
@@ -31,7 +31,7 @@
#define DTX_HANG_CONST 7 /* yields eight frames of SP HANGOVER */
#define INV_MED_THRESH 14564
#define ISF_GAP 128 /* 50 */
-#define ONE_MINUS_ISF_GAP 16384 - ISF_GAP
+#define ONE_MINUS_ISF_GAP (16384 - ISF_GAP)
#define ISF_GAP 128
#define ISF_DITH_GAP 448
#define ISF_FACTOR_LOW 256
diff --git a/media/libstagefright/codecs/amrwbenc/inc/homing.tab b/media/libstagefright/codecs/amrwbenc/inc/homing.tab
index e399fb8..6408d3a 100644
--- a/media/libstagefright/codecs/amrwbenc/inc/homing.tab
+++ b/media/libstagefright/codecs/amrwbenc/inc/homing.tab
@@ -21,15 +21,15 @@
#define NUM_OF_SPMODES 9
#define PRML 15
-#define PRMN_7k NBBITS_7k/PRML + 1
-#define PRMN_9k NBBITS_9k/PRML + 1
-#define PRMN_12k NBBITS_12k/PRML + 1
-#define PRMN_14k NBBITS_14k/PRML + 1
-#define PRMN_16k NBBITS_16k/PRML + 1
-#define PRMN_18k NBBITS_18k/PRML + 1
-#define PRMN_20k NBBITS_20k/PRML + 1
-#define PRMN_23k NBBITS_23k/PRML + 1
-#define PRMN_24k NBBITS_24k/PRML + 1
+#define PRMN_7k (NBBITS_7k/PRML + 1)
+#define PRMN_9k (NBBITS_9k/PRML + 1)
+#define PRMN_12k (NBBITS_12k/PRML + 1)
+#define PRMN_14k (NBBITS_14k/PRML + 1)
+#define PRMN_16k (NBBITS_16k/PRML + 1)
+#define PRMN_18k (NBBITS_18k/PRML + 1)
+#define PRMN_20k (NBBITS_20k/PRML + 1)
+#define PRMN_23k (NBBITS_23k/PRML + 1)
+#define PRMN_24k (NBBITS_24k/PRML + 1)
static const Word16 dfh_M7k[PRMN_7k] =
{
diff --git a/media/libstagefright/codecs/amrwbenc/inc/stream.h b/media/libstagefright/codecs/amrwbenc/inc/stream.h
index ec1a700..fbaae9e 100644
--- a/media/libstagefright/codecs/amrwbenc/inc/stream.h
+++ b/media/libstagefright/codecs/amrwbenc/inc/stream.h
@@ -26,7 +26,7 @@
#define __STREAM_H__
#include "voMem.h"
-#define Frame_Maxsize 1024 * 2 //Work Buffer 10K
+#define Frame_Maxsize (1024 * 2) //Work Buffer 10K
#define Frame_MaxByte 640 //AMR_WB Encoder one frame 320 samples = 640 Bytes
#define MIN(a,b) ((a) < (b)? (a) : (b))
diff --git a/media/libstagefright/codecs/avc/enc/Android.mk b/media/libstagefright/codecs/avc/enc/Android.mk
index 8ff2f35..511c9f2 100644
--- a/media/libstagefright/codecs/avc/enc/Android.mk
+++ b/media/libstagefright/codecs/avc/enc/Android.mk
@@ -62,12 +62,10 @@
LOCAL_SHARED_LIBRARIES := \
libstagefright \
libstagefright_avc_common \
- libstagefright_enc_common \
libstagefright_foundation \
libstagefright_omx \
libutils \
liblog \
- libui
LOCAL_MODULE := libstagefright_soft_h264enc
diff --git a/media/libstagefright/codecs/avc/enc/src/avcenc_int.h b/media/libstagefright/codecs/avc/enc/src/avcenc_int.h
index 3fe08a1..22042a5 100644
--- a/media/libstagefright/codecs/avc/enc/src/avcenc_int.h
+++ b/media/libstagefright/codecs/avc/enc/src/avcenc_int.h
@@ -43,7 +43,7 @@
#define MAX_QP 51
#define SHIFT_QP 12
#define LAMBDA_ACCURACY_BITS 16
-#define LAMBDA_FACTOR(lambda) ((int)((double)(1<<LAMBDA_ACCURACY_BITS)*lambda+0.5))
+#define LAMBDA_FACTOR(lambda) ((int)((double)(1<<LAMBDA_ACCURACY_BITS)*(lambda)+0.5))
#define DISABLE_THRESHOLDING 0
@@ -55,8 +55,8 @@
#define MAX_VALUE 999999 //!< used for start value for some variables
#define WEIGHTED_COST(factor,bits) (((factor)*(bits))>>LAMBDA_ACCURACY_BITS)
-#define MV_COST(f,s,cx,cy,px,py) (WEIGHTED_COST(f,mvbits[((cx)<<(s))-px]+mvbits[((cy)<<(s))-py]))
-#define MV_COST_S(f,cx,cy,px,py) (WEIGHTED_COST(f,mvbits[cx-px]+mvbits[cy-py]))
+#define MV_COST(f,s,cx,cy,px,py) (WEIGHTED_COST(f,mvbits[((cx)<<(s))-(px)]+mvbits[((cy)<<((s)))-(py)]))
+#define MV_COST_S(f,cx,cy,px,py) (WEIGHTED_COST(f,mvbits[(cx)-(px)]+mvbits[(cy)-(py)]))
/* for sub-pel search and interpolation */
#define SUBPEL_PRED_BLK_SIZE 576 // 24x24
diff --git a/media/libstagefright/codecs/avc/enc/src/findhalfpel.cpp b/media/libstagefright/codecs/avc/enc/src/findhalfpel.cpp
index d0bbee2..941ae5a 100644
--- a/media/libstagefright/codecs/avc/enc/src/findhalfpel.cpp
+++ b/media/libstagefright/codecs/avc/enc/src/findhalfpel.cpp
@@ -23,13 +23,13 @@
#define PREF_16_VEC 129 /* 1MV bias versus 4MVs*/
-#define CLIP_RESULT(x) if((uint)x > 0xFF){ \
- x = 0xFF & (~(x>>31));}
+#define CLIP_RESULT(x) if((uint)(x) > 0xFF){ \
+ (x) = 0xFF & (~((x)>>31));}
-#define CLIP_UPPER16(x) if((uint)x >= 0x20000000){ \
- x = 0xFF0000 & (~(x>>31));} \
+#define CLIP_UPPER16(x) if((uint)(x) >= 0x20000000){ \
+ (x) = 0xFF0000 & (~((x)>>31));} \
else { \
- x = (x>>5)&0xFF0000; \
+ (x) = ((x)>>5)&0xFF0000; \
}
/*=====================================================================
diff --git a/media/libstagefright/codecs/avc/enc/src/intra_est.cpp b/media/libstagefright/codecs/avc/enc/src/intra_est.cpp
index 17e5985..e397805 100644
--- a/media/libstagefright/codecs/avc/enc/src/intra_est.cpp
+++ b/media/libstagefright/codecs/avc/enc/src/intra_est.cpp
@@ -25,8 +25,8 @@
#define FIXED_I4_MODE AVC_I4_Diagonal_Down_Left
#define FIXED_INTRA_CHROMA_MODE AVC_IC_DC
-#define CLIP_RESULT(x) if((uint)x > 0xFF){ \
- x = 0xFF & (~(x>>31));}
+#define CLIP_RESULT(x) if((uint)(x) > 0xFF){ \
+ (x) = 0xFF & (~((x)>>31));}
bool IntraDecisionABE(AVCEncObject *encvid, int min_cost, uint8 *curL, int picPitch)
diff --git a/media/libstagefright/codecs/avc/enc/src/motion_comp.cpp b/media/libstagefright/codecs/avc/enc/src/motion_comp.cpp
index a390f88..d19125f 100644
--- a/media/libstagefright/codecs/avc/enc/src/motion_comp.cpp
+++ b/media/libstagefright/codecs/avc/enc/src/motion_comp.cpp
@@ -19,8 +19,8 @@
#include "avcenc_int.h"
-#define CLIP_RESULT(x) if((uint)x > 0xFF){ \
- x = 0xFF & (~(x>>31));}
+#define CLIP_RESULT(x) if((uint)(x) > 0xFF){ \
+ (x) = 0xFF & (~((x)>>31));}
/* (blkwidth << 2) + (dy << 1) + dx */
static void (*const eChromaMC_SIMD[8])(uint8 *, int , int , int , uint8 *, int, int , int) =
diff --git a/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp b/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp
index cecc52b..8694c73 100644
--- a/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp
+++ b/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp
@@ -120,7 +120,8 @@
mIvColorFormat(IV_YUV_420P),
mChangingResolution(false),
mSignalledError(false),
- mStride(mWidth){
+ mStride(mWidth),
+ mInputOffset(0){
initPorts(
1 /* numMinInputBuffers */, kNumBuffers, INPUT_BUF_SIZE,
1 /* numMinOutputBuffers */, kNumBuffers, CODEC_MIME_TYPE);
@@ -215,6 +216,7 @@
status_t SoftAVC::resetPlugin() {
mIsInFlush = false;
mReceivedEOS = false;
+ mInputOffset = 0;
memset(mTimeStamps, 0, sizeof(mTimeStamps));
memset(mTimeStampsValid, 0, sizeof(mTimeStampsValid));
@@ -443,8 +445,8 @@
if (inHeader) {
ps_dec_ip->u4_ts = timeStampIx;
ps_dec_ip->pv_stream_buffer =
- inHeader->pBuffer + inHeader->nOffset;
- ps_dec_ip->u4_num_Bytes = inHeader->nFilledLen;
+ inHeader->pBuffer + inHeader->nOffset + mInputOffset;
+ ps_dec_ip->u4_num_Bytes = inHeader->nFilledLen - mInputOffset;
} else {
ps_dec_ip->u4_ts = 0;
ps_dec_ip->pv_stream_buffer = NULL;
@@ -515,6 +517,8 @@
void SoftAVC::onQueueFilled(OMX_U32 portIndex) {
UNUSED(portIndex);
+ OMX_BUFFERHEADERTYPE *inHeader = NULL;
+ BufferInfo *inInfo = NULL;
if (mSignalledError) {
return;
@@ -541,17 +545,11 @@
List<BufferInfo *> &outQueue = getPortQueue(kOutputPortIndex);
while (!outQueue.empty()) {
- BufferInfo *inInfo;
- OMX_BUFFERHEADERTYPE *inHeader;
-
BufferInfo *outInfo;
OMX_BUFFERHEADERTYPE *outHeader;
- size_t timeStampIx;
+ size_t timeStampIx = 0;
- inInfo = NULL;
- inHeader = NULL;
-
- if (!mIsInFlush) {
+ if (!mIsInFlush && (NULL == inHeader)) {
if (!inQueue.empty()) {
inInfo = *inQueue.begin();
inHeader = inInfo->mHeader;
@@ -618,7 +616,7 @@
return;
}
// If input dump is enabled, then write to file
- DUMP_TO_FILE(mInFile, s_dec_ip.pv_stream_buffer, s_dec_ip.u4_num_Bytes);
+ DUMP_TO_FILE(mInFile, s_dec_ip.pv_stream_buffer, s_dec_ip.u4_num_Bytes, mInputOffset);
GETTIME(&mTimeStart, NULL);
/* Compute time elapsed between end of previous decode()
@@ -734,24 +732,26 @@
resetPlugin();
}
}
+ mInputOffset += s_dec_op.u4_num_bytes_consumed;
}
-
- /* If input EOS is seen and decoder is not in flush mode,
- * set the decoder in flush mode.
- * There can be a case where EOS is sent along with last picture data
- * In that case, only after decoding that input data, decoder has to be
- * put in flush. This case is handled here */
-
- if (mReceivedEOS && !mIsInFlush) {
- setFlushMode();
- }
-
- if (inHeader != NULL) {
+ // If more than 4 bytes are remaining in input, then do not release it
+ if (inHeader != NULL && ((inHeader->nFilledLen - mInputOffset) <= 4)) {
inInfo->mOwnedByUs = false;
inQueue.erase(inQueue.begin());
inInfo = NULL;
notifyEmptyBufferDone(inHeader);
inHeader = NULL;
+ mInputOffset = 0;
+
+ /* If input EOS is seen and decoder is not in flush mode,
+ * set the decoder in flush mode.
+ * There can be a case where EOS is sent along with last picture data
+ * In that case, only after decoding that input data, decoder has to be
+ * put in flush. This case is handled here */
+
+ if (mReceivedEOS && !mIsInFlush) {
+ setFlushMode();
+ }
}
}
}
diff --git a/media/libstagefright/codecs/avcdec/SoftAVCDec.h b/media/libstagefright/codecs/avcdec/SoftAVCDec.h
index 154ca38..2a71188 100644
--- a/media/libstagefright/codecs/avcdec/SoftAVCDec.h
+++ b/media/libstagefright/codecs/avcdec/SoftAVCDec.h
@@ -46,8 +46,8 @@
/** Compute difference between start and end */
#define TIME_DIFF(start, end, diff) \
- diff = ((end.tv_sec - start.tv_sec) * 1000000) + \
- (end.tv_usec - start.tv_usec);
+ diff = (((end).tv_sec - (start).tv_sec) * 1000000) + \
+ ((end).tv_usec - (start).tv_usec);
struct SoftAVC : public SoftVideoDecoderOMXComponent {
SoftAVC(const char *name, const OMX_CALLBACKTYPE *callbacks,
@@ -99,6 +99,7 @@
bool mFlushNeeded;
bool mSignalledError;
size_t mStride;
+ size_t mInputOffset;
status_t initDecoder();
status_t deInitDecoder();
@@ -143,10 +144,10 @@
ALOGD("Could not open file %s", m_filename); \
} \
}
-#define DUMP_TO_FILE(m_filename, m_buf, m_size) \
+#define DUMP_TO_FILE(m_filename, m_buf, m_size, m_offset)\
{ \
FILE *fp = fopen(m_filename, "ab"); \
- if (fp != NULL && m_buf != NULL) { \
+ if (fp != NULL && m_buf != NULL && m_offset == 0) { \
int i; \
i = fwrite(m_buf, 1, m_size, fp); \
ALOGD("fwrite ret %d to write %d", i, m_size); \
@@ -154,10 +155,12 @@
ALOGD("Error in fwrite, returned %d", i); \
perror("Error in write to file"); \
} \
- fclose(fp); \
- } else { \
+ } else if (fp == NULL) { \
ALOGD("Could not write to file %s", m_filename);\
} \
+ if (fp) { \
+ fclose(fp); \
+ } \
}
#else /* FILE_DUMP_ENABLE */
#define INPUT_DUMP_PATH
@@ -166,7 +169,7 @@
#define OUTPUT_DUMP_EXT
#define GENERATE_FILE_NAMES()
#define CREATE_DUMP_FILE(m_filename)
-#define DUMP_TO_FILE(m_filename, m_buf, m_size)
+#define DUMP_TO_FILE(m_filename, m_buf, m_size, m_offset)
#endif /* FILE_DUMP_ENABLE */
} // namespace android
diff --git a/media/libstagefright/codecs/avcenc/Android.mk b/media/libstagefright/codecs/avcenc/Android.mk
index 70e531b..523036a 100644
--- a/media/libstagefright/codecs/avcenc/Android.mk
+++ b/media/libstagefright/codecs/avcenc/Android.mk
@@ -19,7 +19,6 @@
LOCAL_SHARED_LIBRARIES := libstagefright
LOCAL_SHARED_LIBRARIES += libstagefright_omx
-LOCAL_SHARED_LIBRARIES += libstagefright_foundation
LOCAL_SHARED_LIBRARIES += libutils
LOCAL_SHARED_LIBRARIES += liblog
diff --git a/media/libstagefright/codecs/avcenc/SoftAVCEnc.h b/media/libstagefright/codecs/avcenc/SoftAVCEnc.h
index cf6f899..4d30ba0 100644
--- a/media/libstagefright/codecs/avcenc/SoftAVCEnc.h
+++ b/media/libstagefright/codecs/avcenc/SoftAVCEnc.h
@@ -111,8 +111,8 @@
/** Compute difference between start and end */
#define TIME_DIFF(start, end, diff) \
- diff = ((end.tv_sec - start.tv_sec) * 1000000) + \
- (end.tv_usec - start.tv_usec);
+ diff = (((end).tv_sec - (start).tv_sec) * 1000000) + \
+ ((end).tv_usec - (start).tv_usec);
#define ive_aligned_malloc(alignment, size) memalign(alignment, size)
#define ive_aligned_free(buf) free(buf)
diff --git a/media/libstagefright/codecs/common/include/voAAC.h b/media/libstagefright/codecs/common/include/voAAC.h
index 9ecb142..0a02feb 100644
--- a/media/libstagefright/codecs/common/include/voAAC.h
+++ b/media/libstagefright/codecs/common/include/voAAC.h
@@ -50,7 +50,7 @@
/* AAC Param ID */
#define VO_PID_AAC_Mdoule 0x42211000
-#define VO_PID_AAC_ENCPARAM VO_PID_AAC_Mdoule | 0x0040 /*!< get/set AAC encoder parameter, the parameter is a pointer to AACENC_PARAM */
+#define VO_PID_AAC_ENCPARAM (VO_PID_AAC_Mdoule | 0x0040) /*!< get/set AAC encoder parameter, the parameter is a pointer to AACENC_PARAM */
/* AAC decoder error ID */
#define VO_ERR_AAC_Mdoule 0x82210000
diff --git a/media/libstagefright/codecs/common/include/voAudio.h b/media/libstagefright/codecs/common/include/voAudio.h
index d8628ee..98d3f44 100644
--- a/media/libstagefright/codecs/common/include/voAudio.h
+++ b/media/libstagefright/codecs/common/include/voAudio.h
@@ -38,9 +38,9 @@
#define VO_PID_AUDIO_CHANNELMODE (VO_PID_AUDIO_BASE | 0X0005) /*!< The channel mode of audio */
#define VO_ERR_AUDIO_BASE 0x82000000
-#define VO_ERR_AUDIO_UNSCHANNEL VO_ERR_AUDIO_BASE | 0x0001
-#define VO_ERR_AUDIO_UNSSAMPLERATE VO_ERR_AUDIO_BASE | 0x0002
-#define VO_ERR_AUDIO_UNSFEATURE VO_ERR_AUDIO_BASE | 0x0003
+#define VO_ERR_AUDIO_UNSCHANNEL (VO_ERR_AUDIO_BASE | 0x0001)
+#define VO_ERR_AUDIO_UNSSAMPLERATE (VO_ERR_AUDIO_BASE | 0x0002)
+#define VO_ERR_AUDIO_UNSFEATURE (VO_ERR_AUDIO_BASE | 0x0003)
/**
diff --git a/media/libstagefright/codecs/common/include/voIndex.h b/media/libstagefright/codecs/common/include/voIndex.h
index 320a2f8..97b21f3 100644
--- a/media/libstagefright/codecs/common/include/voIndex.h
+++ b/media/libstagefright/codecs/common/include/voIndex.h
@@ -31,26 +31,26 @@
/* Define the module ID */
#define _MAKE_SOURCE_ID(id, name) \
-VO_INDEX_SRC_##name = _VO_INDEX_SOURCE | id,
+VO_INDEX_SRC_##name = _VO_INDEX_SOURCE | (id),
#define _MAKE_CODEC_ID(id, name) \
-VO_INDEX_DEC_##name = _VO_INDEX_DEC | id, \
-VO_INDEX_ENC_##name = _VO_INDEX_ENC | id,
+VO_INDEX_DEC_##name = _VO_INDEX_DEC | (id), \
+VO_INDEX_ENC_##name = _VO_INDEX_ENC | (id),
#define _MAKE_EFFECT_ID(id, name) \
-VO_INDEX_EFT_##name = _VO_INDEX_EFFECT | id,
+VO_INDEX_EFT_##name = _VO_INDEX_EFFECT | (id),
#define _MAKE_SINK_ID(id, name) \
-VO_INDEX_SNK_##name = _VO_INDEX_SINK | id,
+VO_INDEX_SNK_##name = _VO_INDEX_SINK | (id),
#define _MAKE_FILTER_ID(id, name) \
-VO_INDEX_FLT_##name = _VO_INDEX_FILTER | id,
+VO_INDEX_FLT_##name = _VO_INDEX_FILTER | (id),
#define _MAKE_OMX_ID(id, name) \
-VO_INDEX_OMX_##name = _VO_INDEX_OMX | id,
+VO_INDEX_OMX_##name = _VO_INDEX_OMX | (id),
#define _MAKE_MFW_ID(id, name) \
-VO_INDEX_MFW_##name = _VO_INDEX_MFW | id,
+VO_INDEX_MFW_##name = _VO_INDEX_MFW | (id),
enum
{
diff --git a/media/libstagefright/codecs/common/include/voMem.h b/media/libstagefright/codecs/common/include/voMem.h
index 8dfb634..2b5aef1 100644
--- a/media/libstagefright/codecs/common/include/voMem.h
+++ b/media/libstagefright/codecs/common/include/voMem.h
@@ -53,8 +53,8 @@
{ \
VO_MEM_INFO voMemInfo; \
voMemInfo.Size=nSize; \
- pMemOP->Alloc(ID, &voMemInfo); \
- pBuff=(VO_PBYTE)voMemInfo.VBuffer; \
+ (pMemOP)->Alloc(ID, &voMemInfo); \
+ (pBuff)=(VO_PBYTE)voMemInfo.VBuffer; \
}
diff --git a/media/libstagefright/codecs/g711/dec/Android.mk b/media/libstagefright/codecs/g711/dec/Android.mk
index b36c99d..8e5a2ff 100644
--- a/media/libstagefright/codecs/g711/dec/Android.mk
+++ b/media/libstagefright/codecs/g711/dec/Android.mk
@@ -9,7 +9,7 @@
frameworks/native/include/media/openmax
LOCAL_SHARED_LIBRARIES := \
- libstagefright libstagefright_omx libstagefright_foundation libutils liblog
+ libstagefright libstagefright_omx libutils liblog
LOCAL_MODULE := libstagefright_soft_g711dec
LOCAL_MODULE_TAGS := optional
diff --git a/media/libstagefright/codecs/gsm/dec/Android.mk b/media/libstagefright/codecs/gsm/dec/Android.mk
index fe8c830..a225c31 100644
--- a/media/libstagefright/codecs/gsm/dec/Android.mk
+++ b/media/libstagefright/codecs/gsm/dec/Android.mk
@@ -14,7 +14,7 @@
LOCAL_SANITIZE := signed-integer-overflow unsigned-integer-overflow
LOCAL_SHARED_LIBRARIES := \
- libstagefright libstagefright_omx libstagefright_foundation libutils liblog
+ libstagefright libstagefright_omx libutils liblog
LOCAL_STATIC_LIBRARIES := \
libgsm
diff --git a/media/libstagefright/codecs/hevcdec/SoftHEVC.h b/media/libstagefright/codecs/hevcdec/SoftHEVC.h
index 20a836b..e7c2127 100644
--- a/media/libstagefright/codecs/hevcdec/SoftHEVC.h
+++ b/media/libstagefright/codecs/hevcdec/SoftHEVC.h
@@ -46,8 +46,8 @@
/** Compute difference between start and end */
#define TIME_DIFF(start, end, diff) \
- diff = ((end.tv_sec - start.tv_sec) * 1000000) + \
- (end.tv_usec - start.tv_usec);
+ diff = (((end).tv_sec - (start).tv_sec) * 1000000) + \
+ ((end).tv_usec - (start).tv_usec);
struct SoftHEVC: public SoftVideoDecoderOMXComponent {
SoftHEVC(const char *name, const OMX_CALLBACKTYPE *callbacks,
diff --git a/media/libstagefright/codecs/m4v_h263/dec/include/m4vh263_decoder_pv_types.h b/media/libstagefright/codecs/m4v_h263/dec/include/m4vh263_decoder_pv_types.h
index ec6871f..711ec58 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/include/m4vh263_decoder_pv_types.h
+++ b/media/libstagefright/codecs/m4v_h263/dec/include/m4vh263_decoder_pv_types.h
@@ -51,7 +51,7 @@
{
public:
OsclAOStatus();
- OsclAOStatus(int32 aStatus);
+ explicit OsclAOStatus(int32 aStatus);
int32 operator=(int32 aStatus);
int32 operator==(int32 aStatus) const;
int32 operator!=(int32 aStatus) const;
diff --git a/media/libstagefright/codecs/m4v_h263/dec/src/conceal.cpp b/media/libstagefright/codecs/m4v_h263/dec/src/conceal.cpp
index 03e4119..8393d79 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/src/conceal.cpp
+++ b/media/libstagefright/codecs/m4v_h263/dec/src/conceal.cpp
@@ -15,11 +15,15 @@
* and limitations under the License.
* -------------------------------------------------------------------
*/
+
+#define LOG_TAG "conceal"
+
+#include "log/log.h"
+
#include "mp4dec_lib.h" /* video decoder function prototypes */
#include "vlc_decode.h"
#include "bitstream.h"
#include "scaling.h"
-#include "log/log.h"
/* ====================================================================== /
Function : ConcealTexture_I()
diff --git a/media/libstagefright/codecs/m4v_h263/dec/src/idct.h b/media/libstagefright/codecs/m4v_h263/dec/src/idct.h
index 8edb654..484631b 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/src/idct.h
+++ b/media/libstagefright/codecs/m4v_h263/dec/src/idct.h
@@ -80,9 +80,9 @@
#define W7 565 /* 2048*sqrt(2)*cos(7*pi/16) */
#define W1mW7 2276
#define W1pW7 3406
-#define W5mW3 -799
-#define mW3mW5 -4017
-#define mW2mW6 -3784
+#define W5mW3 (-799)
+#define mW3mW5 (-4017)
+#define mW2mW6 (-3784)
#define W2mW6 1568
/* left shift by 11 is to maintain the accuracy of the decimal point */
diff --git a/media/libstagefright/codecs/m4v_h263/dec/src/motion_comp.h b/media/libstagefright/codecs/m4v_h263/dec/src/motion_comp.h
index 0c12f20..68281ba 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/src/motion_comp.h
+++ b/media/libstagefright/codecs/m4v_h263/dec/src/motion_comp.h
@@ -54,20 +54,20 @@
{
#endif
-#define CLIP_RESULT(x) if(x & -256){x = 0xFF & (~(x>>31));}
+#define CLIP_RESULT(x) if((x) & -256){(x) = 0xFF & (~((x)>>31));}
#define ADD_AND_CLIP1(x) x += (pred_word&0xFF); CLIP_RESULT(x);
#define ADD_AND_CLIP2(x) x += ((pred_word>>8)&0xFF); CLIP_RESULT(x);
#define ADD_AND_CLIP3(x) x += ((pred_word>>16)&0xFF); CLIP_RESULT(x);
#define ADD_AND_CLIP4(x) x += ((pred_word>>24)&0xFF); CLIP_RESULT(x);
-#define ADD_AND_CLIP(x,y) { x9 = ~(x>>8); \
+#define ADD_AND_CLIP(x,y) { x9 = ~((x)>>8); \
if(x9!=-1){ \
x9 = ((uint32)x9)>>24; \
- y = x9|(y<<8); \
+ (y) = x9|((y)<<8); \
} \
else \
{ \
- y = x|(y<<8); \
+ (y) = (x)|((y)<<8); \
} \
}
diff --git a/media/libstagefright/codecs/m4v_h263/dec/src/mp4def.h b/media/libstagefright/codecs/m4v_h263/dec/src/mp4def.h
index 3388d89..20f458d 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/src/mp4def.h
+++ b/media/libstagefright/codecs/m4v_h263/dec/src/mp4def.h
@@ -47,7 +47,7 @@
/* You don't want to use ((x>UB)?UB:(x<LB)?LB:x) for the clipping */
/* because it will use one extra comparison if the compiler is */
/* not well-optimized. 04/19/2000. */
-#define CLIP_THE_RANGE(x,LB,UB) if (x<LB) x = LB; else if (x>UB) x = UB
+#define CLIP_THE_RANGE(x,LB,UB) if ((x)<(LB)) (x) = (LB); else if ((x)>(UB)) (x) = (UB)
#define MODE_INTRA 0x08 //01000
#define MODE_INTRA_Q 0x09 //01001
@@ -72,7 +72,7 @@
#define START_CODE_LENGTH 32
/* 11/30/98 */
-#define NoMarkerFound -1
+#define NoMarkerFound (-1)
#define FoundRM 1 /* Resync Marker */
#define FoundVSC 2 /* VOP_START_CODE. */
#define FoundGSC 3 /* GROUP_START_CODE */
@@ -153,7 +153,7 @@
/* macro utility */
-#define ZERO_OUT_64BYTES(x) { *((uint32*)x) = *(((uint32*)(x))+1) = \
+#define ZERO_OUT_64BYTES(x) { *((uint32*)(x)) = *(((uint32*)(x))+1) = \
*(((uint32*)(x))+2) = *(((uint32*)(x))+3) = \
*(((uint32*)(x))+4) = *(((uint32*)(x))+5) = \
*(((uint32*)(x))+6) = *(((uint32*)(x))+7) = \
diff --git a/media/libstagefright/codecs/m4v_h263/dec/src/post_proc.h b/media/libstagefright/codecs/m4v_h263/dec/src/post_proc.h
index 091fdaf..a8ab37f 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/src/post_proc.h
+++ b/media/libstagefright/codecs/m4v_h263/dec/src/post_proc.h
@@ -32,9 +32,9 @@
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
-#define UPDATE_PV_MAXPV_MIN(p,max,min) if ((p) > max) max=(p); else if ((p) < min) min = (p);
+#define UPDATE_PV_MAXPV_MIN(p,max,min) if ((p) > (max)) (max)=(p); else if ((p) < (min)) (min) = (p);
-#define INDEX(x,thr) (((x)>=thr)?1:0)
+#define INDEX(x,thr) (((x)>=(thr))?1:0)
#define BLKSIZE 8
#define MBSIZE 16
#define DERING_THR 16
diff --git a/media/libstagefright/codecs/m4v_h263/dec/src/vlc_decode.h b/media/libstagefright/codecs/m4v_h263/dec/src/vlc_decode.h
index a804606..e242820 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/src/vlc_decode.h
+++ b/media/libstagefright/codecs/m4v_h263/dec/src/vlc_decode.h
@@ -79,10 +79,10 @@
#include "mp4lib_int.h"
#define VLC_ERROR_DETECTED(x) ((x) < 0)
-#define VLC_IO_ERROR -1
-#define VLC_CODE_ERROR -2
-#define VLC_MB_STUFFING -4
-#define VLC_NO_LAST_BIT -5
+#define VLC_IO_ERROR (-1)
+#define VLC_CODE_ERROR (-2)
+#define VLC_MB_STUFFING (-4)
+#define VLC_NO_LAST_BIT (-5)
#define VLC_ESCAPE_CODE 7167
diff --git a/media/libstagefright/codecs/m4v_h263/enc/Android.mk b/media/libstagefright/codecs/m4v_h263/enc/Android.mk
index ab079e8..9f52538 100644
--- a/media/libstagefright/codecs/m4v_h263/enc/Android.mk
+++ b/media/libstagefright/codecs/m4v_h263/enc/Android.mk
@@ -65,13 +65,9 @@
LOCAL_SHARED_LIBRARIES := \
libstagefright \
- libstagefright_enc_common \
- libstagefright_foundation \
libstagefright_omx \
libutils \
liblog \
- libui
-
LOCAL_MODULE := libstagefright_soft_mpeg4enc
LOCAL_MODULE_TAGS := optional
diff --git a/media/libstagefright/codecs/m4v_h263/enc/src/fastidct.cpp b/media/libstagefright/codecs/m4v_h263/enc/src/fastidct.cpp
index 21d7427..688effc 100644
--- a/media/libstagefright/codecs/m4v_h263/enc/src/fastidct.cpp
+++ b/media/libstagefright/codecs/m4v_h263/enc/src/fastidct.cpp
@@ -55,7 +55,7 @@
}
-#define CLIP_RESULT(x) if((UInt)x > 0xFF){x = 0xFF & (~(x>>31));}
+#define CLIP_RESULT(x) if((UInt)(x) > 0xFF){(x) = 0xFF & (~((x)>>31));}
#define ADD_AND_CLIP1(x) x += (pred_word&0xFF); CLIP_RESULT(x);
#define ADD_AND_CLIP2(x) x += ((pred_word>>8)&0xFF); CLIP_RESULT(x);
#define ADD_AND_CLIP3(x) x += ((pred_word>>16)&0xFF); CLIP_RESULT(x);
diff --git a/media/libstagefright/codecs/mp3dec/src/pv_mp3dec_fxd_op_c_equivalent.h b/media/libstagefright/codecs/mp3dec/src/pv_mp3dec_fxd_op_c_equivalent.h
index ba43820..337bff0 100644
--- a/media/libstagefright/codecs/mp3dec/src/pv_mp3dec_fxd_op_c_equivalent.h
+++ b/media/libstagefright/codecs/mp3dec/src/pv_mp3dec_fxd_op_c_equivalent.h
@@ -44,9 +44,9 @@
#endif
#include "pvmp3_audio_type_defs.h"
-#define Qfmt_31(a) (Int32)((float)a*0x7FFFFFFF)
+#define Qfmt_31(a) (Int32)((float)(a)*0x7FFFFFFF)
-#define Qfmt15(x) (Int16)(x*((Int32)1<<15) + (x>=0?0.5F:-0.5F))
+#define Qfmt15(x) (Int16)((x)*((Int32)1<<15) + ((x)>=0?0.5F:-0.5F))
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_alias_reduction.cpp b/media/libstagefright/codecs/mp3dec/src/pvmp3_alias_reduction.cpp
index 32c76c6..af738ba 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_alias_reduction.cpp
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_alias_reduction.cpp
@@ -109,7 +109,7 @@
----------------------------------------------------------------------------*/
#define NUM_BUTTERFLIES 8
-#define Q31_fmt(a) (int32(double(0x7FFFFFFF)*a))
+#define Q31_fmt(a) (int32(double(0x7FFFFFFF)*(a)))
/*----------------------------------------------------------------------------
; LOCAL FUNCTION DEFINITIONS
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_16.cpp b/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_16.cpp
index a71efc4..9b9ae4b 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_16.cpp
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_16.cpp
@@ -109,7 +109,7 @@
; Include all pre-processor statements here. Include conditional
; compile variables also.
----------------------------------------------------------------------------*/
-#define Qfmt(a) (int32)(a*((int32)1<<27))
+#define Qfmt(a) (int32)((a)*((int32)1<<27))
/*----------------------------------------------------------------------------
; LOCAL FUNCTION DEFINITIONS
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_6.cpp b/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_6.cpp
index 4c5fb03..1f8018a 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_6.cpp
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_6.cpp
@@ -79,7 +79,7 @@
; Include all pre-processor statements here. Include conditional
; compile variables also.
----------------------------------------------------------------------------*/
-#define Qfmt30(a) (Int32)(a*((Int32)1<<30) + (a>=0?0.5F:-0.5F))
+#define Qfmt30(a) (Int32)((a)*((Int32)1<<30) + ((a)>=0?0.5F:-0.5F))
#define cos_pi_6 Qfmt30( 0.86602540378444f)
#define cos_2_pi_6 Qfmt30( 0.5f)
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_9.cpp b/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_9.cpp
index ce3ec64..d30ce4a 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_9.cpp
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_9.cpp
@@ -77,7 +77,7 @@
; Include all pre-processor statements here. Include conditional
; compile variables also.
----------------------------------------------------------------------------*/
-#define Qfmt31(a) (int32)(a*(0x7FFFFFFF))
+#define Qfmt31(a) (int32)((a)*(0x7FFFFFFF))
#define cos_pi_9 Qfmt31( 0.93969262078591f)
#define cos_2pi_9 Qfmt31( 0.76604444311898f)
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_dec_defs.h b/media/libstagefright/codecs/mp3dec/src/pvmp3_dec_defs.h
index 6cf8e3e..2be9ab9 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_dec_defs.h
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_dec_defs.h
@@ -53,7 +53,7 @@
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
-#define module(x, POW2) ((x)&(POW2-1))
+#define module(x, POW2) ((x)&((POW2)-1))
/*----------------------------------------------------------------------------
; DEFINES
@@ -75,7 +75,7 @@
#define MPEG_1 0
#define MPEG_2 1
#define MPEG_2_5 2
-#define INVALID_VERSION -1
+#define INVALID_VERSION (-1)
/* MPEG Header Definitions - Mode Values */
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_dequantize_sample.cpp b/media/libstagefright/codecs/mp3dec/src/pvmp3_dequantize_sample.cpp
index 69e1987..639df81 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_dequantize_sample.cpp
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_dequantize_sample.cpp
@@ -108,8 +108,8 @@
; Include all pre-processor statements here. Include conditional
; compile variables also.
----------------------------------------------------------------------------*/
-#define Q30_fmt(a)(int32(double(0x40000000)*a))
-#define Q29_fmt(a)(int32(double(0x20000000)*a))
+#define Q30_fmt(a)(int32(double(0x40000000)*(a)))
+#define Q29_fmt(a)(int32(double(0x20000000)*(a)))
/*----------------------------------------------------------------------------
; LOCAL FUNCTION DEFINITIONS
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_equalizer.cpp b/media/libstagefright/codecs/mp3dec/src/pvmp3_equalizer.cpp
index f4a4efb..61aef30 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_equalizer.cpp
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_equalizer.cpp
@@ -98,7 +98,7 @@
#define LEVEL_45__dB 0.005524271f
#define LEVEL_60__dB 0.000976562f
-#define Qmf31( x) (int32)(x*(float)0x7FFFFFFF)
+#define Qmf31( x) (int32)((x)*(float)0x7FFFFFFF)
/*----------------------------------------------------------------------------
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_get_scale_factors.cpp b/media/libstagefright/codecs/mp3dec/src/pvmp3_get_scale_factors.cpp
index f1a3ff8..d4a2060 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_get_scale_factors.cpp
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_get_scale_factors.cpp
@@ -86,7 +86,7 @@
; Include all pre-processor statements here. Include conditional
; compile variables also.
----------------------------------------------------------------------------*/
-#define Qfmt_28(a)(int32(double(0x10000000)*a))
+#define Qfmt_28(a)(int32(double(0x10000000)*(a)))
/*----------------------------------------------------------------------------
; LOCAL FUNCTION DEFINITIONS
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_18.h b/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_18.h
index e497aee..2f2f65c 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_18.h
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_18.h
@@ -59,9 +59,9 @@
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
-#define Qfmt(a) (Int32)(a*((Int32)1<<28) )
-#define Qfmt1(a) (Int32)(a*((Int32)0x7FFFFFFF))
-#define Qfmt2(a) (Int32)(a*((Int32)1<<27))
+#define Qfmt(a) (Int32)((a)*((Int32)1<<28) )
+#define Qfmt1(a) (Int32)((a)*((Int32)0x7FFFFFFF))
+#define Qfmt2(a) (Int32)((a)*((Int32)1<<27))
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_6.cpp b/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_6.cpp
index 6a72aad..8d80e8f 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_6.cpp
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_6.cpp
@@ -81,7 +81,7 @@
; compile variables also.
----------------------------------------------------------------------------*/
#define QFORMAT 29
-#define Qfmt29(a) (int32)(a*((int32)1<<QFORMAT) + (a>=0?0.5F:-0.5F))
+#define Qfmt29(a) (int32)((a)*((int32)1<<QFORMAT) + ((a)>=0?0.5F:-0.5F))
/*----------------------------------------------------------------------------
; LOCAL FUNCTION DEFINITIONS
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_6.h b/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_6.h
index 6ba53d7..af4f286 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_6.h
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_6.h
@@ -59,9 +59,9 @@
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
-#define Qfmt(a) (Int32)(a*((Int32)1<<28) )
-#define Qfmt1(a) (Int32)(a*((Int32)0x7FFFFFFF))
-#define Qfmt2(a) (Int32)(a*((Int32)1<<27))
+#define Qfmt(a) (Int32)((a)*((Int32)1<<28) )
+#define Qfmt1(a) (Int32)((a)*((Int32)0x7FFFFFFF))
+#define Qfmt2(a) (Int32)((a)*((Int32)1<<27))
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_mpeg2_stereo_proc.cpp b/media/libstagefright/codecs/mp3dec/src/pvmp3_mpeg2_stereo_proc.cpp
index c79062c..a70e716 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_mpeg2_stereo_proc.cpp
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_mpeg2_stereo_proc.cpp
@@ -123,7 +123,7 @@
; compile variables also.
----------------------------------------------------------------------------*/
-#define Q31_fmt(a) (int32(double(0x7FFFFFFF)*a))
+#define Q31_fmt(a) (int32(double(0x7FFFFFFF)*(a)))
/*----------------------------------------------------------------------------
; LOCAL FUNCTION DEFINITIONS
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_stereo_proc.cpp b/media/libstagefright/codecs/mp3dec/src/pvmp3_stereo_proc.cpp
index d69a46d..10edfc3 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_stereo_proc.cpp
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_stereo_proc.cpp
@@ -140,7 +140,7 @@
----------------------------------------------------------------------------*/
#define N31 31
-#define Q31_fmt(a) (int32(double(0x7FFFFFFF)*a))
+#define Q31_fmt(a) (int32(double(0x7FFFFFFF)*(a)))
/*----------------------------------------------------------------------------
; LOCAL FUNCTION DEFINITIONS
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_tables.cpp b/media/libstagefright/codecs/mp3dec/src/pvmp3_tables.cpp
index 90e524a..91113e3 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_tables.cpp
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_tables.cpp
@@ -136,7 +136,7 @@
};
-#define INV_Q31( x) (int32)(0x7FFFFFFF/(float)x - 1.0f)
+#define INV_Q31( x) (int32)(0x7FFFFFFF/(float)(x) - 1.0f)
const int32 mp3_shortwindBandWidths[9][13] =
{
@@ -161,7 +161,7 @@
};
-#define Q30_fmt(a) (int32((0x40000000)*a))
+#define Q30_fmt(a) (int32((0x40000000)*(a)))
const int32 pqmfSynthWin[(HAN_SIZE/2) + 8] =
{
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_tables.h b/media/libstagefright/codecs/mp3dec/src/pvmp3_tables.h
index b54c5bf..8f8509c 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_tables.h
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_tables.h
@@ -52,7 +52,7 @@
/*----------------------------------------------------------------------------
; DEFINES AND SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
-#define Qfmt_28(a) (int32(double(0x10000000)*a))
+#define Qfmt_28(a) (int32(double(0x10000000)*(a)))
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
diff --git a/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.h b/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.h
index 700ef5f..1921a23 100644
--- a/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.h
+++ b/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.h
@@ -49,8 +49,8 @@
/** Compute difference between start and end */
#define TIME_DIFF(start, end, diff) \
- diff = ((end.tv_sec - start.tv_sec) * 1000000) + \
- (end.tv_usec - start.tv_usec);
+ diff = (((end).tv_sec - (start).tv_sec) * 1000000) + \
+ ((end).tv_usec - (start).tv_usec);
struct SoftMPEG2 : public SoftVideoDecoderOMXComponent {
SoftMPEG2(
diff --git a/media/libstagefright/codecs/on2/enc/Android.mk b/media/libstagefright/codecs/on2/enc/Android.mk
index 1de318a..522672b 100644
--- a/media/libstagefright/codecs/on2/enc/Android.mk
+++ b/media/libstagefright/codecs/on2/enc/Android.mk
@@ -19,7 +19,6 @@
LOCAL_SHARED_LIBRARIES := \
libstagefright libstagefright_omx libstagefright_foundation libutils liblog \
- libhardware \
LOCAL_MODULE := libstagefright_soft_vpxenc
LOCAL_MODULE_TAGS := optional
diff --git a/media/libstagefright/codecs/on2/h264dec/source/H264SwDecApi.c b/media/libstagefright/codecs/on2/h264dec/source/H264SwDecApi.c
index f820dfd..a9b38e5 100644
--- a/media/libstagefright/codecs/on2/h264dec/source/H264SwDecApi.c
+++ b/media/libstagefright/codecs/on2/h264dec/source/H264SwDecApi.c
@@ -35,10 +35,12 @@
/*------------------------------------------------------------------------------
1. Include headers
------------------------------------------------------------------------------*/
-#include <log/log.h>
#include <stdlib.h>
#include <string.h>
+
+#include <log/log.h>
+
#include "basetype.h"
#include "h264bsd_container.h"
#include "H264SwDecApi.h"
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_cavlc.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_cavlc.c
index 91d78bd..422d7ba 100644
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_cavlc.c
+++ b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_cavlc.c
@@ -60,7 +60,7 @@
#define INFO(vlc) (((vlc) >> 4) & 0xF) /* 4 MSB bits contain information */
/* macro to obtain trailing ones from the coeff token information word,
* bits [5,10] */
-#define TRAILING_ONES(coeffToken) ((coeffToken>>5) & 0x3F)
+#define TRAILING_ONES(coeffToken) (((coeffToken)>>5) & 0x3F)
/* macro to obtain total coeff from the coeff token information word,
* bits [11,15] */
#define TOTAL_COEFF(coeffToken) (((coeffToken) >> 11) & 0x1F)
@@ -323,45 +323,45 @@
/* macro to initialize stream buffer cache, fills the buffer (32 bits) */
#define BUFFER_INIT(value, bits) \
{ \
- bits = 32; \
- value = h264bsdShowBits32(pStrmData); \
+ (bits) = 32; \
+ (value) = h264bsdShowBits32(pStrmData); \
}
/* macro to read numBits bits from the buffer, bits will be written to
* outVal. Refills the buffer if not enough bits left */
#define BUFFER_SHOW(value, bits, outVal, numBits) \
{ \
- if (bits < (numBits)) \
+ if ((bits) < (numBits)) \
{ \
- if(h264bsdFlushBits(pStrmData,32-bits) == END_OF_STREAM) \
+ if(h264bsdFlushBits(pStrmData,32-(bits)) == END_OF_STREAM) \
return(HANTRO_NOK); \
- value = h264bsdShowBits32(pStrmData); \
- bits = 32; \
+ (value) = h264bsdShowBits32(pStrmData); \
+ (bits) = 32; \
} \
- (outVal) = value >> (32 - (numBits)); \
+ (outVal) = (value) >> (32 - (numBits)); \
}
/* macro to flush numBits bits from the buffer */
#define BUFFER_FLUSH(value, bits, numBits) \
{ \
- value <<= (numBits); \
- bits -= (numBits); \
+ (value) <<= (numBits); \
+ (bits) -= (numBits); \
}
/* macro to read and flush numBits bits from the buffer, bits will be written
* to outVal. Refills the buffer if not enough bits left */
#define BUFFER_GET(value, bits, outVal, numBits) \
{ \
- if (bits < (numBits)) \
+ if ((bits) < (numBits)) \
{ \
- if(h264bsdFlushBits(pStrmData,32-bits) == END_OF_STREAM) \
+ if(h264bsdFlushBits(pStrmData,32-(bits)) == END_OF_STREAM) \
return(HANTRO_NOK); \
- value = h264bsdShowBits32(pStrmData); \
- bits = 32; \
+ (value) = h264bsdShowBits32(pStrmData); \
+ (bits) = 32; \
} \
- (outVal) = value >> (32 - (numBits)); \
- value <<= (numBits); \
- bits -= (numBits); \
+ (outVal) = (value) >> (32 - (numBits)); \
+ (value) <<= (numBits); \
+ (bits) -= (numBits); \
}
/*------------------------------------------------------------------------------
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_dpb.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_dpb.c
index 799bd16..bd9eee9 100644
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_dpb.c
+++ b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_dpb.c
@@ -61,6 +61,7 @@
#include "basetype.h"
#include <log/log.h>
+
/*------------------------------------------------------------------------------
2. External compiler flags
--------------------------------------------------------------------------------
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_util.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_util.h
index 9f0eb7d..f43cf82 100644
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_util.h
+++ b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_util.h
@@ -151,7 +151,7 @@
}
#define ALIGN(ptr, bytePos) \
- (ptr + ( ((bytePos - (uintptr_t)ptr) & (bytePos - 1)) / sizeof(*ptr) ))
+ ((ptr) + ( (((bytePos) - (uintptr_t)(ptr)) & ((bytePos) - 1)) / sizeof(*(ptr)) ))
extern const u32 h264bsdQpC[52];
diff --git a/media/libstagefright/filters/Android.mk b/media/libstagefright/filters/Android.mk
index 179f054..bd75a88 100644
--- a/media/libstagefright/filters/Android.mk
+++ b/media/libstagefright/filters/Android.mk
@@ -23,6 +23,8 @@
LOCAL_CFLAGS += -Wno-multichar -Werror -Wall
LOCAL_CLANG := true
+LOCAL_SHARED_LIBRARIES := libmedia
+
LOCAL_MODULE:= libstagefright_mediafilter
include $(BUILD_STATIC_LIBRARY)
diff --git a/media/libstagefright/foundation/ADebug.cpp b/media/libstagefright/foundation/ADebug.cpp
index 2c5f544..1a5b2a3 100644
--- a/media/libstagefright/foundation/ADebug.cpp
+++ b/media/libstagefright/foundation/ADebug.cpp
@@ -49,7 +49,7 @@
++current;
}
// check for :
- char *colon = strchr(current, ':');
+ const char *colon = strchr(current, ':');
// get level
char *end;
diff --git a/media/libstagefright/foundation/ALooperRoster.cpp b/media/libstagefright/foundation/ALooperRoster.cpp
index 9ed53e7..5f11fb6 100644
--- a/media/libstagefright/foundation/ALooperRoster.cpp
+++ b/media/libstagefright/foundation/ALooperRoster.cpp
@@ -34,7 +34,7 @@
}
ALooper::handler_id ALooperRoster::registerHandler(
- const sp<ALooper> looper, const sp<AHandler> &handler) {
+ const sp<ALooper> &looper, const sp<AHandler> &handler) {
Mutex::Autolock autoLock(mLock);
if (handler->id() != 0) {
diff --git a/media/libstagefright/foundation/AMessage.cpp b/media/libstagefright/foundation/AMessage.cpp
index a4583d6..1b0db33 100644
--- a/media/libstagefright/foundation/AMessage.cpp
+++ b/media/libstagefright/foundation/AMessage.cpp
@@ -17,11 +17,13 @@
#define LOG_TAG "AMessage"
//#define LOG_NDEBUG 0
//#define DUMP_STATS
-#include <cutils/log.h>
+
+#include <ctype.h>
#include "AMessage.h"
-#include <ctype.h>
+#include <binder/Parcel.h>
+#include <log/log.h>
#include "AAtomizer.h"
#include "ABuffer.h"
@@ -30,7 +32,6 @@
#include "AHandler.h"
#include "AString.h"
-#include <binder/Parcel.h>
#include <media/stagefright/foundation/hexdump.h>
namespace android {
@@ -252,7 +253,8 @@
item->u.FIELDNAME = value; \
} \
\
-bool AMessage::find##NAME(const char *name, TYPENAME *value) const { \
+/* NOLINT added to avoid incorrect warning/fix from clang.tidy */ \
+bool AMessage::find##NAME(const char *name, TYPENAME *value) const { /* NOLINT */ \
const Item *item = findItem(name, kType##NAME); \
if (item) { \
*value = item->u.FIELDNAME; \
diff --git a/media/libstagefright/foundation/ANetworkSession.cpp b/media/libstagefright/foundation/ANetworkSession.cpp
index 46314eb..f8b7b41 100644
--- a/media/libstagefright/foundation/ANetworkSession.cpp
+++ b/media/libstagefright/foundation/ANetworkSession.cpp
@@ -53,7 +53,7 @@
static const int32_t kMaxUDPRetries = 200;
struct ANetworkSession::NetworkThread : public Thread {
- NetworkThread(ANetworkSession *session);
+ explicit NetworkThread(ANetworkSession *session);
protected:
virtual ~NetworkThread();
diff --git a/media/libstagefright/foundation/Android.bp b/media/libstagefright/foundation/Android.bp
new file mode 100644
index 0000000..f7bd3f2
--- /dev/null
+++ b/media/libstagefright/foundation/Android.bp
@@ -0,0 +1,51 @@
+cc_library_shared {
+ name: "libstagefright_foundation",
+
+ srcs: [
+ "AAtomizer.cpp",
+ "ABitReader.cpp",
+ "ABuffer.cpp",
+ "ADebug.cpp",
+ "AHandler.cpp",
+ "AHierarchicalStateMachine.cpp",
+ "ALooper.cpp",
+ "ALooperRoster.cpp",
+ "AMessage.cpp",
+ "ANetworkSession.cpp",
+ "AString.cpp",
+ "AStringUtils.cpp",
+ "AWakeLock.cpp",
+ "ColorUtils.cpp",
+ "MediaBuffer.cpp",
+ "MediaBufferGroup.cpp",
+ "MetaData.cpp",
+ "ParsedMessage.cpp",
+ "base64.cpp",
+ "hexdump.cpp",
+ ],
+
+ include_dirs: ["frameworks/av/include/media/stagefright/foundation"],
+
+ shared_libs: [
+ "libbinder",
+ "libutils",
+ "libcutils",
+ "liblog",
+ "libpowermanager",
+ ],
+
+ export_shared_lib_headers: ["libbinder"],
+
+ cflags: [
+ "-Wno-multichar",
+ "-Werror",
+ "-Wall",
+ ],
+ clang: true,
+ sanitize: {
+ misc_undefined: [
+ "unsigned-integer-overflow",
+ "signed-integer-overflow",
+ ],
+ },
+}
diff --git a/media/libstagefright/foundation/Android.mk b/media/libstagefright/foundation/Android.mk
deleted file mode 100644
index 3c3ed59..0000000
--- a/media/libstagefright/foundation/Android.mk
+++ /dev/null
@@ -1,44 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- AAtomizer.cpp \
- ABitReader.cpp \
- ABuffer.cpp \
- ADebug.cpp \
- AHandler.cpp \
- AHierarchicalStateMachine.cpp \
- ALooper.cpp \
- ALooperRoster.cpp \
- AMessage.cpp \
- ANetworkSession.cpp \
- AString.cpp \
- AStringUtils.cpp \
- AWakeLock.cpp \
- ColorUtils.cpp \
- MediaBuffer.cpp \
- MediaBufferGroup.cpp \
- MetaData.cpp \
- ParsedMessage.cpp \
- base64.cpp \
- hexdump.cpp
-
-LOCAL_C_INCLUDES:= \
- frameworks/av/include/media/stagefright/foundation
-
-LOCAL_SHARED_LIBRARIES := \
- libbinder \
- libutils \
- libcutils \
- liblog \
- libpowermanager
-
-LOCAL_CFLAGS += -Wno-multichar -Werror -Wall
-LOCAL_CLANG := true
-LOCAL_SANITIZE := unsigned-integer-overflow signed-integer-overflow
-
-LOCAL_MODULE:= libstagefright_foundation
-
-
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libstagefright/http/Android.mk b/media/libstagefright/http/Android.mk
index bc71134..33b8361 100644
--- a/media/libstagefright/http/Android.mk
+++ b/media/libstagefright/http/Android.mk
@@ -13,9 +13,9 @@
$(TOP)/frameworks/base/core/jni \
LOCAL_SHARED_LIBRARIES := \
- libstagefright liblog libutils libbinder libstagefright_foundation \
- libandroid_runtime \
- libmedia
+ liblog libutils libbinder \
+ libandroid_runtime \
+ libmedia
LOCAL_MODULE:= libstagefright_http_support
diff --git a/media/libstagefright/httplive/Android.mk b/media/libstagefright/httplive/Android.mk
index f904212..2c985fc 100644
--- a/media/libstagefright/httplive/Android.mk
+++ b/media/libstagefright/httplive/Android.mk
@@ -18,6 +18,7 @@
LOCAL_SANITIZE := unsigned-integer-overflow signed-integer-overflow
LOCAL_SHARED_LIBRARIES := \
+ liblog \
libbinder \
libcrypto \
libcutils \
diff --git a/media/libstagefright/httplive/HTTPDownloader.cpp b/media/libstagefright/httplive/HTTPDownloader.cpp
index 861b85a..793695a 100644
--- a/media/libstagefright/httplive/HTTPDownloader.cpp
+++ b/media/libstagefright/httplive/HTTPDownloader.cpp
@@ -256,10 +256,6 @@
return NULL;
}
-
- if (curPlaylistHash != NULL) {
- memcpy(curPlaylistHash, hash, sizeof(hash));
- }
#endif
sp<M3UParser> playlist =
@@ -271,6 +267,13 @@
return NULL;
}
+#if defined(__ANDROID__)
+ if (curPlaylistHash != NULL) {
+
+ memcpy(curPlaylistHash, hash, sizeof(hash));
+ }
+#endif
+
return playlist;
}
diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp
index 7abc019..f673426 100644
--- a/media/libstagefright/httplive/LiveSession.cpp
+++ b/media/libstagefright/httplive/LiveSession.cpp
@@ -178,7 +178,7 @@
*shortTermBps = mShortTermEstimate;
}
- int32_t minEstimate = -1, maxEstimate = -1;
+ int64_t minEstimate = -1, maxEstimate = -1;
List<int32_t>::iterator it;
for (it = mPrevEstimates.begin(); it != mPrevEstimates.end(); it++) {
int32_t estimate = *it;
@@ -1175,7 +1175,7 @@
#endif
bool LiveSession::UriIsSameAsIndex(const AString &uri, int32_t i, bool newUri) {
- ALOGI("[timed_id3] i %d UriIsSameAsIndex newUri %s, %s", i,
+ ALOGV("[timed_id3] i %d UriIsSameAsIndex newUri %s, %s", i,
newUri ? "true" : "false",
newUri ? mStreams[i].mNewUri.c_str() : mStreams[i].mUri.c_str());
return i >= 0
diff --git a/media/libstagefright/httplive/LiveSession.h b/media/libstagefright/httplive/LiveSession.h
index b600eba..65a824e 100644
--- a/media/libstagefright/httplive/LiveSession.h
+++ b/media/libstagefright/httplive/LiveSession.h
@@ -165,7 +165,7 @@
int64_t mLastSampleDurationUs;
StreamItem()
: StreamItem("") {}
- StreamItem(const char *type)
+ explicit StreamItem(const char *type)
: mType(type),
mSeekMode(kSeekModeExactPosition) {
reset();
diff --git a/media/libstagefright/httplive/M3UParser.cpp b/media/libstagefright/httplive/M3UParser.cpp
index c04549a..71feb9a 100644
--- a/media/libstagefright/httplive/M3UParser.cpp
+++ b/media/libstagefright/httplive/M3UParser.cpp
@@ -46,7 +46,7 @@
FLAG_HAS_URI = 16,
};
- MediaGroup(Type type);
+ explicit MediaGroup(Type type);
Type type() const;
@@ -498,8 +498,8 @@
if (url[0] == '/') {
// URL is an absolute path.
- char *protocolEnd = strstr(baseURL, "//") + 2;
- char *pathStart = strchr(protocolEnd, '/');
+ const char *protocolEnd = strstr(baseURL, "//") + 2;
+ const char *pathStart = strchr(protocolEnd, '/');
if (pathStart != NULL) {
out->setTo(baseURL, pathStart - baseURL);
diff --git a/media/libstagefright/id3/Android.mk b/media/libstagefright/id3/Android.mk
index 2cfba44..bd2e459 100644
--- a/media/libstagefright/id3/Android.mk
+++ b/media/libstagefright/id3/Android.mk
@@ -8,6 +8,8 @@
LOCAL_CLANG := true
LOCAL_SANITIZE := unsigned-integer-overflow signed-integer-overflow
+LOCAL_SHARED_LIBRARIES := libmedia
+
LOCAL_MODULE := libstagefright_id3
include $(BUILD_STATIC_LIBRARY)
diff --git a/media/libstagefright/id3/ID3.cpp b/media/libstagefright/id3/ID3.cpp
index 33f79fd..a0eb630 100644
--- a/media/libstagefright/id3/ID3.cpp
+++ b/media/libstagefright/id3/ID3.cpp
@@ -534,6 +534,9 @@
}
size_t n = mFrameSize - getHeaderLength() - 1;
if (otherdata) {
+ if (n < 5) {
+ return;
+ }
// skip past the encoding, language, and the 0 separator
frameData += 4;
int32_t i = n - 4;
diff --git a/media/libstagefright/include/AMRExtractor.h b/media/libstagefright/include/AMRExtractor.h
index ba2b674..8abcb12 100644
--- a/media/libstagefright/include/AMRExtractor.h
+++ b/media/libstagefright/include/AMRExtractor.h
@@ -29,7 +29,7 @@
class AMRExtractor : public MediaExtractor {
public:
- AMRExtractor(const sp<DataSource> &source);
+ explicit AMRExtractor(const sp<DataSource> &source);
virtual size_t countTracks();
virtual sp<IMediaSource> getTrack(size_t index);
diff --git a/media/libstagefright/include/CallbackDataSource.h b/media/libstagefright/include/CallbackDataSource.h
index d2187d5..80cd1f7 100644
--- a/media/libstagefright/include/CallbackDataSource.h
+++ b/media/libstagefright/include/CallbackDataSource.h
@@ -29,7 +29,7 @@
// DataSource because it calls back to the IDataSource for data.
class CallbackDataSource : public DataSource {
public:
- CallbackDataSource(const sp<IDataSource>& iDataSource);
+ explicit CallbackDataSource(const sp<IDataSource>& iDataSource);
virtual ~CallbackDataSource();
// DataSource implementation.
@@ -59,7 +59,7 @@
// impact on time taken for filetype sniffing and metadata extraction.
class TinyCacheSource : public DataSource {
public:
- TinyCacheSource(const sp<DataSource>& source);
+ explicit TinyCacheSource(const sp<DataSource>& source);
virtual status_t initCheck() const;
virtual ssize_t readAt(off64_t offset, void* data, size_t size);
diff --git a/media/libstagefright/include/FLACExtractor.h b/media/libstagefright/include/FLACExtractor.h
index 5d030b1..51bc139 100644
--- a/media/libstagefright/include/FLACExtractor.h
+++ b/media/libstagefright/include/FLACExtractor.h
@@ -29,7 +29,7 @@
public:
// Extractor assumes ownership of source
- FLACExtractor(const sp<DataSource> &source);
+ explicit FLACExtractor(const sp<DataSource> &source);
virtual size_t countTracks();
virtual sp<IMediaSource> getTrack(size_t index);
diff --git a/media/libstagefright/include/ID3.h b/media/libstagefright/include/ID3.h
index c2c4a6d..11682f8 100644
--- a/media/libstagefright/include/ID3.h
+++ b/media/libstagefright/include/ID3.h
@@ -35,7 +35,7 @@
ID3_V2_4,
};
- ID3(const sp<DataSource> &source, bool ignoreV1 = false, off64_t offset = 0);
+ explicit ID3(const sp<DataSource> &source, bool ignoreV1 = false, off64_t offset = 0);
ID3(const uint8_t *data, size_t size, bool ignoreV1 = false);
~ID3();
diff --git a/media/libstagefright/include/MPEG2PSExtractor.h b/media/libstagefright/include/MPEG2PSExtractor.h
index c8abfb6..f5471b3 100644
--- a/media/libstagefright/include/MPEG2PSExtractor.h
+++ b/media/libstagefright/include/MPEG2PSExtractor.h
@@ -31,7 +31,7 @@
class String8;
struct MPEG2PSExtractor : public MediaExtractor {
- MPEG2PSExtractor(const sp<DataSource> &source);
+ explicit MPEG2PSExtractor(const sp<DataSource> &source);
virtual size_t countTracks();
virtual sp<IMediaSource> getTrack(size_t index);
diff --git a/media/libstagefright/include/MPEG2TSExtractor.h b/media/libstagefright/include/MPEG2TSExtractor.h
index 34b9606..93e9a4b 100644
--- a/media/libstagefright/include/MPEG2TSExtractor.h
+++ b/media/libstagefright/include/MPEG2TSExtractor.h
@@ -37,7 +37,7 @@
class String8;
struct MPEG2TSExtractor : public MediaExtractor {
- MPEG2TSExtractor(const sp<DataSource> &source);
+ explicit MPEG2TSExtractor(const sp<DataSource> &source);
virtual size_t countTracks();
virtual sp<IMediaSource> getTrack(size_t index);
diff --git a/media/libstagefright/include/MPEG4Extractor.h b/media/libstagefright/include/MPEG4Extractor.h
index 836cb08..89ad137 100644
--- a/media/libstagefright/include/MPEG4Extractor.h
+++ b/media/libstagefright/include/MPEG4Extractor.h
@@ -50,7 +50,7 @@
class MPEG4Extractor : public MediaExtractor {
public:
// Extractor assumes ownership of "source".
- MPEG4Extractor(const sp<DataSource> &source);
+ explicit MPEG4Extractor(const sp<DataSource> &source);
virtual size_t countTracks();
virtual sp<IMediaSource> getTrack(size_t index);
diff --git a/media/libstagefright/include/MidiExtractor.h b/media/libstagefright/include/MidiExtractor.h
index 5a7d90e..94d2d08 100644
--- a/media/libstagefright/include/MidiExtractor.h
+++ b/media/libstagefright/include/MidiExtractor.h
@@ -53,7 +53,7 @@
public:
// Extractor assumes ownership of source
- MidiExtractor(const sp<DataSource> &source);
+ explicit MidiExtractor(const sp<DataSource> &source);
virtual size_t countTracks();
virtual sp<IMediaSource> getTrack(size_t index);
diff --git a/media/libstagefright/include/OMXNodeInstance.h b/media/libstagefright/include/OMXNodeInstance.h
index 94cf15a..6411267 100644
--- a/media/libstagefright/include/OMXNodeInstance.h
+++ b/media/libstagefright/include/OMXNodeInstance.h
@@ -257,10 +257,10 @@
OMX::buffer_id buffer, OMX_BUFFERHEADERTYPE *header, bool updateCodecBuffer);
status_t createGraphicBufferSource(
- OMX_U32 portIndex, sp<IGraphicBufferConsumer> consumer /* nullable */,
+ OMX_U32 portIndex, const sp<IGraphicBufferConsumer> &consumer /* nullable */,
MetadataBufferType *type);
sp<GraphicBufferSource> getGraphicBufferSource();
- void setGraphicBufferSource(const sp<GraphicBufferSource>& bufferSource);
+ void setGraphicBufferSource(const sp<GraphicBufferSource> &bufferSource);
// Handles |msg|, and may modify it. Returns true iff completely handled it and
// |msg| does not need to be sent to the event listener.
diff --git a/media/libstagefright/include/OggExtractor.h b/media/libstagefright/include/OggExtractor.h
index 592c264..55aafed 100644
--- a/media/libstagefright/include/OggExtractor.h
+++ b/media/libstagefright/include/OggExtractor.h
@@ -31,7 +31,7 @@
struct OggSource;
struct OggExtractor : public MediaExtractor {
- OggExtractor(const sp<DataSource> &source);
+ explicit OggExtractor(const sp<DataSource> &source);
virtual size_t countTracks();
virtual sp<IMediaSource> getTrack(size_t index);
diff --git a/media/libstagefright/include/SampleIterator.h b/media/libstagefright/include/SampleIterator.h
index 2ef41ae..6a3fd3b 100644
--- a/media/libstagefright/include/SampleIterator.h
+++ b/media/libstagefright/include/SampleIterator.h
@@ -25,7 +25,7 @@
class SampleTable;
struct SampleIterator {
- SampleIterator(SampleTable *table);
+ explicit SampleIterator(SampleTable *table);
status_t seekTo(uint32_t sampleIndex);
diff --git a/media/libstagefright/include/SampleTable.h b/media/libstagefright/include/SampleTable.h
index 2100ca6..eb1a674 100644
--- a/media/libstagefright/include/SampleTable.h
+++ b/media/libstagefright/include/SampleTable.h
@@ -32,7 +32,7 @@
class SampleTable : public RefBase {
public:
- SampleTable(const sp<DataSource> &source);
+ explicit SampleTable(const sp<DataSource> &source);
bool isValid() const;
diff --git a/media/libstagefright/include/WAVExtractor.h b/media/libstagefright/include/WAVExtractor.h
index 91ee870..12ad441 100644
--- a/media/libstagefright/include/WAVExtractor.h
+++ b/media/libstagefright/include/WAVExtractor.h
@@ -30,7 +30,7 @@
class WAVExtractor : public MediaExtractor {
public:
// Extractor assumes ownership of "source".
- WAVExtractor(const sp<DataSource> &source);
+ explicit WAVExtractor(const sp<DataSource> &source);
virtual size_t countTracks();
virtual sp<IMediaSource> getTrack(size_t index);
diff --git a/media/libstagefright/include/WVMExtractor.h b/media/libstagefright/include/WVMExtractor.h
index 5b91072..65cb99a 100644
--- a/media/libstagefright/include/WVMExtractor.h
+++ b/media/libstagefright/include/WVMExtractor.h
@@ -43,7 +43,7 @@
class WVMExtractor : public MediaExtractor {
public:
- WVMExtractor(const sp<DataSource> &source);
+ explicit WVMExtractor(const sp<DataSource> &source);
virtual size_t countTracks();
virtual sp<IMediaSource> getTrack(size_t index);
diff --git a/media/libstagefright/include/avc_utils.h b/media/libstagefright/include/avc_utils.h
index 235ee63..b2ef360 100644
--- a/media/libstagefright/include/avc_utils.h
+++ b/media/libstagefright/include/avc_utils.h
@@ -37,8 +37,8 @@
};
struct NALPosition {
- size_t nalOffset;
- size_t nalSize;
+ uint32_t nalOffset;
+ uint32_t nalSize;
};
// Optionally returns sample aspect ratio as well.
diff --git a/media/libstagefright/matroska/Android.mk b/media/libstagefright/matroska/Android.mk
index b0cbf08..89d7ff2 100644
--- a/media/libstagefright/matroska/Android.mk
+++ b/media/libstagefright/matroska/Android.mk
@@ -13,6 +13,8 @@
LOCAL_CLANG := true
LOCAL_SANITIZE := unsigned-integer-overflow signed-integer-overflow
+LOCAL_SHARED_LIBRARIES := libmedia
+
LOCAL_MODULE:= libstagefright_matroska
include $(BUILD_STATIC_LIBRARY)
diff --git a/media/libstagefright/matroska/MatroskaExtractor.cpp b/media/libstagefright/matroska/MatroskaExtractor.cpp
index 0f9430e..8e82486 100644
--- a/media/libstagefright/matroska/MatroskaExtractor.cpp
+++ b/media/libstagefright/matroska/MatroskaExtractor.cpp
@@ -40,7 +40,7 @@
namespace android {
struct DataSourceReader : public mkvparser::IMkvReader {
- DataSourceReader(const sp<DataSource> &source)
+ explicit DataSourceReader(const sp<DataSource> &source)
: mSource(source) {
}
diff --git a/media/libstagefright/matroska/MatroskaExtractor.h b/media/libstagefright/matroska/MatroskaExtractor.h
index 665e68e..588bd39 100644
--- a/media/libstagefright/matroska/MatroskaExtractor.h
+++ b/media/libstagefright/matroska/MatroskaExtractor.h
@@ -34,7 +34,7 @@
struct MatroskaSource;
struct MatroskaExtractor : public MediaExtractor {
- MatroskaExtractor(const sp<DataSource> &source);
+ explicit MatroskaExtractor(const sp<DataSource> &source);
virtual size_t countTracks();
diff --git a/media/libstagefright/mpeg2ts/ATSParser.h b/media/libstagefright/mpeg2ts/ATSParser.h
index 9d9102d..2b166f0 100644
--- a/media/libstagefright/mpeg2ts/ATSParser.h
+++ b/media/libstagefright/mpeg2ts/ATSParser.h
@@ -64,7 +64,7 @@
// Event is used to signal sync point event at feedTSPacket().
struct SyncEvent {
- SyncEvent(off64_t offset);
+ explicit SyncEvent(off64_t offset);
void init(off64_t offset, const sp<MediaSource> &source,
int64_t timeUs);
@@ -89,7 +89,7 @@
int64_t mTimeUs;
};
- ATSParser(uint32_t flags = 0);
+ explicit ATSParser(uint32_t flags = 0);
// Feed a TS packet into the parser. uninitialized event with the start
// offset of this TS packet goes in, and if the parser detects PES with
diff --git a/media/libstagefright/mpeg2ts/Android.mk b/media/libstagefright/mpeg2ts/Android.mk
index 70afde9..66722a8 100644
--- a/media/libstagefright/mpeg2ts/Android.mk
+++ b/media/libstagefright/mpeg2ts/Android.mk
@@ -17,6 +17,8 @@
LOCAL_CLANG := true
LOCAL_SANITIZE := unsigned-integer-overflow signed-integer-overflow
+LOCAL_SHARED_LIBRARIES := libmedia
+
LOCAL_MODULE:= libstagefright_mpeg2ts
ifeq ($(TARGET_ARCH),arm)
diff --git a/media/libstagefright/mpeg2ts/AnotherPacketSource.h b/media/libstagefright/mpeg2ts/AnotherPacketSource.h
index 28a0e89..dd6849e 100644
--- a/media/libstagefright/mpeg2ts/AnotherPacketSource.h
+++ b/media/libstagefright/mpeg2ts/AnotherPacketSource.h
@@ -30,7 +30,7 @@
struct ABuffer;
struct AnotherPacketSource : public MediaSource {
- AnotherPacketSource(const sp<MetaData> &meta);
+ explicit AnotherPacketSource(const sp<MetaData> &meta);
void setFormat(const sp<MetaData> &meta);
diff --git a/media/libstagefright/mpeg2ts/ESQueue.h b/media/libstagefright/mpeg2ts/ESQueue.h
index e9f96b7..56f0706 100644
--- a/media/libstagefright/mpeg2ts/ESQueue.h
+++ b/media/libstagefright/mpeg2ts/ESQueue.h
@@ -44,7 +44,7 @@
// Data appended to the queue is always at access unit boundaries.
kFlag_AlignedData = 1,
};
- ElementaryStreamQueue(Mode mode, uint32_t flags = 0);
+ explicit ElementaryStreamQueue(Mode mode, uint32_t flags = 0);
status_t appendData(const void *data, size_t size, int64_t timeUs);
void signalEOS();
diff --git a/media/libstagefright/omx/Android.mk b/media/libstagefright/omx/Android.mk
index e4fbd81..8cbfc0d 100644
--- a/media/libstagefright/omx/Android.mk
+++ b/media/libstagefright/omx/Android.mk
@@ -21,7 +21,6 @@
LOCAL_SHARED_LIBRARIES := \
libbinder \
- libhardware \
libmedia \
libutils \
liblog \
diff --git a/media/libstagefright/omx/GraphicBufferSource.cpp b/media/libstagefright/omx/GraphicBufferSource.cpp
index 0c4056d..267f24d 100644
--- a/media/libstagefright/omx/GraphicBufferSource.cpp
+++ b/media/libstagefright/omx/GraphicBufferSource.cpp
@@ -939,11 +939,12 @@
* frameNum: frame number of the frame being released
* buffer: GraphicBuffer pointer to release (note this must not be & as we
* will clear the original mBufferSlot in persistent case)
+ * Use NOLINT to supress warning on the copy of 'buffer'.
* fence: fence of the frame being released
*/
void GraphicBufferSource::releaseBuffer(
int &id, uint64_t frameNum,
- const sp<GraphicBuffer> buffer, const sp<Fence> &fence) {
+ const sp<GraphicBuffer> buffer, const sp<Fence> &fence) { // NOLINT
ALOGV("releaseBuffer: slot=%d", id);
if (mIsPersistent) {
mConsumer->detachBuffer(id);
diff --git a/media/libstagefright/omx/OMX.cpp b/media/libstagefright/omx/OMX.cpp
index 2e989b5..f7058d7 100644
--- a/media/libstagefright/omx/OMX.cpp
+++ b/media/libstagefright/omx/OMX.cpp
@@ -48,7 +48,7 @@
// Note that deriving CallbackDispatcher from Thread does not work.
struct OMX::CallbackDispatcherThread : public Thread {
- CallbackDispatcherThread(CallbackDispatcher *dispatcher)
+ explicit CallbackDispatcherThread(CallbackDispatcher *dispatcher)
: mDispatcher(dispatcher) {
}
@@ -64,7 +64,7 @@
////////////////////////////////////////////////////////////////////////////////
struct OMX::CallbackDispatcher : public RefBase {
- CallbackDispatcher(OMXNodeInstance *owner);
+ explicit CallbackDispatcher(OMXNodeInstance *owner);
// Posts |msg| to the listener's queue. If |realTime| is true, the listener thread is notified
// that a new message is available on the queue. Otherwise, the message stays on the queue, but
diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp
index 43a50ae..355a2dd 100644
--- a/media/libstagefright/omx/OMXNodeInstance.cpp
+++ b/media/libstagefright/omx/OMXNodeInstance.cpp
@@ -93,7 +93,7 @@
namespace android {
struct BufferMeta {
- BufferMeta(
+ explicit BufferMeta(
const sp<IMemory> &mem, OMX_U32 portIndex, bool copyToOmx,
bool copyFromOmx, OMX_U8 *backup)
: mMem(mem),
@@ -103,7 +103,7 @@
mBackup(backup) {
}
- BufferMeta(size_t size, OMX_U32 portIndex)
+ explicit BufferMeta(size_t size, OMX_U32 portIndex)
: mSize(size),
mCopyFromOmx(false),
mCopyToOmx(false),
@@ -111,7 +111,7 @@
mBackup(NULL) {
}
- BufferMeta(const sp<GraphicBuffer> &graphicBuffer, OMX_U32 portIndex)
+ explicit BufferMeta(const sp<GraphicBuffer> &graphicBuffer, OMX_U32 portIndex)
: mGraphicBuffer(graphicBuffer),
mCopyFromOmx(false),
mCopyToOmx(false),
@@ -1060,7 +1060,7 @@
}
status_t OMXNodeInstance::createGraphicBufferSource(
- OMX_U32 portIndex, sp<IGraphicBufferConsumer> bufferConsumer, MetadataBufferType *type) {
+ OMX_U32 portIndex, const sp<IGraphicBufferConsumer> &bufferConsumer, MetadataBufferType *type) {
status_t err;
// only allow graphic source on input port, when there are no allocated buffers yet
diff --git a/media/libstagefright/rtsp/AAVCAssembler.h b/media/libstagefright/rtsp/AAVCAssembler.h
index bf389ec..e19480c 100644
--- a/media/libstagefright/rtsp/AAVCAssembler.h
+++ b/media/libstagefright/rtsp/AAVCAssembler.h
@@ -29,7 +29,7 @@
struct AMessage;
struct AAVCAssembler : public ARTPAssembler {
- AAVCAssembler(const sp<AMessage> ¬ify);
+ explicit AAVCAssembler(const sp<AMessage> ¬ify);
protected:
virtual ~AAVCAssembler();
diff --git a/media/libstagefright/rtsp/AH263Assembler.h b/media/libstagefright/rtsp/AH263Assembler.h
index 2b6c625..1448661 100644
--- a/media/libstagefright/rtsp/AH263Assembler.h
+++ b/media/libstagefright/rtsp/AH263Assembler.h
@@ -29,7 +29,7 @@
struct AMessage;
struct AH263Assembler : public ARTPAssembler {
- AH263Assembler(const sp<AMessage> ¬ify);
+ explicit AH263Assembler(const sp<AMessage> ¬ify);
protected:
virtual ~AH263Assembler();
diff --git a/media/libstagefright/rtsp/ARTPConnection.h b/media/libstagefright/rtsp/ARTPConnection.h
index edbcc35..d5f7c2e 100644
--- a/media/libstagefright/rtsp/ARTPConnection.h
+++ b/media/libstagefright/rtsp/ARTPConnection.h
@@ -32,7 +32,7 @@
kRegularlyRequestFIR = 2,
};
- ARTPConnection(uint32_t flags = 0);
+ explicit ARTPConnection(uint32_t flags = 0);
void addStream(
int rtpSocket, int rtcpSocket,
diff --git a/media/libstagefright/rtsp/ARTPWriter.h b/media/libstagefright/rtsp/ARTPWriter.h
index 62abd0a..3c7042e 100644
--- a/media/libstagefright/rtsp/ARTPWriter.h
+++ b/media/libstagefright/rtsp/ARTPWriter.h
@@ -35,7 +35,7 @@
class MediaBuffer;
struct ARTPWriter : public MediaWriter {
- ARTPWriter(int fd);
+ explicit ARTPWriter(int fd);
virtual status_t addSource(const sp<IMediaSource> &source);
virtual bool reachedEOS();
diff --git a/media/libstagefright/rtsp/ARTSPConnection.h b/media/libstagefright/rtsp/ARTSPConnection.h
index 1fe9c99..8df2676 100644
--- a/media/libstagefright/rtsp/ARTSPConnection.h
+++ b/media/libstagefright/rtsp/ARTSPConnection.h
@@ -33,7 +33,7 @@
};
struct ARTSPConnection : public AHandler {
- ARTSPConnection(bool uidValid = false, uid_t uid = 0);
+ explicit ARTSPConnection(bool uidValid = false, uid_t uid = 0);
void connect(const char *url, const sp<AMessage> &reply);
void disconnect(const sp<AMessage> &reply);
diff --git a/media/libstagefright/rtsp/Android.mk b/media/libstagefright/rtsp/Android.mk
index bdda19c..35301ce 100644
--- a/media/libstagefright/rtsp/Android.mk
+++ b/media/libstagefright/rtsp/Android.mk
@@ -19,7 +19,7 @@
ASessionDescription.cpp \
SDPLoader.cpp \
-LOCAL_SHARED_LIBRARIES += libcrypto
+LOCAL_SHARED_LIBRARIES += libcrypto libmedia
LOCAL_C_INCLUDES:= \
$(TOP)/frameworks/av/media/libstagefright \
diff --git a/media/libstagefright/tests/DummyRecorder.h b/media/libstagefright/tests/DummyRecorder.h
index cd4d0ee..0759777 100644
--- a/media/libstagefright/tests/DummyRecorder.h
+++ b/media/libstagefright/tests/DummyRecorder.h
@@ -43,7 +43,7 @@
// static function to wrap the actual thread entry point
static void *threadWrapper(void *pthis);
- DummyRecorder(const sp<MediaSource> &source) : mSource(source)
+ explicit DummyRecorder(const sp<MediaSource> &source) : mSource(source)
, mStarted(false) {}
~DummyRecorder( ) {}
diff --git a/media/libstagefright/tests/MediaCodecListOverrides_test.cpp b/media/libstagefright/tests/MediaCodecListOverrides_test.cpp
index ab547be..2599608 100644
--- a/media/libstagefright/tests/MediaCodecListOverrides_test.cpp
+++ b/media/libstagefright/tests/MediaCodecListOverrides_test.cpp
@@ -74,11 +74,11 @@
void verifyProfileResults(const KeyedVector<AString, CodecSettings> &results) {
EXPECT_LT(0u, results.size());
for (size_t i = 0; i < results.size(); ++i) {
- AString key = results.keyAt(i);
- CodecSettings settings = results.valueAt(i);
+ const AString &key = results.keyAt(i);
+ const CodecSettings &settings = results.valueAt(i);
EXPECT_EQ(1u, settings.size());
EXPECT_TRUE(settings.keyAt(0) == "max-supported-instances");
- AString valueS = settings.valueAt(0);
+ const AString &valueS = settings.valueAt(0);
int32_t value = strtol(valueS.c_str(), NULL, 10);
EXPECT_LT(0, value);
ALOGV("profileCodecs results %s %s", key.c_str(), valueS.c_str());
diff --git a/media/libstagefright/tests/SurfaceMediaSource_test.cpp b/media/libstagefright/tests/SurfaceMediaSource_test.cpp
index ad1e684..d419133 100644
--- a/media/libstagefright/tests/SurfaceMediaSource_test.cpp
+++ b/media/libstagefright/tests/SurfaceMediaSource_test.cpp
@@ -593,7 +593,7 @@
struct SimpleDummyRecorder {
sp<MediaSource> mSource;
- SimpleDummyRecorder
+ explicit SimpleDummyRecorder
(const sp<MediaSource> &source): mSource(source) {}
status_t start() { return mSource->start();}
diff --git a/media/libstagefright/timedtext/Android.mk b/media/libstagefright/timedtext/Android.mk
index f2c6365..8d128b8 100644
--- a/media/libstagefright/timedtext/Android.mk
+++ b/media/libstagefright/timedtext/Android.mk
@@ -12,6 +12,8 @@
$(TOP)/frameworks/av/include/media/stagefright/timedtext \
$(TOP)/frameworks/av/media/libstagefright
+LOCAL_SHARED_LIBRARIES := libmedia
+
LOCAL_MODULE:= libstagefright_timedtext
include $(BUILD_STATIC_LIBRARY)
diff --git a/media/libstagefright/webm/WebmElement.h b/media/libstagefright/webm/WebmElement.h
index 4e90793..ffbba1b 100644
--- a/media/libstagefright/webm/WebmElement.h
+++ b/media/libstagefright/webm/WebmElement.h
@@ -114,14 +114,14 @@
struct EbmlVoid : public WebmElement {
const uint64_t mSizeWidth;
- EbmlVoid(uint64_t totalSize);
+ explicit EbmlVoid(uint64_t totalSize);
int serializePayloadSize(uint8_t *buf);
void serializePayload(uint8_t *buf);
};
struct WebmMaster : public WebmElement {
const List<sp<WebmElement> > mChildren;
- WebmMaster(uint64_t id);
+ explicit WebmMaster(uint64_t id);
WebmMaster(uint64_t id, const List<sp<WebmElement> > &children);
int serializePayloadSize(uint8_t *buf);
void serializePayload(uint8_t *buf);
diff --git a/media/libstagefright/webm/WebmWriter.cpp b/media/libstagefright/webm/WebmWriter.cpp
index e58964d..25d6821 100644
--- a/media/libstagefright/webm/WebmWriter.cpp
+++ b/media/libstagefright/webm/WebmWriter.cpp
@@ -493,7 +493,7 @@
}
sp<WebmElement> elems[] = { ebml, segment, seekHead, info, tracks, cues };
- size_t nElems = sizeof(elems) / sizeof(elems[0]);
+ static const size_t nElems = sizeof(elems) / sizeof(elems[0]);
uint64_t offsets[nElems];
uint64_t sizes[nElems];
for (uint32_t i = 0; i < nElems; i++) {
diff --git a/media/libstagefright/webm/WebmWriter.h b/media/libstagefright/webm/WebmWriter.h
index dd1fba3..9f3b19f 100644
--- a/media/libstagefright/webm/WebmWriter.h
+++ b/media/libstagefright/webm/WebmWriter.h
@@ -36,7 +36,7 @@
class WebmWriter : public MediaWriter {
public:
- WebmWriter(int fd);
+ explicit WebmWriter(int fd);
~WebmWriter() { reset(); }
diff --git a/media/libstagefright/wifi-display/Android.mk b/media/libstagefright/wifi-display/Android.mk
index ae4ac90..c87875d 100644
--- a/media/libstagefright/wifi-display/Android.mk
+++ b/media/libstagefright/wifi-display/Android.mk
@@ -24,7 +24,6 @@
libbinder \
libcutils \
liblog \
- libgui \
libmedia \
libstagefright \
libstagefright_foundation \
diff --git a/media/libstagefright/wifi-display/rtp/RTPSender.cpp b/media/libstagefright/wifi-display/rtp/RTPSender.cpp
index c66a898..83af393 100644
--- a/media/libstagefright/wifi-display/rtp/RTPSender.cpp
+++ b/media/libstagefright/wifi-display/rtp/RTPSender.cpp
@@ -762,10 +762,16 @@
return OK;
}
-status_t RTPSender::parseAPP(const uint8_t *data, size_t size __unused) {
- if (!memcmp("late", &data[8], 4)) {
- int64_t avgLatencyUs = (int64_t)U64_AT(&data[12]);
- int64_t maxLatencyUs = (int64_t)U64_AT(&data[20]);
+status_t RTPSender::parseAPP(const uint8_t *data, size_t size) {
+ static const size_t late_offset = 8;
+ static const char late_string[] = "late";
+ static const size_t avgLatencyUs_offset = late_offset + sizeof(late_string) - 1;
+ static const size_t maxLatencyUs_offset = avgLatencyUs_offset + sizeof(int64_t);
+
+ if ((size >= (maxLatencyUs_offset + sizeof(int64_t)))
+ && !memcmp(late_string, &data[late_offset], sizeof(late_string) - 1)) {
+ int64_t avgLatencyUs = (int64_t)U64_AT(&data[avgLatencyUs_offset]);
+ int64_t maxLatencyUs = (int64_t)U64_AT(&data[maxLatencyUs_offset]);
sp<AMessage> notify = mNotify->dup();
notify->setInt32("what", kWhatInformSender);
diff --git a/media/libstagefright/wifi-display/source/TSPacketizer.h b/media/libstagefright/wifi-display/source/TSPacketizer.h
index 4a664ee..0dcb179 100644
--- a/media/libstagefright/wifi-display/source/TSPacketizer.h
+++ b/media/libstagefright/wifi-display/source/TSPacketizer.h
@@ -36,7 +36,7 @@
EMIT_HDCP20_DESCRIPTOR = 1,
EMIT_HDCP21_DESCRIPTOR = 2,
};
- TSPacketizer(uint32_t flags);
+ explicit TSPacketizer(uint32_t flags);
// Returns trackIndex or error.
ssize_t addTrack(const sp<AMessage> &format);
diff --git a/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp b/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp
index e26165e..f0a4ded 100644
--- a/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp
+++ b/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp
@@ -782,7 +782,7 @@
return;
}
- char *commaPos = strchr(s, ',');
+ const char *commaPos = strchr(s, ',');
if (commaPos != NULL) {
s = commaPos + 1;
@@ -1669,7 +1669,7 @@
}
struct WifiDisplaySource::HDCPObserver : public BnHDCPObserver {
- HDCPObserver(const sp<AMessage> ¬ify);
+ explicit HDCPObserver(const sp<AMessage> ¬ify);
virtual void notify(
int msg, int ext1, int ext2, const Parcel *obj);
diff --git a/media/libstagefright/yuv/Android.mk b/media/libstagefright/yuv/Android.mk
deleted file mode 100644
index f2fd3be..0000000
--- a/media/libstagefright/yuv/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- YUVImage.cpp \
- YUVCanvas.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils \
- liblog
-
-LOCAL_MODULE:= libstagefright_yuv
-
-
-LOCAL_CFLAGS += -Werror -Wall
-LOCAL_CLANG := true
-LOCAL_SANITIZE := signed-integer-overflow
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libstagefright/yuv/MODULE_LICENSE_APACHE2 b/media/libstagefright/yuv/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/media/libstagefright/yuv/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/yuv/NOTICE b/media/libstagefright/yuv/NOTICE
deleted file mode 100644
index c5b1efa..0000000
--- a/media/libstagefright/yuv/NOTICE
+++ /dev/null
@@ -1,190 +0,0 @@
-
- Copyright (c) 2005-2008, 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.
-
- 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.
-
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
diff --git a/media/libstagefright/yuv/YUVCanvas.cpp b/media/libstagefright/yuv/YUVCanvas.cpp
deleted file mode 100644
index 4c9fee8..0000000
--- a/media/libstagefright/yuv/YUVCanvas.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2010 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_NDEBUG 0
-#define LOG_TAG "YUVCanvas"
-
-#include <media/stagefright/foundation/ADebug.h>
-#include <media/stagefright/YUVCanvas.h>
-#include <media/stagefright/YUVImage.h>
-#include <ui/Rect.h>
-
-namespace android {
-
-YUVCanvas::YUVCanvas(YUVImage &yuvImage)
- : mYUVImage(yuvImage) {
-}
-
-YUVCanvas::~YUVCanvas() {
-}
-
-void YUVCanvas::FillYUV(uint8_t yValue, uint8_t uValue, uint8_t vValue) {
- for (int32_t y = 0; y < mYUVImage.height(); ++y) {
- for (int32_t x = 0; x < mYUVImage.width(); ++x) {
- mYUVImage.setPixelValue(x, y, yValue, uValue, vValue);
- }
- }
-}
-
-void YUVCanvas::FillYUVRectangle(const Rect& rect,
- uint8_t yValue, uint8_t uValue, uint8_t vValue) {
- for (int32_t y = rect.top; y < rect.bottom; ++y) {
- for (int32_t x = rect.left; x < rect.right; ++x) {
- mYUVImage.setPixelValue(x, y, yValue, uValue, vValue);
- }
- }
-}
-
-void YUVCanvas::CopyImageRect(
- const Rect& srcRect,
- int32_t destStartX, int32_t destStartY,
- const YUVImage &srcImage) {
-
- // Try fast copy first
- if (YUVImage::fastCopyRectangle(
- srcRect,
- destStartX, destStartY,
- srcImage, mYUVImage)) {
- return;
- }
-
- int32_t srcStartX = srcRect.left;
- int32_t srcStartY = srcRect.top;
- for (int32_t offsetY = 0; offsetY < srcRect.height(); ++offsetY) {
- for (int32_t offsetX = 0; offsetX < srcRect.width(); ++offsetX) {
- int32_t srcX = srcStartX + offsetX;
- int32_t srcY = srcStartY + offsetY;
-
- int32_t destX = destStartX + offsetX;
- int32_t destY = destStartY + offsetY;
-
- uint8_t yValue;
- uint8_t uValue;
- uint8_t vValue;
-
- srcImage.getPixelValue(srcX, srcY, &yValue, &uValue, &vValue);
- mYUVImage.setPixelValue(destX, destY, yValue, uValue, vValue);
- }
- }
-}
-
-void YUVCanvas::downsample(
- int32_t srcOffsetX, int32_t srcOffsetY,
- int32_t skipX, int32_t skipY,
- const YUVImage &srcImage) {
- // TODO: Add a low pass filter for downsampling.
-
- // Check that srcImage is big enough to fill mYUVImage.
- CHECK((srcOffsetX + (mYUVImage.width() - 1) * skipX) < srcImage.width());
- CHECK((srcOffsetY + (mYUVImage.height() - 1) * skipY) < srcImage.height());
-
- uint8_t yValue;
- uint8_t uValue;
- uint8_t vValue;
-
- int32_t srcY = srcOffsetY;
- for (int32_t y = 0; y < mYUVImage.height(); ++y) {
- int32_t srcX = srcOffsetX;
- for (int32_t x = 0; x < mYUVImage.width(); ++x) {
- srcImage.getPixelValue(srcX, srcY, &yValue, &uValue, &vValue);
- mYUVImage.setPixelValue(x, y, yValue, uValue, vValue);
-
- srcX += skipX;
- }
- srcY += skipY;
- }
-}
-
-} // namespace android
diff --git a/media/libstagefright/yuv/YUVImage.cpp b/media/libstagefright/yuv/YUVImage.cpp
deleted file mode 100644
index c098135..0000000
--- a/media/libstagefright/yuv/YUVImage.cpp
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- * Copyright (C) 2010 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_NDEBUG 0
-#define LOG_TAG "YUVImage"
-
-#include <media/stagefright/foundation/ADebug.h>
-#include <media/stagefright/YUVImage.h>
-#include <ui/Rect.h>
-
-namespace android {
-
-YUVImage::YUVImage(YUVFormat yuvFormat, int32_t width, int32_t height) {
- mYUVFormat = yuvFormat;
- mWidth = width;
- mHeight = height;
-
- size_t numberOfBytes = bufferSize(yuvFormat, width, height);
- uint8_t *buffer = new uint8_t[numberOfBytes];
- mBuffer = buffer;
- mOwnBuffer = true;
-
- initializeYUVPointers();
-}
-
-YUVImage::YUVImage(YUVFormat yuvFormat, int32_t width, int32_t height, uint8_t *buffer) {
- mYUVFormat = yuvFormat;
- mWidth = width;
- mHeight = height;
- mBuffer = buffer;
- mOwnBuffer = false;
-
- initializeYUVPointers();
-}
-
-//static
-size_t YUVImage::bufferSize(YUVFormat yuvFormat, int32_t width, int32_t height) {
- int32_t numberOfPixels = width*height;
- size_t numberOfBytes = 0;
- if (yuvFormat == YUV420Planar || yuvFormat == YUV420SemiPlanar) {
- // Y takes numberOfPixels bytes and U/V take numberOfPixels/4 bytes each.
- numberOfBytes = (size_t)(numberOfPixels + (numberOfPixels >> 1));
- } else {
- ALOGE("Format not supported");
- }
- return numberOfBytes;
-}
-
-bool YUVImage::initializeYUVPointers() {
- int32_t numberOfPixels = mWidth * mHeight;
-
- if (mYUVFormat == YUV420Planar) {
- mYdata = (uint8_t *)mBuffer;
- mUdata = mYdata + numberOfPixels;
- mVdata = mUdata + (numberOfPixels >> 2);
- } else if (mYUVFormat == YUV420SemiPlanar) {
- // U and V channels are interleaved as VUVUVU.
- // So V data starts at the end of Y channel and
- // U data starts right after V's start.
- mYdata = (uint8_t *)mBuffer;
- mVdata = mYdata + numberOfPixels;
- mUdata = mVdata + 1;
- } else {
- ALOGE("Format not supported");
- return false;
- }
- return true;
-}
-
-YUVImage::~YUVImage() {
- if (mOwnBuffer) delete[] mBuffer;
-}
-
-bool YUVImage::getOffsets(int32_t x, int32_t y,
- int32_t *yOffset, int32_t *uOffset, int32_t *vOffset) const {
- *yOffset = y*mWidth + x;
-
- int32_t uvOffset = (y >> 1) * (mWidth >> 1) + (x >> 1);
- if (mYUVFormat == YUV420Planar) {
- *uOffset = uvOffset;
- *vOffset = uvOffset;
- } else if (mYUVFormat == YUV420SemiPlanar) {
- // Since U and V channels are interleaved, offsets need
- // to be doubled.
- *uOffset = 2*uvOffset;
- *vOffset = 2*uvOffset;
- } else {
- ALOGE("Format not supported");
- return false;
- }
-
- return true;
-}
-
-bool YUVImage::getOffsetIncrementsPerDataRow(
- int32_t *yDataOffsetIncrement,
- int32_t *uDataOffsetIncrement,
- int32_t *vDataOffsetIncrement) const {
- *yDataOffsetIncrement = mWidth;
-
- int32_t uvDataOffsetIncrement = mWidth >> 1;
-
- if (mYUVFormat == YUV420Planar) {
- *uDataOffsetIncrement = uvDataOffsetIncrement;
- *vDataOffsetIncrement = uvDataOffsetIncrement;
- } else if (mYUVFormat == YUV420SemiPlanar) {
- // Since U and V channels are interleaved, offsets need
- // to be doubled.
- *uDataOffsetIncrement = 2*uvDataOffsetIncrement;
- *vDataOffsetIncrement = 2*uvDataOffsetIncrement;
- } else {
- ALOGE("Format not supported");
- return false;
- }
-
- return true;
-}
-
-uint8_t* YUVImage::getYAddress(int32_t offset) const {
- return mYdata + offset;
-}
-
-uint8_t* YUVImage::getUAddress(int32_t offset) const {
- return mUdata + offset;
-}
-
-uint8_t* YUVImage::getVAddress(int32_t offset) const {
- return mVdata + offset;
-}
-
-bool YUVImage::getYUVAddresses(int32_t x, int32_t y,
- uint8_t **yAddr, uint8_t **uAddr, uint8_t **vAddr) const {
- int32_t yOffset;
- int32_t uOffset;
- int32_t vOffset;
- if (!getOffsets(x, y, &yOffset, &uOffset, &vOffset)) return false;
-
- *yAddr = getYAddress(yOffset);
- *uAddr = getUAddress(uOffset);
- *vAddr = getVAddress(vOffset);
-
- return true;
-}
-
-bool YUVImage::validPixel(int32_t x, int32_t y) const {
- return (x >= 0 && x < mWidth &&
- y >= 0 && y < mHeight);
-}
-
-bool YUVImage::getPixelValue(int32_t x, int32_t y,
- uint8_t *yPtr, uint8_t *uPtr, uint8_t *vPtr) const {
- CHECK(validPixel(x, y));
-
- uint8_t *yAddr;
- uint8_t *uAddr;
- uint8_t *vAddr;
- if (!getYUVAddresses(x, y, &yAddr, &uAddr, &vAddr)) return false;
-
- *yPtr = *yAddr;
- *uPtr = *uAddr;
- *vPtr = *vAddr;
-
- return true;
-}
-
-bool YUVImage::setPixelValue(int32_t x, int32_t y,
- uint8_t yValue, uint8_t uValue, uint8_t vValue) {
- CHECK(validPixel(x, y));
-
- uint8_t *yAddr;
- uint8_t *uAddr;
- uint8_t *vAddr;
- if (!getYUVAddresses(x, y, &yAddr, &uAddr, &vAddr)) return false;
-
- *yAddr = yValue;
- *uAddr = uValue;
- *vAddr = vValue;
-
- return true;
-}
-
-void YUVImage::fastCopyRectangle420Planar(
- const Rect& srcRect,
- int32_t destStartX, int32_t destStartY,
- const YUVImage &srcImage, YUVImage &destImage) {
- CHECK(srcImage.mYUVFormat == YUV420Planar);
- CHECK(destImage.mYUVFormat == YUV420Planar);
-
- int32_t srcStartX = srcRect.left;
- int32_t srcStartY = srcRect.top;
- int32_t width = srcRect.width();
- int32_t height = srcRect.height();
-
- // Get source and destination start addresses
- uint8_t *ySrcAddrBase;
- uint8_t *uSrcAddrBase;
- uint8_t *vSrcAddrBase;
- srcImage.getYUVAddresses(srcStartX, srcStartY,
- &ySrcAddrBase, &uSrcAddrBase, &vSrcAddrBase);
-
- uint8_t *yDestAddrBase;
- uint8_t *uDestAddrBase;
- uint8_t *vDestAddrBase;
- destImage.getYUVAddresses(destStartX, destStartY,
- &yDestAddrBase, &uDestAddrBase, &vDestAddrBase);
-
- // Get source and destination offset increments incurred in going
- // from one data row to next.
- int32_t ySrcOffsetIncrement;
- int32_t uSrcOffsetIncrement;
- int32_t vSrcOffsetIncrement;
- srcImage.getOffsetIncrementsPerDataRow(
- &ySrcOffsetIncrement, &uSrcOffsetIncrement, &vSrcOffsetIncrement);
-
- int32_t yDestOffsetIncrement;
- int32_t uDestOffsetIncrement = 0;
- int32_t vDestOffsetIncrement = 0;
- destImage.getOffsetIncrementsPerDataRow(
- &yDestOffsetIncrement, &uDestOffsetIncrement, &vDestOffsetIncrement);
-
- // Copy Y
- {
- size_t numberOfYBytesPerRow = (size_t) width;
- uint8_t *ySrcAddr = ySrcAddrBase;
- uint8_t *yDestAddr = yDestAddrBase;
- for (int32_t offsetY = 0; offsetY < height; ++offsetY) {
- memcpy(yDestAddr, ySrcAddr, numberOfYBytesPerRow);
-
- ySrcAddr += ySrcOffsetIncrement;
- yDestAddr += yDestOffsetIncrement;
- }
- }
-
- // Copy U
- {
- size_t numberOfUBytesPerRow = (size_t) (width >> 1);
- uint8_t *uSrcAddr = uSrcAddrBase;
- uint8_t *uDestAddr = uDestAddrBase;
- // Every other row has an entry for U/V channel values. Hence only
- // go half the height.
- for (int32_t offsetY = 0; offsetY < (height >> 1); ++offsetY) {
- memcpy(uDestAddr, uSrcAddr, numberOfUBytesPerRow);
-
- uSrcAddr += uSrcOffsetIncrement;
- uDestAddr += uDestOffsetIncrement;
- }
- }
-
- // Copy V
- {
- size_t numberOfVBytesPerRow = (size_t) (width >> 1);
- uint8_t *vSrcAddr = vSrcAddrBase;
- uint8_t *vDestAddr = vDestAddrBase;
- // Every other pixel row has a U/V data row. Hence only go half the height.
- for (int32_t offsetY = 0; offsetY < (height >> 1); ++offsetY) {
- memcpy(vDestAddr, vSrcAddr, numberOfVBytesPerRow);
-
- vSrcAddr += vSrcOffsetIncrement;
- vDestAddr += vDestOffsetIncrement;
- }
- }
-}
-
-void YUVImage::fastCopyRectangle420SemiPlanar(
- const Rect& srcRect,
- int32_t destStartX, int32_t destStartY,
- const YUVImage &srcImage, YUVImage &destImage) {
- CHECK(srcImage.mYUVFormat == YUV420SemiPlanar);
- CHECK(destImage.mYUVFormat == YUV420SemiPlanar);
-
- int32_t srcStartX = srcRect.left;
- int32_t srcStartY = srcRect.top;
- int32_t width = srcRect.width();
- int32_t height = srcRect.height();
-
- // Get source and destination start addresses
- uint8_t *ySrcAddrBase;
- uint8_t *uSrcAddrBase;
- uint8_t *vSrcAddrBase;
- srcImage.getYUVAddresses(srcStartX, srcStartY,
- &ySrcAddrBase, &uSrcAddrBase, &vSrcAddrBase);
-
- uint8_t *yDestAddrBase;
- uint8_t *uDestAddrBase;
- uint8_t *vDestAddrBase;
- destImage.getYUVAddresses(destStartX, destStartY,
- &yDestAddrBase, &uDestAddrBase, &vDestAddrBase);
-
- // Get source and destination offset increments incurred in going
- // from one data row to next.
- int32_t ySrcOffsetIncrement;
- int32_t uSrcOffsetIncrement;
- int32_t vSrcOffsetIncrement;
- srcImage.getOffsetIncrementsPerDataRow(
- &ySrcOffsetIncrement, &uSrcOffsetIncrement, &vSrcOffsetIncrement);
-
- int32_t yDestOffsetIncrement;
- int32_t uDestOffsetIncrement;
- int32_t vDestOffsetIncrement = 0;
- destImage.getOffsetIncrementsPerDataRow(
- &yDestOffsetIncrement, &uDestOffsetIncrement, &vDestOffsetIncrement);
-
- // Copy Y
- {
- size_t numberOfYBytesPerRow = (size_t) width;
- uint8_t *ySrcAddr = ySrcAddrBase;
- uint8_t *yDestAddr = yDestAddrBase;
- for (int32_t offsetY = 0; offsetY < height; ++offsetY) {
- memcpy(yDestAddr, ySrcAddr, numberOfYBytesPerRow);
-
- ySrcAddr = ySrcAddr + ySrcOffsetIncrement;
- yDestAddr = yDestAddr + yDestOffsetIncrement;
- }
- }
-
- // Copy UV
- {
- // UV are interleaved. So number of UV bytes per row is 2*(width/2).
- size_t numberOfUVBytesPerRow = (size_t) width;
- uint8_t *vSrcAddr = vSrcAddrBase;
- uint8_t *vDestAddr = vDestAddrBase;
- // Every other pixel row has a U/V data row. Hence only go half the height.
- for (int32_t offsetY = 0; offsetY < (height >> 1); ++offsetY) {
- memcpy(vDestAddr, vSrcAddr, numberOfUVBytesPerRow);
-
- vSrcAddr += vSrcOffsetIncrement;
- vDestAddr += vDestOffsetIncrement;
- }
- }
-}
-
-// static
-bool YUVImage::fastCopyRectangle(
- const Rect& srcRect,
- int32_t destStartX, int32_t destStartY,
- const YUVImage &srcImage, YUVImage &destImage) {
- if (srcImage.mYUVFormat == destImage.mYUVFormat) {
- if (srcImage.mYUVFormat == YUV420Planar) {
- fastCopyRectangle420Planar(
- srcRect,
- destStartX, destStartY,
- srcImage, destImage);
- } else if (srcImage.mYUVFormat == YUV420SemiPlanar) {
- fastCopyRectangle420SemiPlanar(
- srcRect,
- destStartX, destStartY,
- srcImage, destImage);
- }
- return true;
- }
- return false;
-}
-
-uint8_t clamp(uint8_t v, uint8_t minValue, uint8_t maxValue) {
- CHECK(maxValue >= minValue);
-
- if (v < minValue) return minValue;
- else if (v > maxValue) return maxValue;
- else return v;
-}
-
-void YUVImage::yuv2rgb(uint8_t yValue, uint8_t uValue, uint8_t vValue,
- uint8_t *r, uint8_t *g, uint8_t *b) const {
- int rTmp = yValue + (1.370705 * (vValue-128));
- int gTmp = yValue - (0.698001 * (vValue-128)) - (0.337633 * (uValue-128));
- int bTmp = yValue + (1.732446 * (uValue-128));
-
- *r = clamp(rTmp, 0, 255);
- *g = clamp(gTmp, 0, 255);
- *b = clamp(bTmp, 0, 255);
-}
-
-bool YUVImage::writeToPPM(const char *filename) const {
- FILE *fp = fopen(filename, "w");
- if (fp == NULL) {
- return false;
- }
- fprintf(fp, "P3\n");
- fprintf(fp, "%d %d\n", mWidth, mHeight);
- fprintf(fp, "255\n");
- for (int32_t y = 0; y < mHeight; ++y) {
- for (int32_t x = 0; x < mWidth; ++x) {
- uint8_t yValue = 0u;
- uint8_t uValue = 0u;
- uint8_t vValue = 0u;
- getPixelValue(x, y, &yValue, &uValue, & vValue);
-
- uint8_t rValue;
- uint8_t gValue;
- uint8_t bValue;
- yuv2rgb(yValue, uValue, vValue, &rValue, &gValue, &bValue);
-
- fprintf(fp, "%d %d %d\n", (int32_t)rValue, (int32_t)gValue, (int32_t)bValue);
- }
- }
- fclose(fp);
- return true;
-}
-
-} // namespace android
diff --git a/media/mediaserver/Android.mk b/media/mediaserver/Android.mk
index 1738df8..ffbfcbb 100644
--- a/media/mediaserver/Android.mk
+++ b/media/mediaserver/Android.mk
@@ -15,12 +15,9 @@
main_mediaserver.cpp
LOCAL_SHARED_LIBRARIES := \
- libcamera_metadata \
- libcamera_client \
- libcameraservice \
libresourcemanagerservice \
+ liblog \
libcutils \
- libmedia \
libmediaplayerservice \
libutils \
libbinder \
@@ -32,7 +29,6 @@
LOCAL_C_INCLUDES := \
frameworks/av/media/libmediaplayerservice \
- frameworks/av/services/camera/libcameraservice \
frameworks/av/services/mediaresourcemanager \
LOCAL_MODULE:= mediaserver
diff --git a/media/mtp/Android.mk b/media/mtp/Android.mk
index cb7e4aa..58753ff 100644
--- a/media/mtp/Android.mk
+++ b/media/mtp/Android.mk
@@ -19,26 +19,31 @@
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
+ AsyncIO.cpp \
MtpDataPacket.cpp \
MtpDebug.cpp \
+ MtpDevHandle.cpp \
MtpDevice.cpp \
- MtpEventPacket.cpp \
MtpDeviceInfo.cpp \
+ MtpEventPacket.cpp \
+ MtpFfsHandle.cpp \
MtpObjectInfo.cpp \
MtpPacket.cpp \
MtpProperty.cpp \
MtpRequestPacket.cpp \
MtpResponsePacket.cpp \
MtpServer.cpp \
+ MtpStorage.cpp \
MtpStorageInfo.cpp \
MtpStringBuffer.cpp \
- MtpStorage.cpp \
MtpUtils.cpp \
LOCAL_MODULE:= libmtp
LOCAL_CFLAGS := -DMTP_DEVICE -DMTP_HOST -Wall -Wextra -Werror
-LOCAL_SHARED_LIBRARIES := libutils libcutils liblog libusbhost libbinder
+LOCAL_SHARED_LIBRARIES := libbase libutils libcutils liblog libusbhost libbinder
include $(BUILD_SHARED_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/media/mtp/AsyncIO.cpp b/media/mtp/AsyncIO.cpp
new file mode 100644
index 0000000..e77ad38
--- /dev/null
+++ b/media/mtp/AsyncIO.cpp
@@ -0,0 +1,178 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include <android-base/logging.h>
+#include <condition_variable>
+#include <memory>
+#include <mutex>
+#include <queue>
+
+#include "AsyncIO.h"
+
+namespace {
+
+void read_func(struct aiocb *aiocbp) {
+ aiocbp->ret = TEMP_FAILURE_RETRY(pread(aiocbp->aio_fildes,
+ aiocbp->aio_buf, aiocbp->aio_nbytes, aiocbp->aio_offset));
+ if (aiocbp->ret == -1) aiocbp->error = errno;
+}
+
+void write_func(struct aiocb *aiocbp) {
+ aiocbp->ret = TEMP_FAILURE_RETRY(pwrite(aiocbp->aio_fildes,
+ aiocbp->aio_buf, aiocbp->aio_nbytes, aiocbp->aio_offset));
+ if (aiocbp->ret == -1) aiocbp->error = errno;
+}
+
+void splice_read_func(struct aiocb *aiocbp) {
+ loff_t long_offset = aiocbp->aio_offset;
+ aiocbp->ret = TEMP_FAILURE_RETRY(splice(aiocbp->aio_fildes,
+ &long_offset, aiocbp->aio_sink,
+ NULL, aiocbp->aio_nbytes, 0));
+ if (aiocbp->ret == -1) aiocbp->error = errno;
+}
+
+void splice_write_func(struct aiocb *aiocbp) {
+ loff_t long_offset = aiocbp->aio_offset;
+ aiocbp->ret = TEMP_FAILURE_RETRY(splice(aiocbp->aio_fildes, NULL,
+ aiocbp->aio_sink, &long_offset,
+ aiocbp->aio_nbytes, 0));
+ if (aiocbp->ret == -1) aiocbp->error = errno;
+}
+
+std::queue<std::unique_ptr<struct aiocb>> queue;
+std::mutex queue_lock;
+std::condition_variable queue_cond;
+std::condition_variable write_cond;
+int done = 1;
+void splice_write_pool_func(int) {
+ while(1) {
+ std::unique_lock<std::mutex> lk(queue_lock);
+ queue_cond.wait(lk, []{return !queue.empty() || done;});
+ if (queue.empty() && done) {
+ return;
+ }
+ std::unique_ptr<struct aiocb> aiocbp = std::move(queue.front());
+ queue.pop();
+ lk.unlock();
+ write_cond.notify_one();
+ splice_write_func(aiocbp.get());
+ close(aiocbp->aio_fildes);
+ }
+}
+
+void write_pool_func(int) {
+ while(1) {
+ std::unique_lock<std::mutex> lk(queue_lock);
+ queue_cond.wait(lk, []{return !queue.empty() || done;});
+ if (queue.empty() && done) {
+ return;
+ }
+ std::unique_ptr<struct aiocb> aiocbp = std::move(queue.front());
+ queue.pop();
+ lk.unlock();
+ write_cond.notify_one();
+ aiocbp->ret = TEMP_FAILURE_RETRY(pwrite(aiocbp->aio_fildes,
+ aiocbp->aio_pool_buf.get(), aiocbp->aio_nbytes, aiocbp->aio_offset));
+ if (aiocbp->ret == -1) aiocbp->error = errno;
+ }
+}
+
+constexpr int NUM_THREADS = 1;
+constexpr int MAX_QUEUE_SIZE = 10;
+std::thread pool[NUM_THREADS];
+
+} // end anonymous namespace
+
+void aio_pool_init(void(f)(int)) {
+ CHECK(done == 1);
+ done = 0;
+ for (int i = 0; i < NUM_THREADS; i++) {
+ pool[i] = std::thread(f, i);
+ }
+}
+
+void aio_pool_splice_init() {
+ aio_pool_init(splice_write_pool_func);
+}
+
+void aio_pool_write_init() {
+ aio_pool_init(write_pool_func);
+}
+
+void aio_pool_end() {
+ done = 1;
+ for (int i = 0; i < NUM_THREADS; i++) {
+ std::unique_lock<std::mutex> lk(queue_lock);
+ lk.unlock();
+ queue_cond.notify_one();
+ }
+
+ for (int i = 0; i < NUM_THREADS; i++) {
+ pool[i].join();
+ }
+}
+
+// used for both writes and splices depending on which init was used before.
+int aio_pool_write(struct aiocb *aiocbp) {
+ std::unique_lock<std::mutex> lk(queue_lock);
+ write_cond.wait(lk, []{return queue.size() < MAX_QUEUE_SIZE;});
+ queue.push(std::unique_ptr<struct aiocb>(aiocbp));
+ lk.unlock();
+ queue_cond.notify_one();
+ return 0;
+}
+
+int aio_read(struct aiocb *aiocbp) {
+ aiocbp->thread = std::thread(read_func, aiocbp);
+ return 0;
+}
+
+int aio_write(struct aiocb *aiocbp) {
+ aiocbp->thread = std::thread(write_func, aiocbp);
+ return 0;
+}
+
+int aio_splice_read(struct aiocb *aiocbp) {
+ aiocbp->thread = std::thread(splice_read_func, aiocbp);
+ return 0;
+}
+
+int aio_splice_write(struct aiocb *aiocbp) {
+ aiocbp->thread = std::thread(splice_write_func, aiocbp);
+ return 0;
+}
+
+int aio_error(const struct aiocb *aiocbp) {
+ return aiocbp->error;
+}
+
+ssize_t aio_return(struct aiocb *aiocbp) {
+ return aiocbp->ret;
+}
+
+int aio_suspend(struct aiocb *aiocbp[], int n,
+ const struct timespec *) {
+ for (int i = 0; i < n; i++) {
+ aiocbp[i]->thread.join();
+ }
+ return 0;
+}
+
+int aio_cancel(int, struct aiocb *) {
+ // Not implemented
+ return -1;
+}
+
diff --git a/media/mtp/AsyncIO.h b/media/mtp/AsyncIO.h
new file mode 100644
index 0000000..f7515a2
--- /dev/null
+++ b/media/mtp/AsyncIO.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2016 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 _ASYNCIO_H
+#define _ASYNCIO_H
+
+#include <fcntl.h>
+#include <linux/aio_abi.h>
+#include <memory>
+#include <signal.h>
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <time.h>
+#include <thread>
+#include <unistd.h>
+
+/**
+ * Provides a subset of POSIX aio operations, as well
+ * as similar operations with splice and threadpools.
+ */
+
+struct aiocb {
+ int aio_fildes; // Assumed to be the source for splices
+ void *aio_buf; // Unused for splices
+
+ // Used for threadpool operations only, freed automatically
+ std::unique_ptr<char[]> aio_pool_buf;
+
+ off_t aio_offset;
+ size_t aio_nbytes;
+
+ int aio_sink; // Unused for non splice r/w
+
+ // Used internally
+ std::thread thread;
+ ssize_t ret;
+ int error;
+};
+
+// Submit a request for IO to be completed
+int aio_read(struct aiocb *);
+int aio_write(struct aiocb *);
+int aio_splice_read(struct aiocb *);
+int aio_splice_write(struct aiocb *);
+
+// Suspend current thread until given IO is complete, at which point
+// its return value and any errors can be accessed
+int aio_suspend(struct aiocb *[], int, const struct timespec *);
+int aio_error(const struct aiocb *);
+ssize_t aio_return(struct aiocb *);
+int aio_cancel(int, struct aiocb *);
+
+// Initialize a threadpool to perform IO. Only one pool can be
+// running at a time.
+void aio_pool_write_init();
+void aio_pool_splice_init();
+// Suspend current thread until all queued work is complete, then ends the threadpool
+void aio_pool_end();
+// Submit IO work for the threadpool to complete. Memory associated with the work is
+// freed automatically when the work is complete.
+int aio_pool_write(struct aiocb *);
+
+#endif // ASYNCIO_H
+
diff --git a/media/mtp/IMtpHandle.h b/media/mtp/IMtpHandle.h
new file mode 100644
index 0000000..9185255
--- /dev/null
+++ b/media/mtp/IMtpHandle.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2016 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 _IMTP_HANDLE_H
+#define _IMTP_HANDLE_H
+
+#include <linux/usb/f_mtp.h>
+
+constexpr char FFS_MTP_EP0[] = "/dev/usb-ffs/mtp/ep0";
+
+class IMtpHandle {
+public:
+ // Return number of bytes read/written, or -1 and errno is set
+ virtual int read(void *data, int len) = 0;
+ virtual int write(const void *data, int len) = 0;
+
+ // Return 0 if send/receive is successful, or -1 and errno is set
+ virtual int receiveFile(mtp_file_range mfr) = 0;
+ virtual int sendFile(mtp_file_range mfr) = 0;
+ virtual int sendEvent(mtp_event me) = 0;
+
+ // Return 0 if operation is successful, or -1 else
+ virtual int start() = 0;
+ virtual int configure(bool ptp) = 0;
+
+ virtual void close() = 0;
+
+ virtual ~IMtpHandle() {}
+};
+
+IMtpHandle *get_ffs_handle();
+IMtpHandle *get_mtp_handle();
+
+#endif // _IMTP_HANDLE_H
+
diff --git a/media/mtp/MtpDataPacket.cpp b/media/mtp/MtpDataPacket.cpp
index 0e9bc34..40f4cea 100644
--- a/media/mtp/MtpDataPacket.cpp
+++ b/media/mtp/MtpDataPacket.cpp
@@ -24,6 +24,7 @@
#include <sys/types.h>
#include <usbhost/usbhost.h>
#include "MtpStringBuffer.h"
+#include "IMtpHandle.h"
namespace android {
@@ -438,9 +439,9 @@
putUInt16(0);
}
-#ifdef MTP_DEVICE
-int MtpDataPacket::read(int fd) {
- int ret = ::read(fd, mBuffer, MTP_BUFFER_SIZE);
+#ifdef MTP_DEVICE
+int MtpDataPacket::read(IMtpHandle *h) {
+ int ret = h->read(mBuffer, MTP_BUFFER_SIZE);
if (ret < MTP_CONTAINER_HEADER_SIZE)
return -1;
mPacketSize = ret;
@@ -448,20 +449,20 @@
return ret;
}
-int MtpDataPacket::write(int fd) {
+int MtpDataPacket::write(IMtpHandle *h) {
MtpPacket::putUInt32(MTP_CONTAINER_LENGTH_OFFSET, mPacketSize);
MtpPacket::putUInt16(MTP_CONTAINER_TYPE_OFFSET, MTP_CONTAINER_TYPE_DATA);
- int ret = ::write(fd, mBuffer, mPacketSize);
+ int ret = h->write(mBuffer, mPacketSize);
return (ret < 0 ? ret : 0);
}
-int MtpDataPacket::writeData(int fd, void* data, uint32_t length) {
+int MtpDataPacket::writeData(IMtpHandle *h, void* data, uint32_t length) {
allocate(length + MTP_CONTAINER_HEADER_SIZE);
memcpy(mBuffer + MTP_CONTAINER_HEADER_SIZE, data, length);
length += MTP_CONTAINER_HEADER_SIZE;
MtpPacket::putUInt32(MTP_CONTAINER_LENGTH_OFFSET, length);
MtpPacket::putUInt16(MTP_CONTAINER_TYPE_OFFSET, MTP_CONTAINER_TYPE_DATA);
- int ret = ::write(fd, mBuffer, length);
+ int ret = h->write(mBuffer, length);
return (ret < 0 ? ret : 0);
}
diff --git a/media/mtp/MtpDataPacket.h b/media/mtp/MtpDataPacket.h
index 82e0ee4..a449d6f 100644
--- a/media/mtp/MtpDataPacket.h
+++ b/media/mtp/MtpDataPacket.h
@@ -20,6 +20,7 @@
#include "MtpPacket.h"
#include "mtp.h"
+class IMtpHandle;
struct usb_device;
struct usb_request;
@@ -94,12 +95,12 @@
inline void putEmptyArray() { putUInt32(0); }
#ifdef MTP_DEVICE
- // fill our buffer with data from the given file descriptor
- int read(int fd);
+ // fill our buffer with data from the given usb handle
+ int read(IMtpHandle *h);
- // write our data to the given file descriptor
- int write(int fd);
- int writeData(int fd, void* data, uint32_t length);
+ // write our data to the given usb handle
+ int write(IMtpHandle *h);
+ int writeData(IMtpHandle *h, void* data, uint32_t length);
#endif
#ifdef MTP_HOST
diff --git a/media/mtp/MtpDevHandle.cpp b/media/mtp/MtpDevHandle.cpp
new file mode 100644
index 0000000..afc0525
--- /dev/null
+++ b/media/mtp/MtpDevHandle.cpp
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include <utils/Log.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <cutils/properties.h>
+#include <dirent.h>
+#include <errno.h>
+#include <linux/usb/ch9.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/endian.h>
+#include <unistd.h>
+
+#include <android-base/logging.h>
+#include <android-base/unique_fd.h>
+#include "IMtpHandle.h"
+
+constexpr char mtp_dev_path[] = "/dev/mtp_usb";
+
+class MtpDevHandle : public IMtpHandle {
+private:
+ android::base::unique_fd mFd;
+
+public:
+ MtpDevHandle();
+ ~MtpDevHandle();
+ int read(void *data, int len);
+ int write(const void *data, int len);
+
+ int receiveFile(mtp_file_range mfr);
+ int sendFile(mtp_file_range mfr);
+ int sendEvent(mtp_event me);
+
+ int start();
+ void close();
+
+ int configure(bool ptp);
+};
+
+MtpDevHandle::MtpDevHandle()
+ : mFd(-1) {};
+
+MtpDevHandle::~MtpDevHandle() {}
+
+int MtpDevHandle::read(void *data, int len) {
+ return ::read(mFd, data, len);
+}
+
+int MtpDevHandle::write(const void *data, int len) {
+ return ::write(mFd, data, len);
+}
+
+int MtpDevHandle::receiveFile(mtp_file_range mfr) {
+ return ioctl(mFd, MTP_RECEIVE_FILE, reinterpret_cast<unsigned long>(&mfr));
+}
+
+int MtpDevHandle::sendFile(mtp_file_range mfr) {
+ return ioctl(mFd, MTP_SEND_FILE_WITH_HEADER, reinterpret_cast<unsigned long>(&mfr));
+}
+
+int MtpDevHandle::sendEvent(mtp_event me) {
+ return ioctl(mFd, MTP_SEND_EVENT, reinterpret_cast<unsigned long>(&me));
+}
+
+int MtpDevHandle::start() {
+ mFd = android::base::unique_fd(TEMP_FAILURE_RETRY(open(mtp_dev_path, O_RDWR)));
+ if (mFd == -1) return -1;
+ return 0;
+}
+
+void MtpDevHandle::close() {
+ mFd.reset();
+}
+
+int MtpDevHandle::configure(bool) {
+ // Nothing to do, driver can configure itself
+ return 0;
+}
+
+IMtpHandle *get_mtp_handle() {
+ return new MtpDevHandle();
+}
diff --git a/media/mtp/MtpEventPacket.cpp b/media/mtp/MtpEventPacket.cpp
index 8e13ea9..fbee72f 100644
--- a/media/mtp/MtpEventPacket.cpp
+++ b/media/mtp/MtpEventPacket.cpp
@@ -19,12 +19,8 @@
#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>
-#include <sys/ioctl.h>
-#ifdef MTP_DEVICE
-#include <linux/usb/f_mtp.h>
-#endif
-
+#include "IMtpHandle.h"
#include "MtpEventPacket.h"
#include <usbhost/usbhost.h>
@@ -40,7 +36,7 @@
}
#ifdef MTP_DEVICE
-int MtpEventPacket::write(int fd) {
+int MtpEventPacket::write(IMtpHandle *h) {
struct mtp_event event;
putUInt32(MTP_CONTAINER_LENGTH_OFFSET, mPacketSize);
@@ -48,7 +44,7 @@
event.data = mBuffer;
event.length = mPacketSize;
- int ret = ::ioctl(fd, MTP_SEND_EVENT, (unsigned long)&event);
+ int ret = h->sendEvent(event);
return (ret < 0 ? ret : 0);
}
#endif
diff --git a/media/mtp/MtpEventPacket.h b/media/mtp/MtpEventPacket.h
index a8779fd..3f3b6a3 100644
--- a/media/mtp/MtpEventPacket.h
+++ b/media/mtp/MtpEventPacket.h
@@ -20,6 +20,8 @@
#include "MtpPacket.h"
#include "mtp.h"
+class IMtpHandle;
+
namespace android {
class MtpEventPacket : public MtpPacket {
@@ -29,8 +31,8 @@
virtual ~MtpEventPacket();
#ifdef MTP_DEVICE
- // write our data to the given file descriptor
- int write(int fd);
+ // write our data to the given usb handle
+ int write(IMtpHandle *h);
#endif
#ifdef MTP_HOST
diff --git a/media/mtp/MtpFfsHandle.cpp b/media/mtp/MtpFfsHandle.cpp
new file mode 100644
index 0000000..d0696a8
--- /dev/null
+++ b/media/mtp/MtpFfsHandle.cpp
@@ -0,0 +1,703 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include <android-base/logging.h>
+#include <android-base/properties.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <linux/usb/ch9.h>
+#include <linux/usb/functionfs.h>
+#include <mutex>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/endian.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <vector>
+
+#include "AsyncIO.h"
+#include "MtpFfsHandle.h"
+
+#define cpu_to_le16(x) htole16(x)
+#define cpu_to_le32(x) htole32(x)
+
+#define FUNCTIONFS_ENDPOINT_ALLOC _IOR('g', 131, __u32)
+
+namespace {
+
+constexpr char FFS_MTP_EP_IN[] = "/dev/usb-ffs/mtp/ep1";
+constexpr char FFS_MTP_EP_OUT[] = "/dev/usb-ffs/mtp/ep2";
+constexpr char FFS_MTP_EP_INTR[] = "/dev/usb-ffs/mtp/ep3";
+
+constexpr int MAX_PACKET_SIZE_FS = 64;
+constexpr int MAX_PACKET_SIZE_HS = 512;
+constexpr int MAX_PACKET_SIZE_SS = 1024;
+
+// Must be divisible by all max packet size values
+constexpr int MAX_FILE_CHUNK_SIZE = 3145728;
+
+// Safe values since some devices cannot handle large DMAs
+// To get good performance, override these with
+// higher values per device using the properties
+// sys.usb.ffs.max_read and sys.usb.ffs.max_write
+constexpr int USB_FFS_MAX_WRITE = 32768;
+constexpr int USB_FFS_MAX_READ = 32768;
+
+constexpr unsigned int MAX_MTP_FILE_SIZE = 0xFFFFFFFF;
+
+struct func_desc {
+ struct usb_interface_descriptor intf;
+ struct usb_endpoint_descriptor_no_audio sink;
+ struct usb_endpoint_descriptor_no_audio source;
+ struct usb_endpoint_descriptor_no_audio intr;
+} __attribute__((packed));
+
+struct ss_func_desc {
+ struct usb_interface_descriptor intf;
+ struct usb_endpoint_descriptor_no_audio sink;
+ struct usb_ss_ep_comp_descriptor sink_comp;
+ struct usb_endpoint_descriptor_no_audio source;
+ struct usb_ss_ep_comp_descriptor source_comp;
+ struct usb_endpoint_descriptor_no_audio intr;
+ struct usb_ss_ep_comp_descriptor intr_comp;
+} __attribute__((packed));
+
+struct desc_v1 {
+ struct usb_functionfs_descs_head_v1 {
+ __le32 magic;
+ __le32 length;
+ __le32 fs_count;
+ __le32 hs_count;
+ } __attribute__((packed)) header;
+ struct func_desc fs_descs, hs_descs;
+} __attribute__((packed));
+
+struct desc_v2 {
+ struct usb_functionfs_descs_head_v2 header;
+ // The rest of the structure depends on the flags in the header.
+ __le32 fs_count;
+ __le32 hs_count;
+ __le32 ss_count;
+ struct func_desc fs_descs, hs_descs;
+ struct ss_func_desc ss_descs;
+} __attribute__((packed));
+
+const struct usb_interface_descriptor mtp_interface_desc = {
+ .bLength = USB_DT_INTERFACE_SIZE,
+ .bDescriptorType = USB_DT_INTERFACE,
+ .bInterfaceNumber = 0,
+ .bNumEndpoints = 3,
+ .bInterfaceClass = USB_CLASS_STILL_IMAGE,
+ .bInterfaceSubClass = 1,
+ .bInterfaceProtocol = 1,
+ .iInterface = 1,
+};
+
+const struct usb_interface_descriptor ptp_interface_desc = {
+ .bLength = USB_DT_INTERFACE_SIZE,
+ .bDescriptorType = USB_DT_INTERFACE,
+ .bInterfaceNumber = 0,
+ .bNumEndpoints = 3,
+ .bInterfaceClass = USB_CLASS_STILL_IMAGE,
+ .bInterfaceSubClass = 1,
+ .bInterfaceProtocol = 1,
+};
+
+const struct usb_endpoint_descriptor_no_audio fs_sink = {
+ .bLength = USB_DT_ENDPOINT_SIZE,
+ .bDescriptorType = USB_DT_ENDPOINT,
+ .bEndpointAddress = 1 | USB_DIR_IN,
+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
+ .wMaxPacketSize = MAX_PACKET_SIZE_FS,
+};
+
+const struct usb_endpoint_descriptor_no_audio fs_source = {
+ .bLength = USB_DT_ENDPOINT_SIZE,
+ .bDescriptorType = USB_DT_ENDPOINT,
+ .bEndpointAddress = 2 | USB_DIR_OUT,
+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
+ .wMaxPacketSize = MAX_PACKET_SIZE_FS,
+};
+
+const struct usb_endpoint_descriptor_no_audio fs_intr = {
+ .bLength = USB_DT_ENDPOINT_SIZE,
+ .bDescriptorType = USB_DT_ENDPOINT,
+ .bEndpointAddress = 3 | USB_DIR_IN,
+ .bmAttributes = USB_ENDPOINT_XFER_INT,
+ .wMaxPacketSize = MAX_PACKET_SIZE_FS,
+ .bInterval = 6,
+};
+
+const struct usb_endpoint_descriptor_no_audio hs_sink = {
+ .bLength = USB_DT_ENDPOINT_SIZE,
+ .bDescriptorType = USB_DT_ENDPOINT,
+ .bEndpointAddress = 1 | USB_DIR_IN,
+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
+ .wMaxPacketSize = MAX_PACKET_SIZE_HS,
+};
+
+const struct usb_endpoint_descriptor_no_audio hs_source = {
+ .bLength = USB_DT_ENDPOINT_SIZE,
+ .bDescriptorType = USB_DT_ENDPOINT,
+ .bEndpointAddress = 2 | USB_DIR_OUT,
+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
+ .wMaxPacketSize = MAX_PACKET_SIZE_HS,
+};
+
+const struct usb_endpoint_descriptor_no_audio hs_intr = {
+ .bLength = USB_DT_ENDPOINT_SIZE,
+ .bDescriptorType = USB_DT_ENDPOINT,
+ .bEndpointAddress = 3 | USB_DIR_IN,
+ .bmAttributes = USB_ENDPOINT_XFER_INT,
+ .wMaxPacketSize = MAX_PACKET_SIZE_HS,
+ .bInterval = 6,
+};
+
+const struct usb_endpoint_descriptor_no_audio ss_sink = {
+ .bLength = USB_DT_ENDPOINT_SIZE,
+ .bDescriptorType = USB_DT_ENDPOINT,
+ .bEndpointAddress = 1 | USB_DIR_IN,
+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
+ .wMaxPacketSize = MAX_PACKET_SIZE_SS,
+};
+
+const struct usb_endpoint_descriptor_no_audio ss_source = {
+ .bLength = USB_DT_ENDPOINT_SIZE,
+ .bDescriptorType = USB_DT_ENDPOINT,
+ .bEndpointAddress = 2 | USB_DIR_OUT,
+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
+ .wMaxPacketSize = MAX_PACKET_SIZE_SS,
+};
+
+const struct usb_endpoint_descriptor_no_audio ss_intr = {
+ .bLength = USB_DT_ENDPOINT_SIZE,
+ .bDescriptorType = USB_DT_ENDPOINT,
+ .bEndpointAddress = 3 | USB_DIR_IN,
+ .bmAttributes = USB_ENDPOINT_XFER_INT,
+ .wMaxPacketSize = MAX_PACKET_SIZE_SS,
+ .bInterval = 6,
+};
+
+const struct usb_ss_ep_comp_descriptor ss_sink_comp = {
+ .bLength = sizeof(ss_sink_comp),
+ .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
+ .bMaxBurst = 2,
+};
+
+const struct usb_ss_ep_comp_descriptor ss_source_comp = {
+ .bLength = sizeof(ss_source_comp),
+ .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
+ .bMaxBurst = 2,
+};
+
+const struct usb_ss_ep_comp_descriptor ss_intr_comp = {
+ .bLength = sizeof(ss_intr_comp),
+ .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
+};
+
+const struct func_desc mtp_fs_descriptors = {
+ .intf = mtp_interface_desc,
+ .sink = fs_sink,
+ .source = fs_source,
+ .intr = fs_intr,
+};
+
+const struct func_desc mtp_hs_descriptors = {
+ .intf = mtp_interface_desc,
+ .sink = hs_sink,
+ .source = hs_source,
+ .intr = hs_intr,
+};
+
+const struct ss_func_desc mtp_ss_descriptors = {
+ .intf = mtp_interface_desc,
+ .sink = ss_sink,
+ .sink_comp = ss_sink_comp,
+ .source = ss_source,
+ .source_comp = ss_source_comp,
+ .intr = ss_intr,
+ .intr_comp = ss_intr_comp,
+};
+
+const struct func_desc ptp_fs_descriptors = {
+ .intf = ptp_interface_desc,
+ .sink = fs_sink,
+ .source = fs_source,
+ .intr = fs_intr,
+};
+
+const struct func_desc ptp_hs_descriptors = {
+ .intf = ptp_interface_desc,
+ .sink = hs_sink,
+ .source = hs_source,
+ .intr = hs_intr,
+};
+
+const struct ss_func_desc ptp_ss_descriptors = {
+ .intf = ptp_interface_desc,
+ .sink = ss_sink,
+ .sink_comp = ss_sink_comp,
+ .source = ss_source,
+ .source_comp = ss_source_comp,
+ .intr = ss_intr,
+ .intr_comp = ss_intr_comp,
+};
+
+#define STR_INTERFACE "MTP"
+const struct {
+ struct usb_functionfs_strings_head header;
+ struct {
+ __le16 code;
+ const char str1[sizeof(STR_INTERFACE)];
+ } __attribute__((packed)) lang0;
+} __attribute__((packed)) strings = {
+ .header = {
+ .magic = cpu_to_le32(FUNCTIONFS_STRINGS_MAGIC),
+ .length = cpu_to_le32(sizeof(strings)),
+ .str_count = cpu_to_le32(1),
+ .lang_count = cpu_to_le32(1),
+ },
+ .lang0 = {
+ .code = cpu_to_le16(0x0409),
+ .str1 = STR_INTERFACE,
+ },
+};
+
+} // anonymous namespace
+
+namespace android {
+
+MtpFfsHandle::MtpFfsHandle() :
+ mMaxWrite(USB_FFS_MAX_WRITE),
+ mMaxRead(USB_FFS_MAX_READ) {}
+
+MtpFfsHandle::~MtpFfsHandle() {}
+
+void MtpFfsHandle::closeEndpoints() {
+ mIntr.reset();
+ mBulkIn.reset();
+ mBulkOut.reset();
+}
+
+bool MtpFfsHandle::initFunctionfs() {
+ ssize_t ret;
+ struct desc_v1 v1_descriptor;
+ struct desc_v2 v2_descriptor;
+
+ v2_descriptor.header.magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC_V2);
+ v2_descriptor.header.length = cpu_to_le32(sizeof(v2_descriptor));
+ v2_descriptor.header.flags = FUNCTIONFS_HAS_FS_DESC | FUNCTIONFS_HAS_HS_DESC |
+ FUNCTIONFS_HAS_SS_DESC;
+ v2_descriptor.fs_count = 4;
+ v2_descriptor.hs_count = 4;
+ v2_descriptor.ss_count = 7;
+ v2_descriptor.fs_descs = mPtp ? ptp_fs_descriptors : mtp_fs_descriptors;
+ v2_descriptor.hs_descs = mPtp ? ptp_hs_descriptors : mtp_hs_descriptors;
+ v2_descriptor.ss_descs = mPtp ? ptp_ss_descriptors : mtp_ss_descriptors;
+
+ if (mControl < 0) { // might have already done this before
+ mControl.reset(TEMP_FAILURE_RETRY(open(FFS_MTP_EP0, O_RDWR)));
+ if (mControl < 0) {
+ PLOG(ERROR) << FFS_MTP_EP0 << ": cannot open control endpoint";
+ goto err;
+ }
+
+ ret = TEMP_FAILURE_RETRY(::write(mControl, &v2_descriptor, sizeof(v2_descriptor)));
+ if (ret < 0) {
+ v1_descriptor.header.magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC);
+ v1_descriptor.header.length = cpu_to_le32(sizeof(v1_descriptor));
+ v1_descriptor.header.fs_count = 4;
+ v1_descriptor.header.hs_count = 4;
+ v1_descriptor.fs_descs = mPtp ? ptp_fs_descriptors : mtp_fs_descriptors;
+ v1_descriptor.hs_descs = mPtp ? ptp_hs_descriptors : mtp_hs_descriptors;
+ PLOG(ERROR) << FFS_MTP_EP0 << "Switching to V1 descriptor format";
+ ret = TEMP_FAILURE_RETRY(::write(mControl, &v1_descriptor, sizeof(v1_descriptor)));
+ if (ret < 0) {
+ PLOG(ERROR) << FFS_MTP_EP0 << "Writing descriptors failed";
+ goto err;
+ }
+ }
+ ret = TEMP_FAILURE_RETRY(::write(mControl, &strings, sizeof(strings)));
+ if (ret < 0) {
+ PLOG(ERROR) << FFS_MTP_EP0 << "Writing strings failed";
+ goto err;
+ }
+ }
+ if (mBulkIn > -1 || mBulkOut > -1 || mIntr > -1)
+ LOG(WARNING) << "Endpoints were not closed before configure!";
+
+ mBulkIn.reset(TEMP_FAILURE_RETRY(open(FFS_MTP_EP_IN, O_RDWR)));
+ if (mBulkIn < 0) {
+ PLOG(ERROR) << FFS_MTP_EP_IN << ": cannot open bulk in ep";
+ goto err;
+ }
+
+ mBulkOut.reset(TEMP_FAILURE_RETRY(open(FFS_MTP_EP_OUT, O_RDWR)));
+ if (mBulkOut < 0) {
+ PLOG(ERROR) << FFS_MTP_EP_OUT << ": cannot open bulk out ep";
+ goto err;
+ }
+
+ mIntr.reset(TEMP_FAILURE_RETRY(open(FFS_MTP_EP_INTR, O_RDWR)));
+ if (mIntr < 0) {
+ PLOG(ERROR) << FFS_MTP_EP0 << ": cannot open intr ep";
+ goto err;
+ }
+
+ return true;
+
+err:
+ closeEndpoints();
+ closeConfig();
+ return false;
+}
+
+void MtpFfsHandle::closeConfig() {
+ mControl.reset();
+}
+
+int MtpFfsHandle::writeHandle(int fd, const void* data, int len) {
+ LOG(VERBOSE) << "MTP about to write fd = " << fd << ", len=" << len;
+ int ret = 0;
+ const char* buf = static_cast<const char*>(data);
+ while (len > 0) {
+ int write_len = std::min(mMaxWrite, len);
+ int n = TEMP_FAILURE_RETRY(::write(fd, buf, write_len));
+
+ if (n < 0) {
+ PLOG(ERROR) << "write ERROR: fd = " << fd << ", n = " << n;
+ return -1;
+ } else if (n < write_len) {
+ errno = EIO;
+ PLOG(ERROR) << "less written than expected";
+ return -1;
+ }
+ buf += n;
+ len -= n;
+ ret += n;
+ }
+ return ret;
+}
+
+int MtpFfsHandle::readHandle(int fd, void* data, int len) {
+ LOG(VERBOSE) << "MTP about to read fd = " << fd << ", len=" << len;
+ int ret = 0;
+ char* buf = static_cast<char*>(data);
+ while (len > 0) {
+ int read_len = std::min(mMaxRead, len);
+ int n = TEMP_FAILURE_RETRY(::read(fd, buf, read_len));
+ if (n < 0) {
+ PLOG(ERROR) << "read ERROR: fd = " << fd << ", n = " << n;
+ return -1;
+ }
+ ret += n;
+ if (n < read_len) // done reading early
+ break;
+ buf += n;
+ len -= n;
+ }
+ return ret;
+}
+
+int MtpFfsHandle::spliceReadHandle(int fd, int pipe_out, int len) {
+ LOG(VERBOSE) << "MTP about to splice read fd = " << fd << ", len=" << len;
+ int ret = 0;
+ loff_t dummyoff;
+ while (len > 0) {
+ int read_len = std::min(mMaxRead, len);
+ dummyoff = 0;
+ int n = TEMP_FAILURE_RETRY(splice(fd, &dummyoff, pipe_out, nullptr, read_len, 0));
+ if (n < 0) {
+ PLOG(ERROR) << "splice read ERROR: fd = " << fd << ", n = " << n;
+ return -1;
+ }
+ ret += n;
+ if (n < read_len) // done reading early
+ break;
+ len -= n;
+ }
+ return ret;
+}
+
+int MtpFfsHandle::read(void* data, int len) {
+ return readHandle(mBulkOut, data, len);
+}
+
+int MtpFfsHandle::write(const void* data, int len) {
+ return writeHandle(mBulkIn, data, len);
+}
+
+int MtpFfsHandle::start() {
+ mLock.lock();
+ return 0;
+}
+
+int MtpFfsHandle::configure(bool usePtp) {
+ // Wait till previous server invocation has closed
+ std::lock_guard<std::mutex> lk(mLock);
+
+ // If ptp is changed, the configuration must be rewritten
+ if (mPtp != usePtp) {
+ closeEndpoints();
+ closeConfig();
+ }
+ mPtp = usePtp;
+
+ if (!initFunctionfs()) {
+ return -1;
+ }
+
+ // Get device specific r/w size
+ mMaxWrite = android::base::GetIntProperty("sys.usb.ffs.max_write", 0);
+ mMaxRead = android::base::GetIntProperty("sys.usb.ffs.max_read", 0);
+ if (!mMaxWrite)
+ mMaxWrite = USB_FFS_MAX_WRITE;
+ if (!mMaxRead)
+ mMaxRead = USB_FFS_MAX_READ;
+ return 0;
+}
+
+void MtpFfsHandle::close() {
+ closeEndpoints();
+ mLock.unlock();
+}
+
+class ScopedEndpointBufferAlloc {
+private:
+ const int mFd;
+ const unsigned int mAllocSize;
+public:
+ ScopedEndpointBufferAlloc(int fd, unsigned alloc_size) :
+ mFd(fd),
+ mAllocSize(alloc_size) {
+ if (ioctl(mFd, FUNCTIONFS_ENDPOINT_ALLOC, static_cast<__u32>(mAllocSize)))
+ PLOG(DEBUG) << "FFS endpoint alloc failed!";
+ }
+
+ ~ScopedEndpointBufferAlloc() {
+ if (ioctl(mFd, FUNCTIONFS_ENDPOINT_ALLOC, static_cast<__u32>(0)))
+ PLOG(DEBUG) << "FFS endpoint alloc reset failed!";
+ }
+};
+
+/* Read from USB and write to a local file. */
+int MtpFfsHandle::receiveFile(mtp_file_range mfr) {
+ // When receiving files, the incoming length is given in 32 bits.
+ // A >4G file is given as 0xFFFFFFFF
+ uint32_t file_length = mfr.length;
+ uint64_t offset = lseek(mfr.fd, 0, SEEK_CUR);
+
+ int buf1_len = std::min(static_cast<uint32_t>(MAX_FILE_CHUNK_SIZE), file_length);
+ std::vector<char> buf1(buf1_len);
+ char* data = buf1.data();
+
+ // If necessary, allocate a second buffer for background r/w
+ int buf2_len = std::min(static_cast<uint32_t>(MAX_FILE_CHUNK_SIZE),
+ file_length - MAX_FILE_CHUNK_SIZE);
+ std::vector<char> buf2(std::max(0, buf2_len));
+ char *data2 = buf2.data();
+
+ struct aiocb aio;
+ aio.aio_fildes = mfr.fd;
+ aio.aio_buf = nullptr;
+ struct aiocb *aiol[] = {&aio};
+ int ret;
+ size_t length;
+ bool read = false;
+ bool write = false;
+
+ posix_fadvise(mfr.fd, 0, 0, POSIX_FADV_SEQUENTIAL | POSIX_FADV_NOREUSE);
+ ScopedEndpointBufferAlloc(mBulkOut, mMaxRead);
+
+ // Break down the file into pieces that fit in buffers
+ while (file_length > 0 || write) {
+ if (file_length > 0) {
+ length = std::min(static_cast<uint32_t>(MAX_FILE_CHUNK_SIZE), file_length);
+
+ // Read data from USB
+ if ((ret = readHandle(mBulkOut, data, length)) == -1) {
+ return -1;
+ }
+
+ if (file_length != MAX_MTP_FILE_SIZE && ret < static_cast<int>(length)) {
+ errno = EIO;
+ return -1;
+ }
+ read = true;
+ }
+
+ if (write) {
+ // get the return status of the last write request
+ aio_suspend(aiol, 1, nullptr);
+
+ int written = aio_return(&aio);
+ if (written == -1) {
+ errno = aio_error(&aio);
+ return -1;
+ }
+ if (static_cast<size_t>(written) < aio.aio_nbytes) {
+ errno = EIO;
+ return -1;
+ }
+ write = false;
+ }
+
+ if (read) {
+ // Enqueue a new write request
+ aio.aio_buf = data;
+ aio.aio_sink = mfr.fd;
+ aio.aio_offset = offset;
+ aio.aio_nbytes = ret;
+ aio_write(&aio);
+
+ if (file_length == MAX_MTP_FILE_SIZE) {
+ // For larger files, receive until a short packet is received.
+ if (static_cast<size_t>(ret) < length) {
+ file_length = 0;
+ }
+ } else {
+ file_length -= ret;
+ }
+
+ offset += ret;
+ std::swap(data, data2);
+
+ write = true;
+ read = false;
+ }
+ }
+ return 0;
+}
+
+/* Read from a local file and send over USB. */
+int MtpFfsHandle::sendFile(mtp_file_range mfr) {
+ uint64_t file_length = mfr.length;
+ uint32_t given_length = std::min(static_cast<uint64_t>(MAX_MTP_FILE_SIZE),
+ file_length + sizeof(mtp_data_header));
+ uint64_t offset = 0;
+ struct usb_endpoint_descriptor mBulkIn_desc;
+ int packet_size;
+
+ if (ioctl(mBulkIn, FUNCTIONFS_ENDPOINT_DESC, reinterpret_cast<unsigned long>(&mBulkIn_desc))) {
+ PLOG(ERROR) << "Could not get FFS bulk-in descriptor";
+ packet_size = MAX_PACKET_SIZE_HS;
+ } else {
+ packet_size = mBulkIn_desc.wMaxPacketSize;
+ }
+
+ posix_fadvise(mfr.fd, 0, 0, POSIX_FADV_SEQUENTIAL | POSIX_FADV_NOREUSE);
+
+ int init_read_len = packet_size - sizeof(mtp_data_header);
+ int buf1_len = std::max(static_cast<uint64_t>(packet_size), std::min(
+ static_cast<uint64_t>(MAX_FILE_CHUNK_SIZE), file_length - init_read_len));
+ std::vector<char> buf1(buf1_len);
+ char *data = buf1.data();
+
+ // If necessary, allocate a second buffer for background r/w
+ int buf2_len = std::min(static_cast<uint64_t>(MAX_FILE_CHUNK_SIZE),
+ file_length - MAX_FILE_CHUNK_SIZE - init_read_len);
+ std::vector<char> buf2(std::max(0, buf2_len));
+ char *data2 = buf2.data();
+
+ struct aiocb aio;
+ aio.aio_fildes = mfr.fd;
+ struct aiocb *aiol[] = {&aio};
+ int ret, length;
+ bool read = false;
+ bool write = false;
+
+ // Send the header data
+ mtp_data_header *header = reinterpret_cast<mtp_data_header*>(data);
+ header->length = __cpu_to_le32(given_length);
+ header->type = __cpu_to_le16(2); /* data packet */
+ header->command = __cpu_to_le16(mfr.command);
+ header->transaction_id = __cpu_to_le32(mfr.transaction_id);
+
+ // Some hosts don't support header/data separation even though MTP allows it
+ // Handle by filling first packet with initial file data
+ if (TEMP_FAILURE_RETRY(pread(mfr.fd, reinterpret_cast<char*>(data) +
+ sizeof(mtp_data_header), init_read_len, offset))
+ != init_read_len) return -1;
+ file_length -= init_read_len;
+ offset += init_read_len;
+ if (writeHandle(mBulkIn, data, packet_size) == -1) return -1;
+ if (file_length == 0) return 0;
+
+ ScopedEndpointBufferAlloc(mBulkIn, mMaxWrite);
+
+ // Break down the file into pieces that fit in buffers
+ while(file_length > 0) {
+ if (read) {
+ // Wait for the previous read to finish
+ aio_suspend(aiol, 1, nullptr);
+ ret = aio_return(&aio);
+ if (ret == -1) {
+ errno = aio_error(&aio);
+ return -1;
+ }
+ if (static_cast<size_t>(ret) < aio.aio_nbytes) {
+ errno = EIO;
+ return -1;
+ }
+
+ file_length -= ret;
+ offset += ret;
+ std::swap(data, data2);
+ read = false;
+ write = true;
+ }
+
+ if (file_length > 0) {
+ length = std::min((uint64_t) MAX_FILE_CHUNK_SIZE, file_length);
+ // Queue up another read
+ aio.aio_buf = data;
+ aio.aio_offset = offset;
+ aio.aio_nbytes = length;
+ aio_read(&aio);
+ read = true;
+ }
+
+ if (write) {
+ if (writeHandle(mBulkIn, data2, ret) == -1)
+ return -1;
+ write = false;
+ }
+ }
+
+ if (given_length == MAX_MTP_FILE_SIZE && ret % packet_size == 0) {
+ // If the last packet wasn't short, send a final empty packet
+ if (writeHandle(mBulkIn, data, 0) == -1) return -1;
+ }
+
+ return 0;
+}
+
+int MtpFfsHandle::sendEvent(mtp_event me) {
+ unsigned length = me.length;
+ int ret = writeHandle(mIntr, me.data, length);
+ return static_cast<unsigned>(ret) == length ? 0 : -1;
+}
+
+} // namespace android
+
+IMtpHandle *get_ffs_handle() {
+ return new android::MtpFfsHandle();
+}
+
diff --git a/media/mtp/MtpFfsHandle.h b/media/mtp/MtpFfsHandle.h
new file mode 100644
index 0000000..9cd4dcf
--- /dev/null
+++ b/media/mtp/MtpFfsHandle.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2016 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 _MTP_FFS_HANDLE_H
+#define _MTP_FFS_HANDLE_H
+
+#include <android-base/unique_fd.h>
+#include <IMtpHandle.h>
+
+namespace android {
+
+class MtpFfsHandleTest;
+
+class MtpFfsHandle : public IMtpHandle {
+ friend class android::MtpFfsHandleTest;
+private:
+ int writeHandle(int fd, const void *data, int len);
+ int readHandle(int fd, void *data, int len);
+ int spliceReadHandle(int fd, int fd_out, int len);
+ bool initFunctionfs();
+ void closeConfig();
+ void closeEndpoints();
+
+ bool mPtp;
+
+ std::mutex mLock;
+
+ android::base::unique_fd mControl;
+ // "in" from the host's perspective => sink for mtp server
+ android::base::unique_fd mBulkIn;
+ // "out" from the host's perspective => source for mtp server
+ android::base::unique_fd mBulkOut;
+ android::base::unique_fd mIntr;
+
+ int mMaxWrite;
+ int mMaxRead;
+
+public:
+ int read(void *data, int len);
+ int write(const void *data, int len);
+
+ int receiveFile(mtp_file_range mfr);
+ int sendFile(mtp_file_range mfr);
+ int sendEvent(mtp_event me);
+
+ int start();
+ void close();
+
+ int configure(bool ptp);
+
+ MtpFfsHandle();
+ ~MtpFfsHandle();
+};
+
+struct mtp_data_header {
+ /* length of packet, including this header */
+ __le32 length;
+ /* container type (2 for data packet) */
+ __le16 type;
+ /* MTP command code */
+ __le16 command;
+ /* MTP transaction ID */
+ __le32 transaction_id;
+};
+
+} // namespace android
+
+#endif // _MTP_FF_HANDLE_H
+
diff --git a/media/mtp/MtpObjectInfo.h b/media/mtp/MtpObjectInfo.h
index 86780f1..188f21c 100644
--- a/media/mtp/MtpObjectInfo.h
+++ b/media/mtp/MtpObjectInfo.h
@@ -47,7 +47,7 @@
char* mKeywords;
public:
- MtpObjectInfo(MtpObjectHandle handle);
+ explicit MtpObjectInfo(MtpObjectHandle handle);
virtual ~MtpObjectInfo();
bool read(MtpDataPacket& packet);
diff --git a/media/mtp/MtpPacket.h b/media/mtp/MtpPacket.h
index 0e96309..d47c91d 100644
--- a/media/mtp/MtpPacket.h
+++ b/media/mtp/MtpPacket.h
@@ -17,6 +17,8 @@
#ifndef _MTP_PACKET_H
#define _MTP_PACKET_H
+#include <android-base/macros.h>
+
#include "MtpTypes.h"
struct usb_device;
@@ -36,7 +38,7 @@
size_t mPacketSize;
public:
- MtpPacket(int bufferSize);
+ explicit MtpPacket(int bufferSize);
virtual ~MtpPacket();
// sets packet size to the default container size and sets buffer to zero
@@ -66,6 +68,8 @@
uint32_t getUInt32(int offset) const;
void putUInt16(int offset, uint16_t value);
void putUInt32(int offset, uint32_t value);
+
+ DISALLOW_COPY_AND_ASSIGN(MtpPacket);
};
}; // namespace android
diff --git a/media/mtp/MtpRequestPacket.cpp b/media/mtp/MtpRequestPacket.cpp
index 471967f..e0e86a9 100644
--- a/media/mtp/MtpRequestPacket.cpp
+++ b/media/mtp/MtpRequestPacket.cpp
@@ -20,6 +20,7 @@
#include <sys/types.h>
#include <fcntl.h>
+#include "IMtpHandle.h"
#include "MtpRequestPacket.h"
#include <usbhost/usbhost.h>
@@ -36,8 +37,8 @@
}
#ifdef MTP_DEVICE
-int MtpRequestPacket::read(int fd) {
- int ret = ::read(fd, mBuffer, mBufferSize);
+int MtpRequestPacket::read(IMtpHandle *h) {
+ int ret = h->read(mBuffer, mBufferSize);
if (ret < 0) {
// file read error
return ret;
diff --git a/media/mtp/MtpRequestPacket.h b/media/mtp/MtpRequestPacket.h
index 79b798d..d1dc0ff 100644
--- a/media/mtp/MtpRequestPacket.h
+++ b/media/mtp/MtpRequestPacket.h
@@ -20,6 +20,7 @@
#include "MtpPacket.h"
#include "mtp.h"
+class IMtpHandle;
struct usb_request;
namespace android {
@@ -31,8 +32,8 @@
virtual ~MtpRequestPacket();
#ifdef MTP_DEVICE
- // fill our buffer with data from the given file descriptor
- int read(int fd);
+ // fill our buffer with data from the given usb handle
+ int read(IMtpHandle *h);
#endif
#ifdef MTP_HOST
diff --git a/media/mtp/MtpResponsePacket.cpp b/media/mtp/MtpResponsePacket.cpp
index c2b41e4..f186b37 100644
--- a/media/mtp/MtpResponsePacket.cpp
+++ b/media/mtp/MtpResponsePacket.cpp
@@ -20,6 +20,7 @@
#include <sys/types.h>
#include <fcntl.h>
+#include "IMtpHandle.h"
#include "MtpResponsePacket.h"
#include <usbhost/usbhost.h>
@@ -35,10 +36,10 @@
}
#ifdef MTP_DEVICE
-int MtpResponsePacket::write(int fd) {
+int MtpResponsePacket::write(IMtpHandle *h) {
putUInt32(MTP_CONTAINER_LENGTH_OFFSET, mPacketSize);
putUInt16(MTP_CONTAINER_TYPE_OFFSET, MTP_CONTAINER_TYPE_RESPONSE);
- int ret = ::write(fd, mBuffer, mPacketSize);
+ int ret = h->write(mBuffer, mPacketSize);
return (ret < 0 ? ret : 0);
}
#endif
diff --git a/media/mtp/MtpResponsePacket.h b/media/mtp/MtpResponsePacket.h
index 592ad4a..29a72ba 100644
--- a/media/mtp/MtpResponsePacket.h
+++ b/media/mtp/MtpResponsePacket.h
@@ -20,6 +20,8 @@
#include "MtpPacket.h"
#include "mtp.h"
+class IMtpHandle;
+
namespace android {
class MtpResponsePacket : public MtpPacket {
@@ -29,8 +31,8 @@
virtual ~MtpResponsePacket();
#ifdef MTP_DEVICE
- // write our data to the given file descriptor
- int write(int fd);
+ // write our data to the given usb handle
+ int write(IMtpHandle *h);
#endif
#ifdef MTP_HOST
diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp
index e39dcdd..8d56c16 100644
--- a/media/mtp/MtpServer.cpp
+++ b/media/mtp/MtpServer.cpp
@@ -14,18 +14,17 @@
* limitations under the License.
*/
+#include <android-base/properties.h>
+#include <chrono>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
-#include <sys/ioctl.h>
#include <sys/stat.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
#include <sys/stat.h>
-#include <dirent.h>
-
-#include <cutils/properties.h>
#define LOG_TAG "MtpServer"
@@ -37,8 +36,6 @@
#include "MtpStorage.h"
#include "MtpStringBuffer.h"
-#include <linux/usb/f_mtp.h>
-
namespace android {
static const MtpOperationCode kSupportedOperationCodes[] = {
@@ -97,14 +94,21 @@
MTP_EVENT_DEVICE_PROP_CHANGED,
};
-MtpServer::MtpServer(int fd, MtpDatabase* database, bool ptp,
- int fileGroup, int filePerm, int directoryPerm)
- : mFD(fd),
- mDatabase(database),
+MtpServer::MtpServer(MtpDatabase* database, bool ptp,
+ int fileGroup, int filePerm, int directoryPerm,
+ const MtpString& deviceInfoManufacturer,
+ const MtpString& deviceInfoModel,
+ const MtpString& deviceInfoDeviceVersion,
+ const MtpString& deviceInfoSerialNumber)
+ : mDatabase(database),
mPtp(ptp),
mFileGroup(fileGroup),
mFilePermission(filePerm),
mDirectoryPermission(directoryPerm),
+ mDeviceInfoManufacturer(deviceInfoManufacturer),
+ mDeviceInfoModel(deviceInfoModel),
+ mDeviceInfoDeviceVersion(deviceInfoDeviceVersion),
+ mDeviceInfoSerialNumber(deviceInfoSerialNumber),
mSessionID(0),
mSessionOpen(false),
mSendObjectHandle(kInvalidObjectHandle),
@@ -116,6 +120,21 @@
MtpServer::~MtpServer() {
}
+IMtpHandle* MtpServer::sHandle = nullptr;
+
+int MtpServer::configure(bool usePtp) {
+ if (sHandle == nullptr) {
+ bool ffs_ok = access(FFS_MTP_EP0, W_OK) == 0;
+ sHandle = ffs_ok ? get_ffs_handle() : get_mtp_handle();
+ }
+
+ int ret = sHandle->configure(usePtp);
+ if (ret) ALOGE("Failed to configure MTP driver!");
+ else android::base::SetProperty("sys.usb.ffs.mtp.ready", "1");
+
+ return ret;
+}
+
void MtpServer::addStorage(MtpStorage* storage) {
Mutex::Autolock autoLock(mMutex);
@@ -143,24 +162,30 @@
if (storage->getStorageID() == id)
return storage;
}
- return NULL;
+ return nullptr;
}
bool MtpServer::hasStorage(MtpStorageID id) {
if (id == 0 || id == 0xFFFFFFFF)
return mStorages.size() > 0;
- return (getStorage(id) != NULL);
+ return (getStorage(id) != nullptr);
}
void MtpServer::run() {
- int fd = mFD;
+ if (!sHandle) {
+ ALOGE("MtpServer was never configured!");
+ return;
+ }
- ALOGV("MtpServer::run fd: %d\n", fd);
+ if (sHandle->start()) {
+ ALOGE("Failed to start usb driver!");
+ return;
+ }
while (1) {
- int ret = mRequest.read(fd);
+ int ret = mRequest.read(sHandle);
if (ret < 0) {
- ALOGV("request read returned %d, errno: %d", ret, errno);
+ ALOGE("request read returned %d, errno: %d", ret, errno);
if (errno == ECANCELED) {
// return to top of loop and wait for next command
continue;
@@ -171,15 +196,13 @@
MtpTransactionID transaction = mRequest.getTransactionID();
ALOGV("operation: %s", MtpDebug::getOperationCodeName(operation));
- mRequest.dump();
-
// FIXME need to generalize this
bool dataIn = (operation == MTP_OPERATION_SEND_OBJECT_INFO
|| operation == MTP_OPERATION_SET_OBJECT_REFERENCES
|| operation == MTP_OPERATION_SET_OBJECT_PROP_VALUE
|| operation == MTP_OPERATION_SET_DEVICE_PROP_VALUE);
if (dataIn) {
- int ret = mData.read(fd);
+ int ret = mData.read(sHandle);
if (ret < 0) {
ALOGE("data read returned %d, errno: %d", ret, errno);
if (errno == ECANCELED) {
@@ -189,7 +212,6 @@
break;
}
ALOGV("received data:");
- mData.dump();
} else {
mData.reset();
}
@@ -199,8 +221,7 @@
mData.setOperationCode(operation);
mData.setTransactionID(transaction);
ALOGV("sending data:");
- mData.dump();
- ret = mData.write(fd);
+ ret = mData.write(sHandle);
if (ret < 0) {
ALOGE("request write returned %d, errno: %d", ret, errno);
if (errno == ECANCELED) {
@@ -213,9 +234,8 @@
mResponse.setTransactionID(transaction);
ALOGV("sending response %04X", mResponse.getResponseCode());
- ret = mResponse.write(fd);
+ ret = mResponse.write(sHandle);
const int savedErrno = errno;
- mResponse.dump();
if (ret < 0) {
ALOGE("request write returned %d, errno: %d", ret, errno);
if (savedErrno == ECANCELED) {
@@ -240,8 +260,8 @@
if (mSessionOpen)
mDatabase->sessionEnded();
- close(fd);
- mFD = -1;
+
+ sHandle->close();
}
void MtpServer::sendObjectAdded(MtpObjectHandle handle) {
@@ -274,8 +294,8 @@
mEvent.setEventCode(code);
mEvent.setTransactionID(mRequest.getTransactionID());
mEvent.setParameter(1, param1);
- int ret = mEvent.write(mFD);
- ALOGV("mEvent.write returned %d\n", ret);
+ if (mEvent.write(sHandle))
+ ALOGE("Mtp send event failed: %s", strerror(errno));
}
}
@@ -291,7 +311,7 @@
ObjectEdit* edit = mObjectEditList[i];
if (edit->mHandle == handle) return edit;
}
- return NULL;
+ return nullptr;
}
void MtpServer::removeEditObject(MtpObjectHandle handle) {
@@ -438,7 +458,6 @@
MtpResponseCode MtpServer::doGetDeviceInfo() {
MtpStringBuffer string;
- char prop_value[PROPERTY_VALUE_MAX];
MtpObjectFormatList* playbackFormats = mDatabase->getSupportedPlaybackFormats();
MtpObjectFormatList* captureFormats = mDatabase->getSupportedCaptureFormats();
@@ -470,19 +489,10 @@
mData.putAUInt16(captureFormats); // Capture Formats
mData.putAUInt16(playbackFormats); // Playback Formats
- property_get("ro.product.manufacturer", prop_value, "unknown manufacturer");
- string.set(prop_value);
- mData.putString(string); // Manufacturer
-
- property_get("ro.product.model", prop_value, "MTP Device");
- string.set(prop_value);
- mData.putString(string); // Model
- string.set("1.0");
- mData.putString(string); // Device Version
-
- property_get("ro.serialno", prop_value, "????????");
- string.set(prop_value);
- mData.putString(string); // Serial Number
+ mData.putString(mDeviceInfoManufacturer); // Manufacturer
+ mData.putString(mDeviceInfoModel); // Model
+ mData.putString(mDeviceInfoDeviceVersion); // Device Version
+ mData.putString(mDeviceInfoSerialNumber); // Serial Number
delete playbackFormats;
delete captureFormats;
@@ -775,6 +785,8 @@
if (result != MTP_RESPONSE_OK)
return result;
+ auto start = std::chrono::steady_clock::now();
+
const char* filePath = (const char *)pathBuf;
mtp_file_range mfr;
mfr.fd = open(filePath, O_RDONLY);
@@ -787,8 +799,9 @@
mfr.transaction_id = mRequest.getTransactionID();
// then transfer the file
- int ret = ioctl(mFD, MTP_SEND_FILE_WITH_HEADER, (unsigned long)&mfr);
+ int ret = sHandle->sendFile(mfr);
if (ret < 0) {
+ ALOGE("Mtp send file got error %s", strerror(errno));
if (errno == ECANCELED) {
result = MTP_RESPONSE_TRANSACTION_CANCELLED;
} else {
@@ -798,7 +811,13 @@
result = MTP_RESPONSE_OK;
}
- ALOGV("MTP_SEND_FILE_WITH_HEADER returned %d\n", ret);
+ auto end = std::chrono::steady_clock::now();
+ std::chrono::duration<double> diff = end - start;
+ struct stat sstat;
+ fstat(mfr.fd, &sstat);
+ uint64_t finalsize = sstat.st_size;
+ ALOGV("Sent a file over MTP. Time: %f s, Size: %" PRIu64 ", Rate: %f bytes/s",
+ diff.count(), finalsize, ((double) finalsize) / diff.count());
close(mfr.fd);
return result;
}
@@ -813,7 +832,7 @@
// send data
mData.setOperationCode(mRequest.getOperationCode());
mData.setTransactionID(mRequest.getTransactionID());
- mData.writeData(mFD, thumb, thumbSize);
+ mData.writeData(sHandle, thumb, thumbSize);
free(thumb);
return MTP_RESPONSE_OK;
} else {
@@ -867,7 +886,7 @@
mResponse.setParameter(1, length);
// transfer the file
- int ret = ioctl(mFD, MTP_SEND_FILE_WITH_HEADER, (unsigned long)&mfr);
+ int ret = sHandle->sendFile(mfr);
ALOGV("MTP_SEND_FILE_WITH_HEADER returned %d\n", ret);
result = MTP_RESPONSE_OK;
if (ret < 0) {
@@ -995,6 +1014,8 @@
int ret, initialData;
bool isCanceled = false;
+ auto start = std::chrono::steady_clock::now();
+
if (mSendObjectHandle == kInvalidObjectHandle) {
ALOGE("Expected SendObjectInfo before SendObject");
result = MTP_RESPONSE_NO_VALID_OBJECT_INFO;
@@ -1002,7 +1023,7 @@
}
// read the header, and possibly some data
- ret = mData.read(mFD);
+ ret = mData.read(sHandle);
if (ret < MTP_CONTAINER_HEADER_SIZE) {
result = MTP_RESPONSE_GENERAL_ERROR;
goto done;
@@ -1038,19 +1059,19 @@
mfr.length = mSendObjectFileSize - initialData;
}
- ALOGV("receiving %s\n", (const char *)mSendObjectFilePath);
// transfer the file
- ret = ioctl(mFD, MTP_RECEIVE_FILE, (unsigned long)&mfr);
+ ret = sHandle->receiveFile(mfr);
if ((ret < 0) && (errno == ECANCELED)) {
isCanceled = true;
}
-
- ALOGV("MTP_RECEIVE_FILE returned %d\n", ret);
}
}
+ struct stat sstat;
+ fstat(mfr.fd, &sstat);
close(mfr.fd);
if (ret < 0) {
+ ALOGE("Mtp receive file got error %s", strerror(errno));
unlink(mSendObjectFilePath);
if (isCanceled)
result = MTP_RESPONSE_TRANSACTION_CANCELLED;
@@ -1066,6 +1087,12 @@
result == MTP_RESPONSE_OK);
mSendObjectHandle = kInvalidObjectHandle;
mSendObjectFormat = 0;
+
+ auto end = std::chrono::steady_clock::now();
+ std::chrono::duration<double> diff = end - start;
+ uint64_t finalsize = sstat.st_size;
+ ALOGV("Got a file over MTP. Time: %fs, Size: %" PRIu64 ", Rate: %f bytes/s",
+ diff.count(), finalsize, ((double) finalsize) / diff.count());
return result;
}
@@ -1209,7 +1236,7 @@
ALOGV("receiving partial %s %" PRIu64 " %" PRIu32, filePath, offset, length);
// read the header, and possibly some data
- int ret = mData.read(mFD);
+ int ret = mData.read(sHandle);
if (ret < MTP_CONTAINER_HEADER_SIZE)
return MTP_RESPONSE_GENERAL_ERROR;
int initialData = ret - MTP_CONTAINER_HEADER_SIZE;
@@ -1231,11 +1258,10 @@
mfr.length = length;
// transfer the file
- ret = ioctl(mFD, MTP_RECEIVE_FILE, (unsigned long)&mfr);
+ ret = sHandle->receiveFile(mfr);
if ((ret < 0) && (errno == ECANCELED)) {
isCanceled = true;
}
- ALOGV("MTP_RECEIVE_FILE returned %d", ret);
}
}
if (ret < 0) {
diff --git a/media/mtp/MtpServer.h b/media/mtp/MtpServer.h
index b3a11e0..64d1b72 100644
--- a/media/mtp/MtpServer.h
+++ b/media/mtp/MtpServer.h
@@ -23,8 +23,12 @@
#include "MtpEventPacket.h"
#include "mtp.h"
#include "MtpUtils.h"
+#include "IMtpHandle.h"
#include <utils/threads.h>
+#include <queue>
+#include <memory>
+#include <mutex>
namespace android {
@@ -34,9 +38,6 @@
class MtpServer {
private:
- // file descriptor for MTP kernel driver
- int mFD;
-
MtpDatabase* mDatabase;
// appear as a PTP device
@@ -48,6 +49,15 @@
int mFilePermission;
int mDirectoryPermission;
+ // Manufacturer to report in DeviceInfo
+ MtpString mDeviceInfoManufacturer;
+ // Model to report in DeviceInfo
+ MtpString mDeviceInfoModel;
+ // Device version to report in DeviceInfo
+ MtpString mDeviceInfoDeviceVersion;
+ // Serial number to report in DeviceInfo
+ MtpString mDeviceInfoSerialNumber;
+
// current session ID
MtpSessionID mSessionID;
// true if we have an open session and mSessionID is valid
@@ -56,10 +66,13 @@
MtpRequestPacket mRequest;
MtpDataPacket mData;
MtpResponsePacket mResponse;
+
MtpEventPacket mEvent;
MtpStorageList mStorages;
+ static IMtpHandle* sHandle;
+
// handle for new object, set by SendObjectInfo and used by SendObject
MtpObjectHandle mSendObjectHandle;
MtpObjectFormat mSendObjectFormat;
@@ -90,8 +103,12 @@
Vector<ObjectEdit*> mObjectEditList;
public:
- MtpServer(int fd, MtpDatabase* database, bool ptp,
- int fileGroup, int filePerm, int directoryPerm);
+ MtpServer(MtpDatabase* database, bool ptp,
+ int fileGroup, int filePerm, int directoryPerm,
+ const MtpString& deviceInfoManufacturer,
+ const MtpString& deviceInfoModel,
+ const MtpString& deviceInfoDeviceVersion,
+ const MtpString& deviceInfoSerialNumber);
virtual ~MtpServer();
MtpStorage* getStorage(MtpStorageID id);
@@ -100,6 +117,7 @@
void addStorage(MtpStorage* storage);
void removeStorage(MtpStorage* storage);
+ static int configure(bool usePtp);
void run();
void sendObjectAdded(MtpObjectHandle handle);
diff --git a/media/mtp/MtpStorageInfo.h b/media/mtp/MtpStorageInfo.h
index 35a8189..3b70675 100644
--- a/media/mtp/MtpStorageInfo.h
+++ b/media/mtp/MtpStorageInfo.h
@@ -36,7 +36,7 @@
char* mVolumeIdentifier;
public:
- MtpStorageInfo(MtpStorageID id);
+ explicit MtpStorageInfo(MtpStorageID id);
virtual ~MtpStorageInfo();
bool read(MtpDataPacket& packet);
diff --git a/media/mtp/MtpStringBuffer.h b/media/mtp/MtpStringBuffer.h
index 85d91e8..bcf2a48 100644
--- a/media/mtp/MtpStringBuffer.h
+++ b/media/mtp/MtpStringBuffer.h
@@ -38,8 +38,8 @@
public:
MtpStringBuffer();
- MtpStringBuffer(const char* src);
- MtpStringBuffer(const uint16_t* src);
+ explicit MtpStringBuffer(const char* src);
+ explicit MtpStringBuffer(const uint16_t* src);
MtpStringBuffer(const MtpStringBuffer& src);
virtual ~MtpStringBuffer();
diff --git a/media/mtp/tests/Android.mk b/media/mtp/tests/Android.mk
new file mode 100644
index 0000000..ace0d40
--- /dev/null
+++ b/media/mtp/tests/Android.mk
@@ -0,0 +1,51 @@
+# Build the unit tests.
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
+
+LOCAL_MODULE := mtp_ffs_handle_test
+
+LOCAL_MODULE_TAGS := tests
+
+LOCAL_SRC_FILES := \
+ MtpFfsHandle_test.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+ libbase \
+ libcutils \
+ libmedia \
+ libmtp \
+ libutils \
+ liblog
+
+LOCAL_C_INCLUDES := \
+ frameworks/av/media/mtp \
+
+LOCAL_CFLAGS += -Werror -Wall
+
+include $(BUILD_NATIVE_TEST)
+
+include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
+
+LOCAL_MODULE := async_io_test
+
+LOCAL_MODULE_TAGS := tests
+
+LOCAL_SRC_FILES := \
+ AsyncIO_test.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+ libbase \
+ libcutils \
+ libmedia \
+ libmtp \
+ libutils \
+ liblog
+
+LOCAL_C_INCLUDES := \
+ frameworks/av/media/mtp \
+
+LOCAL_CFLAGS += -Werror -Wall
+
+include $(BUILD_NATIVE_TEST)
diff --git a/media/mtp/tests/AsyncIO_test.cpp b/media/mtp/tests/AsyncIO_test.cpp
new file mode 100644
index 0000000..b5f4538
--- /dev/null
+++ b/media/mtp/tests/AsyncIO_test.cpp
@@ -0,0 +1,192 @@
+/*
+ * Copyright 2016 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 "AsyncIO_test.cpp"
+
+#include <android-base/test_utils.h>
+#include <fcntl.h>
+#include <gtest/gtest.h>
+#include <string>
+#include <unistd.h>
+#include <utils/Log.h>
+
+#include "AsyncIO.h"
+
+namespace android {
+
+constexpr int TEST_PACKET_SIZE = 512;
+constexpr int POOL_COUNT = 10;
+
+static const std::string dummyDataStr =
+ "/*\n * Copyright 2015 The Android Open Source Project\n *\n * Licensed un"
+ "der the Apache License, Version 2.0 (the \"License\");\n * you may not us"
+ "e this file except in compliance with the License.\n * You may obtain a c"
+ "opy of the License at\n *\n * http://www.apache.org/licenses/LICENSE"
+ "-2.0\n *\n * Unless required by applicable law or agreed to in writing, s"
+ "oftware\n * distributed under the License is distributed on an \"AS IS\" "
+ "BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express o"
+ "r implied.\n * Se";
+
+
+class AsyncIOTest : public ::testing::Test {
+protected:
+ TemporaryFile dummy_file;
+
+ AsyncIOTest() {}
+ ~AsyncIOTest() {}
+};
+
+TEST_F(AsyncIOTest, testRead) {
+ char buf[TEST_PACKET_SIZE + 1];
+ buf[TEST_PACKET_SIZE] = '\0';
+ EXPECT_EQ(write(dummy_file.fd, dummyDataStr.c_str(), TEST_PACKET_SIZE), TEST_PACKET_SIZE);
+ struct aiocb aio;
+ struct aiocb *aiol[] = {&aio};
+ aio.aio_fildes = dummy_file.fd;
+ aio.aio_buf = buf;
+ aio.aio_offset = 0;
+ aio.aio_nbytes = TEST_PACKET_SIZE;
+
+ EXPECT_EQ(aio_read(&aio), 0);
+ EXPECT_EQ(aio_suspend(aiol, 1, nullptr), 0);
+ EXPECT_EQ(aio_return(&aio), TEST_PACKET_SIZE);
+ EXPECT_STREQ(buf, dummyDataStr.c_str());
+}
+
+TEST_F(AsyncIOTest, testWrite) {
+ char buf[TEST_PACKET_SIZE + 1];
+ buf[TEST_PACKET_SIZE] = '\0';
+ struct aiocb aio;
+ struct aiocb *aiol[] = {&aio};
+ aio.aio_fildes = dummy_file.fd;
+ aio.aio_buf = const_cast<char*>(dummyDataStr.c_str());
+ aio.aio_offset = 0;
+ aio.aio_nbytes = TEST_PACKET_SIZE;
+
+ EXPECT_EQ(aio_write(&aio), 0);
+ EXPECT_EQ(aio_suspend(aiol, 1, nullptr), 0);
+ EXPECT_EQ(aio_return(&aio), TEST_PACKET_SIZE);
+ EXPECT_EQ(read(dummy_file.fd, buf, TEST_PACKET_SIZE), TEST_PACKET_SIZE);
+ EXPECT_STREQ(buf, dummyDataStr.c_str());
+}
+
+TEST_F(AsyncIOTest, testError) {
+ char buf[TEST_PACKET_SIZE + 1];
+ buf[TEST_PACKET_SIZE] = '\0';
+ struct aiocb aio;
+ struct aiocb *aiol[] = {&aio};
+ aio.aio_fildes = -1;
+ aio.aio_buf = const_cast<char*>(dummyDataStr.c_str());
+ aio.aio_offset = 0;
+ aio.aio_nbytes = TEST_PACKET_SIZE;
+
+ EXPECT_EQ(aio_write(&aio), 0);
+ EXPECT_EQ(aio_suspend(aiol, 1, nullptr), 0);
+ EXPECT_EQ(aio_return(&aio), -1);
+ EXPECT_EQ(aio_error(&aio), EBADF);
+}
+
+TEST_F(AsyncIOTest, testSpliceRead) {
+ char buf[TEST_PACKET_SIZE + 1];
+ buf[TEST_PACKET_SIZE] = '\0';
+ int pipeFd[2];
+ EXPECT_EQ(pipe(pipeFd), 0);
+ EXPECT_EQ(write(dummy_file.fd, dummyDataStr.c_str(), TEST_PACKET_SIZE), TEST_PACKET_SIZE);
+ struct aiocb aio;
+ struct aiocb *aiol[] = {&aio};
+ aio.aio_fildes = dummy_file.fd;
+ aio.aio_sink = pipeFd[1];
+ aio.aio_offset = 0;
+ aio.aio_nbytes = TEST_PACKET_SIZE;
+
+ EXPECT_EQ(aio_splice_read(&aio), 0);
+ EXPECT_EQ(aio_suspend(aiol, 1, nullptr), 0);
+ EXPECT_EQ(aio_return(&aio), TEST_PACKET_SIZE);
+
+ EXPECT_EQ(read(pipeFd[0], buf, TEST_PACKET_SIZE), TEST_PACKET_SIZE);
+ EXPECT_STREQ(buf, dummyDataStr.c_str());
+}
+
+TEST_F(AsyncIOTest, testSpliceWrite) {
+ char buf[TEST_PACKET_SIZE + 1];
+ buf[TEST_PACKET_SIZE] = '\0';
+ int pipeFd[2];
+ EXPECT_EQ(pipe(pipeFd), 0);
+ EXPECT_EQ(write(pipeFd[1], dummyDataStr.c_str(), TEST_PACKET_SIZE), TEST_PACKET_SIZE);
+ struct aiocb aio;
+ struct aiocb *aiol[] = {&aio};
+ aio.aio_fildes = pipeFd[0];
+ aio.aio_sink = dummy_file.fd;
+ aio.aio_offset = 0;
+ aio.aio_nbytes = TEST_PACKET_SIZE;
+
+ EXPECT_EQ(aio_splice_write(&aio), 0);
+ EXPECT_EQ(aio_suspend(aiol, 1, nullptr), 0);
+ EXPECT_EQ(aio_return(&aio), TEST_PACKET_SIZE);
+ EXPECT_EQ(read(dummy_file.fd, buf, TEST_PACKET_SIZE), TEST_PACKET_SIZE);
+ EXPECT_STREQ(buf, dummyDataStr.c_str());
+}
+
+TEST_F(AsyncIOTest, testPoolWrite) {
+ aio_pool_write_init();
+ char buf[TEST_PACKET_SIZE * POOL_COUNT + 1];
+ buf[TEST_PACKET_SIZE * POOL_COUNT] = '\0';
+
+ for (int i = 0; i < POOL_COUNT; i++) {
+ struct aiocb *aiop = new struct aiocb;
+ aiop->aio_fildes = dummy_file.fd;
+ aiop->aio_pool_buf = std::unique_ptr<char[]>(new char[TEST_PACKET_SIZE]);
+ memcpy(aiop->aio_pool_buf.get(), dummyDataStr.c_str(), TEST_PACKET_SIZE);
+ aiop->aio_offset = i * TEST_PACKET_SIZE;
+ aiop->aio_nbytes = TEST_PACKET_SIZE;
+ EXPECT_EQ(aio_pool_write(aiop), 0);
+ }
+ aio_pool_end();
+ EXPECT_EQ(read(dummy_file.fd, buf, TEST_PACKET_SIZE * POOL_COUNT), TEST_PACKET_SIZE * POOL_COUNT);
+
+ std::stringstream ss;
+ for (int i = 0; i < POOL_COUNT; i++)
+ ss << dummyDataStr;
+
+ EXPECT_STREQ(buf, ss.str().c_str());
+}
+
+TEST_F(AsyncIOTest, testSplicePoolWrite) {
+ aio_pool_splice_init();
+ char buf[TEST_PACKET_SIZE * POOL_COUNT + 1];
+ buf[TEST_PACKET_SIZE * POOL_COUNT] = '\0';
+
+ for (int i = 0; i < POOL_COUNT; i++) {
+ int pipeFd[2];
+ EXPECT_EQ(pipe(pipeFd), 0);
+ EXPECT_EQ(write(pipeFd[1], dummyDataStr.c_str(), TEST_PACKET_SIZE), TEST_PACKET_SIZE);
+ struct aiocb *aiop = new struct aiocb;
+ aiop->aio_fildes = pipeFd[0];
+ aiop->aio_sink = dummy_file.fd;
+ aiop->aio_offset = i * TEST_PACKET_SIZE;
+ aiop->aio_nbytes = TEST_PACKET_SIZE;
+ EXPECT_EQ(aio_pool_write(aiop), 0);
+ }
+ aio_pool_end();
+ EXPECT_EQ(read(dummy_file.fd, buf, TEST_PACKET_SIZE * POOL_COUNT), TEST_PACKET_SIZE * POOL_COUNT);
+
+ std::stringstream ss;
+ for (int i = 0; i < POOL_COUNT; i++)
+ ss << dummyDataStr;
+
+ EXPECT_STREQ(buf, ss.str().c_str());
+}
+
+} // namespace android
diff --git a/media/mtp/tests/MtpFfsHandle_test.cpp b/media/mtp/tests/MtpFfsHandle_test.cpp
new file mode 100644
index 0000000..b511041
--- /dev/null
+++ b/media/mtp/tests/MtpFfsHandle_test.cpp
@@ -0,0 +1,204 @@
+/*
+ * Copyright 2016 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 "MtpFfsHandle_test.cpp"
+
+#include <android-base/unique_fd.h>
+#include <android-base/test_utils.h>
+#include <fcntl.h>
+#include <gtest/gtest.h>
+#include <memory>
+#include <string>
+#include <unistd.h>
+#include <utils/Log.h>
+
+#include "MtpFfsHandle.h"
+
+namespace android {
+
+constexpr int TEST_PACKET_SIZE = 512;
+constexpr int SMALL_MULT = 30;
+constexpr int MED_MULT = 510;
+
+static const std::string dummyDataStr =
+ "/*\n * Copyright 2015 The Android Open Source Project\n *\n * Licensed un"
+ "der the Apache License, Version 2.0 (the \"License\");\n * you may not us"
+ "e this file except in compliance with the License.\n * You may obtain a c"
+ "opy of the License at\n *\n * http://www.apache.org/licenses/LICENSE"
+ "-2.0\n *\n * Unless required by applicable law or agreed to in writing, s"
+ "oftware\n * distributed under the License is distributed on an \"AS IS\" "
+ "BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express o"
+ "r implied.\n * Se";
+
+class MtpFfsHandleTest : public ::testing::Test {
+protected:
+ std::unique_ptr<IMtpHandle> handle;
+
+ // Pipes for reading endpoint data
+ android::base::unique_fd bulk_in;
+ android::base::unique_fd bulk_out;
+ android::base::unique_fd intr;
+
+ TemporaryFile dummy_file;
+
+ MtpFfsHandleTest() {
+ int fd[2];
+ handle = std::unique_ptr<IMtpHandle>(get_ffs_handle());
+ MtpFfsHandle *ffs_handle = static_cast<MtpFfsHandle*>(handle.get());
+ EXPECT_TRUE(ffs_handle != NULL);
+
+ EXPECT_EQ(pipe(fd), 0);
+ EXPECT_EQ(fcntl(fd[0], F_SETPIPE_SZ, 1048576), 1048576);
+ bulk_in.reset(fd[0]);
+ ffs_handle->mBulkIn.reset(fd[1]);
+
+ EXPECT_EQ(pipe(fd), 0);
+ EXPECT_EQ(fcntl(fd[0], F_SETPIPE_SZ, 1048576), 1048576);
+ bulk_out.reset(fd[1]);
+ ffs_handle->mBulkOut.reset(fd[0]);
+
+ EXPECT_EQ(pipe(fd), 0);
+ intr.reset(fd[0]);
+ ffs_handle->mIntr.reset(fd[1]);
+ }
+
+ ~MtpFfsHandleTest() {}
+};
+
+TEST_F(MtpFfsHandleTest, testRead) {
+ EXPECT_EQ(write(bulk_out, dummyDataStr.c_str(), TEST_PACKET_SIZE), TEST_PACKET_SIZE);
+ char buf[TEST_PACKET_SIZE + 1];
+ buf[TEST_PACKET_SIZE] = '\0';
+ EXPECT_EQ(handle->read(buf, TEST_PACKET_SIZE), TEST_PACKET_SIZE);
+ EXPECT_STREQ(buf, dummyDataStr.c_str());
+}
+
+TEST_F(MtpFfsHandleTest, testWrite) {
+ char buf[TEST_PACKET_SIZE + 1];
+ buf[TEST_PACKET_SIZE] = '\0';
+ EXPECT_EQ(handle->write(dummyDataStr.c_str(), TEST_PACKET_SIZE), TEST_PACKET_SIZE);
+ EXPECT_EQ(read(bulk_in, buf, TEST_PACKET_SIZE), TEST_PACKET_SIZE);
+ EXPECT_STREQ(buf, dummyDataStr.c_str());
+}
+
+TEST_F(MtpFfsHandleTest, testReceiveFileSmall) {
+ std::stringstream ss;
+ mtp_file_range mfr;
+ int size = TEST_PACKET_SIZE * SMALL_MULT;
+ char buf[size + 1];
+ buf[size] = '\0';
+
+ mfr.length = size;
+ mfr.fd = dummy_file.fd;
+ for (int i = 0; i < SMALL_MULT; i++)
+ ss << dummyDataStr;
+
+ EXPECT_EQ(write(bulk_out, ss.str().c_str(), size), size);
+ EXPECT_EQ(handle->receiveFile(mfr), 0);
+
+ EXPECT_EQ(read(dummy_file.fd, buf, size), size);
+
+ EXPECT_STREQ(buf, ss.str().c_str());
+}
+
+TEST_F(MtpFfsHandleTest, testReceiveFileMed) {
+ std::stringstream ss;
+ mtp_file_range mfr;
+ int size = TEST_PACKET_SIZE * MED_MULT;
+ char buf[size + 1];
+ buf[size] = '\0';
+
+ mfr.length = size;
+ mfr.fd = dummy_file.fd;
+ for (int i = 0; i < MED_MULT; i++)
+ ss << dummyDataStr;
+
+ EXPECT_EQ(write(bulk_out, ss.str().c_str(), size), size);
+ EXPECT_EQ(handle->receiveFile(mfr), 0);
+
+ EXPECT_EQ(read(dummy_file.fd, buf, size), size);
+
+ EXPECT_STREQ(buf, ss.str().c_str());
+}
+
+TEST_F(MtpFfsHandleTest, testSendFileSmall) {
+ std::stringstream ss;
+ mtp_file_range mfr;
+ mfr.command = 42;
+ mfr.transaction_id = 1337;
+ int size = TEST_PACKET_SIZE * SMALL_MULT;
+ char buf[size + sizeof(mtp_data_header) + 1];
+ buf[size + sizeof(mtp_data_header)] = '\0';
+
+ mfr.length = size;
+ mfr.fd = dummy_file.fd;
+ for (int i = 0; i < SMALL_MULT; i++)
+ ss << dummyDataStr;
+
+ EXPECT_EQ(write(dummy_file.fd, ss.str().c_str(), size), size);
+ EXPECT_EQ(handle->sendFile(mfr), 0);
+
+ EXPECT_EQ(read(bulk_in, buf, size + sizeof(mtp_data_header)),
+ static_cast<long>(size + sizeof(mtp_data_header)));
+
+ struct mtp_data_header *header = reinterpret_cast<struct mtp_data_header*>(buf);
+ EXPECT_STREQ(buf + sizeof(mtp_data_header), ss.str().c_str());
+ EXPECT_EQ(header->length, static_cast<unsigned int>(size + sizeof(mtp_data_header)));
+ EXPECT_EQ(header->type, static_cast<unsigned int>(2));
+ EXPECT_EQ(header->command, static_cast<unsigned int>(42));
+ EXPECT_EQ(header->transaction_id, static_cast<unsigned int>(1337));
+}
+
+TEST_F(MtpFfsHandleTest, testSendFileMed) {
+ std::stringstream ss;
+ mtp_file_range mfr;
+ mfr.command = 42;
+ mfr.transaction_id = 1337;
+ int size = TEST_PACKET_SIZE * MED_MULT;
+ char buf[size + sizeof(mtp_data_header) + 1];
+ buf[size + sizeof(mtp_data_header)] = '\0';
+
+ mfr.length = size;
+ mfr.fd = dummy_file.fd;
+ for (int i = 0; i < MED_MULT; i++)
+ ss << dummyDataStr;
+
+ EXPECT_EQ(write(dummy_file.fd, ss.str().c_str(), size), size);
+ EXPECT_EQ(handle->sendFile(mfr), 0);
+
+ EXPECT_EQ(read(bulk_in, buf, size + sizeof(mtp_data_header)),
+ static_cast<long>(size + sizeof(mtp_data_header)));
+
+ struct mtp_data_header *header = reinterpret_cast<struct mtp_data_header*>(buf);
+ EXPECT_STREQ(buf + sizeof(mtp_data_header), ss.str().c_str());
+ EXPECT_EQ(header->length, static_cast<unsigned int>(size + sizeof(mtp_data_header)));
+ EXPECT_EQ(header->type, static_cast<unsigned int>(2));
+ EXPECT_EQ(header->command, static_cast<unsigned int>(42));
+ EXPECT_EQ(header->transaction_id, static_cast<unsigned int>(1337));
+}
+
+TEST_F(MtpFfsHandleTest, testSendEvent) {
+ struct mtp_event event;
+ event.length = TEST_PACKET_SIZE;
+ event.data = const_cast<char*>(dummyDataStr.c_str());
+ char buf[TEST_PACKET_SIZE + 1];
+ buf[TEST_PACKET_SIZE] = '\0';
+
+ handle->sendEvent(event);
+ read(intr, buf, TEST_PACKET_SIZE);
+ EXPECT_STREQ(buf, dummyDataStr.c_str());
+}
+
+} // namespace android
diff --git a/media/ndk/Android.bp b/media/ndk/Android.bp
new file mode 100644
index 0000000..e4e3d8f
--- /dev/null
+++ b/media/ndk/Android.bp
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 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.
+
+// Headers module is in frameworks/av/Android.bp because modules are not allowed
+// to refer to headers in parent directories and the headers live in
+// frameworks/av/include.
+
+ndk_library {
+ name: "libmediandk.ndk",
+ symbol_file: "libmediandk.map.txt",
+ first_version: "21",
+ unversioned_until: "current",
+}
diff --git a/media/ndk/Android.mk b/media/ndk/Android.mk
index 74729e4..a4f999f 100644
--- a/media/ndk/Android.mk
+++ b/media/ndk/Android.mk
@@ -45,7 +45,6 @@
LOCAL_SHARED_LIBRARIES := \
libbinder \
libmedia \
- libmediadrm \
libstagefright \
libstagefright_foundation \
liblog \
diff --git a/media/ndk/NdkImageReaderPriv.h b/media/ndk/NdkImageReaderPriv.h
index 48f0953..8b540fa 100644
--- a/media/ndk/NdkImageReaderPriv.h
+++ b/media/ndk/NdkImageReaderPriv.h
@@ -112,7 +112,7 @@
struct FrameListener : public ConsumerBase::FrameAvailableListener {
public:
- FrameListener(AImageReader* parent) : mReader(parent) {}
+ explicit FrameListener(AImageReader* parent) : mReader(parent) {}
void onFrameAvailable(const BufferItem& item) override;
diff --git a/media/ndk/NdkMediaCodec.cpp b/media/ndk/NdkMediaCodec.cpp
index 50b490d..3d1eca1 100644
--- a/media/ndk/NdkMediaCodec.cpp
+++ b/media/ndk/NdkMediaCodec.cpp
@@ -59,7 +59,7 @@
private:
AMediaCodec* mCodec;
public:
- CodecHandler(AMediaCodec *codec);
+ explicit CodecHandler(AMediaCodec *codec);
virtual void onMessageReceived(const sp<AMessage> &msg);
};
diff --git a/media/ndk/NdkMediaExtractor.cpp b/media/ndk/NdkMediaExtractor.cpp
index 89f2d9c..805eafb 100644
--- a/media/ndk/NdkMediaExtractor.cpp
+++ b/media/ndk/NdkMediaExtractor.cpp
@@ -86,7 +86,6 @@
jobject service = NULL;
if (env == NULL) {
ALOGE("setDataSource(path) must be called from Java thread");
- env->ExceptionClear();
return AMEDIA_ERROR_UNSUPPORTED;
}
diff --git a/media/ndk/libmediandk.map.txt b/media/ndk/libmediandk.map.txt
new file mode 100644
index 0000000..7db4d06
--- /dev/null
+++ b/media/ndk/libmediandk.map.txt
@@ -0,0 +1,141 @@
+LIBMEDIANDK {
+ global:
+ AImageReader_acquireLatestImage; # introduced=24
+ AImageReader_acquireNextImage; # introduced=24
+ AImageReader_delete; # introduced=24
+ AImageReader_getFormat; # introduced=24
+ AImageReader_getHeight; # introduced=24
+ AImageReader_getMaxImages; # introduced=24
+ AImageReader_getWidth; # introduced=24
+ AImageReader_getWindow; # introduced=24
+ AImageReader_new; # introduced=24
+ AImageReader_setImageListener; # introduced=24
+ AImage_delete; # introduced=24
+ AImage_getCropRect; # introduced=24
+ AImage_getFormat; # introduced=24
+ AImage_getHeight; # introduced=24
+ AImage_getNumberOfPlanes; # introduced=24
+ AImage_getPlaneData; # introduced=24
+ AImage_getPlanePixelStride; # introduced=24
+ AImage_getPlaneRowStride; # introduced=24
+ AImage_getTimestamp; # introduced=24
+ AImage_getWidth; # introduced=24
+ AMEDIAFORMAT_KEY_AAC_PROFILE; # var
+ AMEDIAFORMAT_KEY_BIT_RATE; # var
+ AMEDIAFORMAT_KEY_CHANNEL_COUNT; # var
+ AMEDIAFORMAT_KEY_CHANNEL_MASK; # var
+ AMEDIAFORMAT_KEY_COLOR_FORMAT; # var
+ AMEDIAFORMAT_KEY_DURATION; # var
+ AMEDIAFORMAT_KEY_FLAC_COMPRESSION_LEVEL; # var
+ AMEDIAFORMAT_KEY_FRAME_RATE; # var
+ AMEDIAFORMAT_KEY_HEIGHT; # var
+ AMEDIAFORMAT_KEY_IS_ADTS; # var
+ AMEDIAFORMAT_KEY_IS_AUTOSELECT; # var
+ AMEDIAFORMAT_KEY_IS_DEFAULT; # var
+ AMEDIAFORMAT_KEY_IS_FORCED_SUBTITLE; # var
+ AMEDIAFORMAT_KEY_I_FRAME_INTERVAL; # var
+ AMEDIAFORMAT_KEY_LANGUAGE; # var
+ AMEDIAFORMAT_KEY_MAX_HEIGHT; # var
+ AMEDIAFORMAT_KEY_MAX_INPUT_SIZE; # var
+ AMEDIAFORMAT_KEY_MAX_WIDTH; # var
+ AMEDIAFORMAT_KEY_MIME; # var
+ AMEDIAFORMAT_KEY_PUSH_BLANK_BUFFERS_ON_STOP; # var
+ AMEDIAFORMAT_KEY_REPEAT_PREVIOUS_FRAME_AFTER; # var
+ AMEDIAFORMAT_KEY_SAMPLE_RATE; # var
+ AMEDIAFORMAT_KEY_STRIDE; # var
+ AMEDIAFORMAT_KEY_WIDTH; # var
+ AMediaCodecCryptoInfo_delete;
+ AMediaCodecCryptoInfo_getClearBytes;
+ AMediaCodecCryptoInfo_getEncryptedBytes;
+ AMediaCodecCryptoInfo_getIV;
+ AMediaCodecCryptoInfo_getKey;
+ AMediaCodecCryptoInfo_getMode;
+ AMediaCodecCryptoInfo_getNumSubSamples;
+ AMediaCodecCryptoInfo_new;
+ AMediaCodecCryptoInfo_setPattern; # introduced=24
+ AMediaCodec_configure;
+ AMediaCodec_createCodecByName;
+ AMediaCodec_createDecoderByType;
+ AMediaCodec_createEncoderByType;
+ AMediaCodec_delete;
+ AMediaCodec_dequeueInputBuffer;
+ AMediaCodec_dequeueOutputBuffer;
+ AMediaCodec_flush;
+ AMediaCodec_getInputBuffer;
+ AMediaCodec_getOutputBuffer;
+ AMediaCodec_getOutputFormat;
+ AMediaCodec_queueInputBuffer;
+ AMediaCodec_queueSecureInputBuffer;
+ AMediaCodec_releaseOutputBuffer;
+ AMediaCodec_releaseOutputBufferAtTime;
+ AMediaCodec_setOutputSurface; # introduced=24
+ AMediaCodec_start;
+ AMediaCodec_stop;
+ AMediaCrypto_delete;
+ AMediaCrypto_isCryptoSchemeSupported;
+ AMediaCrypto_new;
+ AMediaCrypto_requiresSecureDecoderComponent;
+ AMediaDrm_closeSession;
+ AMediaDrm_createByUUID;
+ AMediaDrm_decrypt;
+ AMediaDrm_encrypt;
+ AMediaDrm_getKeyRequest;
+ AMediaDrm_getPropertyByteArray;
+ AMediaDrm_getPropertyString;
+ AMediaDrm_getProvisionRequest;
+ AMediaDrm_getSecureStops;
+ AMediaDrm_isCryptoSchemeSupported;
+ AMediaDrm_openSession;
+ AMediaDrm_provideKeyResponse;
+ AMediaDrm_provideProvisionResponse;
+ AMediaDrm_queryKeyStatus;
+ AMediaDrm_release;
+ AMediaDrm_releaseSecureStops;
+ AMediaDrm_removeKeys;
+ AMediaDrm_restoreKeys;
+ AMediaDrm_setOnEventListener;
+ AMediaDrm_setPropertyByteArray;
+ AMediaDrm_setPropertyString;
+ AMediaDrm_sign;
+ AMediaDrm_verify;
+ AMediaExtractor_advance;
+ AMediaExtractor_delete;
+ AMediaExtractor_getPsshInfo;
+ AMediaExtractor_getSampleCryptoInfo;
+ AMediaExtractor_getSampleFlags;
+ AMediaExtractor_getSampleTime;
+ AMediaExtractor_getSampleTrackIndex;
+ AMediaExtractor_getTrackCount;
+ AMediaExtractor_getTrackFormat;
+ AMediaExtractor_new;
+ AMediaExtractor_readSampleData;
+ AMediaExtractor_seekTo;
+ AMediaExtractor_selectTrack;
+ AMediaExtractor_setDataSource;
+ AMediaExtractor_setDataSourceFd;
+ AMediaExtractor_unselectTrack;
+ AMediaFormat_delete;
+ AMediaFormat_getBuffer;
+ AMediaFormat_getFloat;
+ AMediaFormat_getInt32;
+ AMediaFormat_getInt64;
+ AMediaFormat_getSize;
+ AMediaFormat_getString;
+ AMediaFormat_new;
+ AMediaFormat_setBuffer;
+ AMediaFormat_setFloat;
+ AMediaFormat_setInt32;
+ AMediaFormat_setInt64;
+ AMediaFormat_setString;
+ AMediaFormat_toString;
+ AMediaMuxer_addTrack;
+ AMediaMuxer_delete;
+ AMediaMuxer_new;
+ AMediaMuxer_setLocation;
+ AMediaMuxer_setOrientationHint;
+ AMediaMuxer_start;
+ AMediaMuxer_stop;
+ AMediaMuxer_writeSampleData;
+ local:
+ *;
+};
diff --git a/media/utils/Android.mk b/media/utils/Android.mk
index 54d22b1..f482d1a 100644
--- a/media/utils/Android.mk
+++ b/media/utils/Android.mk
@@ -19,6 +19,7 @@
LOCAL_SRC_FILES := \
BatteryNotifier.cpp \
ISchedulingPolicyService.cpp \
+ MemoryLeakTrackUtil.cpp \
SchedulingPolicyService.cpp
LOCAL_SHARED_LIBRARIES := \
@@ -26,6 +27,7 @@
libcutils \
liblog \
libutils \
+ libmemunreachable \
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
diff --git a/media/utils/ISchedulingPolicyService.cpp b/media/utils/ISchedulingPolicyService.cpp
index f55bc02..f5bfe20 100644
--- a/media/utils/ISchedulingPolicyService.cpp
+++ b/media/utils/ISchedulingPolicyService.cpp
@@ -32,7 +32,7 @@
class BpSchedulingPolicyService : public BpInterface<ISchedulingPolicyService>
{
public:
- BpSchedulingPolicyService(const sp<IBinder>& impl)
+ explicit BpSchedulingPolicyService(const sp<IBinder>& impl)
: BpInterface<ISchedulingPolicyService>(impl)
{
}
diff --git a/media/libmedia/MemoryLeakTrackUtil.cpp b/media/utils/MemoryLeakTrackUtil.cpp
similarity index 100%
rename from media/libmedia/MemoryLeakTrackUtil.cpp
rename to media/utils/MemoryLeakTrackUtil.cpp
diff --git a/radio/Android.mk b/radio/Android.mk
index 0377328..be5d283 100644
--- a/radio/Android.mk
+++ b/radio/Android.mk
@@ -27,7 +27,6 @@
libutils \
liblog \
libbinder \
- libhardware \
libradio_metadata
#LOCAL_C_INCLUDES += \
diff --git a/radio/IRadio.cpp b/radio/IRadio.cpp
index 242df77..0881a91 100644
--- a/radio/IRadio.cpp
+++ b/radio/IRadio.cpp
@@ -44,7 +44,7 @@
class BpRadio: public BpInterface<IRadio>
{
public:
- BpRadio(const sp<IBinder>& impl)
+ explicit BpRadio(const sp<IBinder>& impl)
: BpInterface<IRadio>(impl)
{
}
diff --git a/radio/IRadioClient.cpp b/radio/IRadioClient.cpp
index 033ca49..ca21949 100644
--- a/radio/IRadioClient.cpp
+++ b/radio/IRadioClient.cpp
@@ -33,7 +33,7 @@
{
public:
- BpRadioClient(const sp<IBinder>& impl)
+ explicit BpRadioClient(const sp<IBinder>& impl)
: BpInterface<IRadioClient>(impl)
{
}
diff --git a/radio/IRadioService.cpp b/radio/IRadioService.cpp
index 81acf9e..be7d21e 100644
--- a/radio/IRadioService.cpp
+++ b/radio/IRadioService.cpp
@@ -45,7 +45,7 @@
class BpRadioService: public BpInterface<IRadioService>
{
public:
- BpRadioService(const sp<IBinder>& impl)
+ explicit BpRadioService(const sp<IBinder>& impl)
: BpInterface<IRadioService>(impl)
{
}
@@ -88,7 +88,9 @@
data.writeInt32(handle);
data.writeStrongBinder(IInterface::asBinder(client));
ALOGV("attach() config %p withAudio %d region %d type %d",
- config == NULL ? 0 : config, withAudio, config->region, config->band.type);
+ config == NULL ? 0 : config, withAudio,
+ config == NULL ? 0 : config->region,
+ config == NULL ? 0 : config->band.type);
if (config == NULL) {
data.writeInt32(0);
} else {
diff --git a/services/audioflinger/Android.mk b/services/audioflinger/Android.mk
index 8b831f0..5c28e46 100644
--- a/services/audioflinger/Android.mk
+++ b/services/audioflinger/Android.mk
@@ -35,8 +35,8 @@
LOCAL_C_INCLUDES := \
$(TOPDIR)frameworks/av/services/audiopolicy \
+ $(TOPDIR)frameworks/av/services/medialog \
$(TOPDIR)external/sonic \
- libcore/include \
$(call include-path-for, audio-effects) \
$(call include-path-for, audio-utils)
@@ -48,7 +48,8 @@
libutils \
liblog \
libbinder \
- libmedia \
+ libaudioclient \
+ libmedialogservice \
libmediautils \
libnbaio \
libhardware \
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index fec3a57..1a41106 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1423,11 +1423,15 @@
mAudioFlinger(audioFlinger),
mPid(pid)
{
- size_t heapSize = kClientSharedHeapSizeBytes;
- // Increase heap size on non low ram devices to limit risk of reconnection failure for
- // invalidated tracks
- if (!audioFlinger->isLowRamDevice()) {
- heapSize *= kClientSharedHeapSizeMultiplier;
+ size_t heapSize = property_get_int32("ro.af.client_heap_size_kbyte", 0);
+ heapSize *= 1024;
+ if (!heapSize) {
+ heapSize = kClientSharedHeapSizeBytes;
+ // Increase heap size on non low ram devices to limit risk of reconnection failure for
+ // invalidated tracks
+ if (!audioFlinger->isLowRamDevice()) {
+ heapSize *= kClientSharedHeapSizeMultiplier;
+ }
}
mMemoryDealer = new MemoryDealer(heapSize, "AudioFlinger::Client");
}
@@ -2024,7 +2028,7 @@
return NO_ERROR;
}
-void AudioFlinger::closeOutputFinish(sp<PlaybackThread> thread)
+void AudioFlinger::closeOutputFinish(const sp<PlaybackThread>& thread)
{
AudioStreamOut *out = thread->clearOutput();
ALOG_ASSERT(out != NULL, "out shouldn't be NULL");
@@ -2033,7 +2037,7 @@
delete out;
}
-void AudioFlinger::closeOutputInternal_l(sp<PlaybackThread> thread)
+void AudioFlinger::closeOutputInternal_l(const sp<PlaybackThread>& thread)
{
mPlaybackThreads.removeItem(thread->mId);
thread->exit();
@@ -2294,7 +2298,7 @@
return NO_ERROR;
}
-void AudioFlinger::closeInputFinish(sp<RecordThread> thread)
+void AudioFlinger::closeInputFinish(const sp<RecordThread>& thread)
{
thread->exit();
AudioStreamIn *in = thread->clearInput();
@@ -2304,7 +2308,7 @@
delete in;
}
-void AudioFlinger::closeInputInternal_l(sp<RecordThread> thread)
+void AudioFlinger::closeInputInternal_l(const sp<RecordThread>& thread)
{
mRecordThreads.removeItem(thread->mId);
closeInputFinish(thread);
@@ -2572,7 +2576,7 @@
audio_session_t triggerSession,
audio_session_t listenerSession,
sync_event_callback_t callBack,
- wp<RefBase> cookie)
+ const wp<RefBase>& cookie)
{
Mutex::Autolock _l(mLock);
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 8b5174c..8120a29 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -319,7 +319,7 @@
audio_session_t triggerSession,
audio_session_t listenerSession,
sync_event_callback_t callBack,
- wp<RefBase> cookie);
+ const wp<RefBase>& cookie);
private:
@@ -486,7 +486,7 @@
// server side of the client's IAudioTrack
class TrackHandle : public android::BnAudioTrack {
public:
- TrackHandle(const sp<PlaybackThread::Track>& track);
+ explicit TrackHandle(const sp<PlaybackThread::Track>& track);
virtual ~TrackHandle();
virtual sp<IMemory> getCblk() const;
virtual status_t start();
@@ -508,7 +508,7 @@
// server side of the client's IAudioRecord
class RecordHandle : public android::BnAudioRecord {
public:
- RecordHandle(const sp<RecordThread::RecordTrack>& recordTrack);
+ explicit RecordHandle(const sp<RecordThread::RecordTrack>& recordTrack);
virtual ~RecordHandle();
virtual status_t start(int /*AudioSystem::sync_event_t*/ event,
audio_session_t triggerSession);
@@ -541,8 +541,8 @@
const String8& address,
audio_output_flags_t flags);
- void closeOutputFinish(sp<PlaybackThread> thread);
- void closeInputFinish(sp<RecordThread> thread);
+ void closeOutputFinish(const sp<PlaybackThread>& thread);
+ void closeInputFinish(const sp<RecordThread>& thread);
// no range check, AudioFlinger::mLock held
bool streamMute_l(audio_stream_type_t stream) const
@@ -714,9 +714,9 @@
// for use from destructor
status_t closeOutput_nonvirtual(audio_io_handle_t output);
- void closeOutputInternal_l(sp<PlaybackThread> thread);
+ void closeOutputInternal_l(const sp<PlaybackThread>& thread);
status_t closeInput_nonvirtual(audio_io_handle_t input);
- void closeInputInternal_l(sp<RecordThread> thread);
+ void closeInputInternal_l(const sp<RecordThread>& thread);
void setAudioHwSyncForSession_l(PlaybackThread *thread, audio_session_t sessionId);
status_t checkStreamType(audio_stream_type_t stream) const;
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp
index 0be7199..945f4b3 100644
--- a/services/audioflinger/AudioMixer.cpp
+++ b/services/audioflinger/AudioMixer.cpp
@@ -1611,8 +1611,13 @@
// in == NULL can happen if the track was flushed just after having
// been enabled for mixing.
if (in == NULL || (((uintptr_t)in) & 3)) {
- memset(out, 0, numFrames
- * t.mMixerChannelCount * audio_bytes_per_sample(t.mMixerFormat));
+ if ( AUDIO_FORMAT_PCM_FLOAT == t.mMixerFormat ) {
+ memset((char*)fout, 0, numFrames
+ * t.mMixerChannelCount * audio_bytes_per_sample(t.mMixerFormat));
+ } else {
+ memset((char*)out, 0, numFrames
+ * t.mMixerChannelCount * audio_bytes_per_sample(t.mMixerFormat));
+ }
ALOGE_IF((((uintptr_t)in) & 3),
"process__OneTrack16BitsStereoNoResampling: misaligned buffer"
" %p track %d, channels %d, needs %08x, volume %08x vfl %f vfr %f",
@@ -1679,8 +1684,8 @@
// Needs to derive a compile time constant (constexpr). Could be targeted to go
// to a MONOVOL mixtype based on MAX_NUM_VOLUMES, but that's an unnecessary complication.
-#define MIXTYPE_MONOVOL(mixtype) (mixtype == MIXTYPE_MULTI ? MIXTYPE_MULTI_MONOVOL : \
- mixtype == MIXTYPE_MULTI_SAVEONLY ? MIXTYPE_MULTI_SAVEONLY_MONOVOL : mixtype)
+#define MIXTYPE_MONOVOL(mixtype) ((mixtype) == MIXTYPE_MULTI ? MIXTYPE_MULTI_MONOVOL : \
+ (mixtype) == MIXTYPE_MULTI_SAVEONLY ? MIXTYPE_MULTI_SAVEONLY_MONOVOL : (mixtype))
/* MIXTYPE (see AudioMixerOps.h MIXTYPE_* enumeration)
* TO: int32_t (Q4.27) or float
diff --git a/services/audioflinger/AudioResampler.cpp b/services/audioflinger/AudioResampler.cpp
index 4f8b413..8b7259d 100644
--- a/services/audioflinger/AudioResampler.cpp
+++ b/services/audioflinger/AudioResampler.cpp
@@ -17,11 +17,14 @@
#define LOG_TAG "AudioResampler"
//#define LOG_NDEBUG 0
+#include <pthread.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/types.h>
-#include <cutils/log.h>
+
#include <cutils/properties.h>
+#include <log/log.h>
+
#include <audio_utils/primitives.h>
#include "AudioResampler.h"
#include "AudioResamplerSinc.h"
diff --git a/services/audioflinger/AudioResamplerCubic.cpp b/services/audioflinger/AudioResamplerCubic.cpp
index 9c3c7cb..9fb6699 100644
--- a/services/audioflinger/AudioResamplerCubic.cpp
+++ b/services/audioflinger/AudioResamplerCubic.cpp
@@ -19,7 +19,8 @@
#include <stdint.h>
#include <string.h>
#include <sys/types.h>
-#include <cutils/log.h>
+
+#include <log/log.h>
#include "AudioResampler.h"
#include "AudioResamplerCubic.h"
diff --git a/services/audioflinger/AudioResamplerCubic.h b/services/audioflinger/AudioResamplerCubic.h
index 4b45b0b..f218fd9 100644
--- a/services/audioflinger/AudioResamplerCubic.h
+++ b/services/audioflinger/AudioResamplerCubic.h
@@ -19,7 +19,7 @@
#include <stdint.h>
#include <sys/types.h>
-#include <cutils/log.h>
+#include <android/log.h>
#include "AudioResampler.h"
diff --git a/services/audioflinger/AudioResamplerDyn.cpp b/services/audioflinger/AudioResamplerDyn.cpp
index e615700..213cd1a 100644
--- a/services/audioflinger/AudioResamplerDyn.cpp
+++ b/services/audioflinger/AudioResamplerDyn.cpp
@@ -29,9 +29,10 @@
#include <utils/Log.h>
#include <audio_utils/primitives.h>
-#include "AudioResamplerFirOps.h" // USE_NEON and USE_INLINE_ASSEMBLY defined here
+#include "AudioResamplerFirOps.h" // USE_NEON, USE_SSE and USE_INLINE_ASSEMBLY defined here
#include "AudioResamplerFirProcess.h"
#include "AudioResamplerFirProcessNeon.h"
+#include "AudioResamplerFirProcessSSE.h"
#include "AudioResamplerFirGen.h" // requires math.h
#include "AudioResamplerDyn.h"
@@ -520,7 +521,7 @@
// inFrameCount, outputIndex, outFrameCount, phaseFraction, phaseWrapLimit);
// check inputIndex overflow
- ALOG_ASSERT(inputIndex <= mBuffer.frameCount, "inputIndex%d > frameCount%d",
+ ALOG_ASSERT(inputIndex <= mBuffer.frameCount, "inputIndex%zu > frameCount%zu",
inputIndex, mBuffer.frameCount);
// Buffer is empty, fetch a new one if necessary (inFrameCount > 0).
// We may not fetch a new buffer if the existing data is sufficient.
@@ -591,7 +592,7 @@
// We arrive here when we're finished or when the input buffer runs out.
// Regardless we need to release the input buffer if we've acquired it.
if (inputIndex > 0) { // we've acquired a buffer (alternatively could check frameCount)
- ALOG_ASSERT(inputIndex == frameCount, "inputIndex(%d) != frameCount(%d)",
+ ALOG_ASSERT(inputIndex == frameCount, "inputIndex(%zu) != frameCount(%zu)",
inputIndex, frameCount); // must have been fully read.
inputIndex = 0;
provider->releaseBuffer(&mBuffer);
@@ -603,7 +604,7 @@
// inputIndex must be zero in all three cases:
// (1) the buffer never was been acquired; (2) the buffer was
// released at "done:"; or (3) getNextBuffer() failed.
- ALOG_ASSERT(inputIndex == 0, "Releasing: inputindex:%d frameCount:%d phaseFraction:%u",
+ ALOG_ASSERT(inputIndex == 0, "Releasing: inputindex:%zu frameCount:%zu phaseFraction:%u",
inputIndex, mBuffer.frameCount, phaseFraction);
ALOG_ASSERT(mBuffer.frameCount == 0); // there must be no frames in the buffer
mInBuffer.setImpulse(impulse);
diff --git a/services/audioflinger/AudioResamplerDyn.h b/services/audioflinger/AudioResamplerDyn.h
index 3b1c381..f8b8fa1 100644
--- a/services/audioflinger/AudioResamplerDyn.h
+++ b/services/audioflinger/AudioResamplerDyn.h
@@ -19,7 +19,7 @@
#include <stdint.h>
#include <sys/types.h>
-#include <cutils/log.h>
+#include <android/log.h>
#include "AudioResampler.h"
diff --git a/services/audioflinger/AudioResamplerFirOps.h b/services/audioflinger/AudioResamplerFirOps.h
index 2a26496..776903c 100644
--- a/services/audioflinger/AudioResamplerFirOps.h
+++ b/services/audioflinger/AudioResamplerFirOps.h
@@ -36,6 +36,13 @@
#include <arm_neon.h>
#endif
+#if defined(__SSSE3__) // Should be supported in x86 ABI for both 32 & 64-bit.
+#define USE_SSE (true)
+#include <tmmintrin.h>
+#else
+#define USE_SSE (false)
+#endif
+
template<typename T, typename U>
struct is_same
{
diff --git a/services/audioflinger/AudioResamplerFirProcessSSE.h b/services/audioflinger/AudioResamplerFirProcessSSE.h
new file mode 100644
index 0000000..63ed052
--- /dev/null
+++ b/services/audioflinger/AudioResamplerFirProcessSSE.h
@@ -0,0 +1,215 @@
+/*
+ * Copyright (C) 2016 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_AUDIO_RESAMPLER_FIR_PROCESS_SSE_H
+#define ANDROID_AUDIO_RESAMPLER_FIR_PROCESS_SSE_H
+
+namespace android {
+
+// depends on AudioResamplerFirOps.h, AudioResamplerFirProcess.h
+
+#if USE_SSE
+
+#define TO_STRING2(x) #x
+#define TO_STRING(x) TO_STRING2(x)
+// uncomment to print GCC version, may be relevant for intrinsic optimizations
+/* #pragma message ("GCC version: " TO_STRING(__GNUC__) \
+ "." TO_STRING(__GNUC_MINOR__) \
+ "." TO_STRING(__GNUC_PATCHLEVEL__)) */
+
+//
+// SSEx specializations are enabled for Process() and ProcessL() in AudioResamplerFirProcess.h
+//
+
+template <int CHANNELS, int STRIDE, bool FIXED>
+static inline void ProcessSSEIntrinsic(float* out,
+ int count,
+ const float* coefsP,
+ const float* coefsN,
+ const float* sP,
+ const float* sN,
+ const float* volumeLR,
+ float lerpP,
+ const float* coefsP1,
+ const float* coefsN1)
+{
+ ALOG_ASSERT(count > 0 && (count & 7) == 0); // multiple of 8
+ COMPILE_TIME_ASSERT_FUNCTION_SCOPE(CHANNELS == 1 || CHANNELS == 2);
+
+ sP -= CHANNELS*(4-1); // adjust sP for a loop iteration of four
+
+ __m128 interp;
+ if (!FIXED) {
+ interp = _mm_set1_ps(lerpP);
+ }
+
+ __m128 accL, accR;
+ accL = _mm_setzero_ps();
+ if (CHANNELS == 2) {
+ accR = _mm_setzero_ps();
+ }
+
+ do {
+ __m128 posCoef = _mm_load_ps(coefsP);
+ __m128 negCoef = _mm_load_ps(coefsN);
+ coefsP += 4;
+ coefsN += 4;
+
+ if (!FIXED) { // interpolate
+ __m128 posCoef1 = _mm_load_ps(coefsP1);
+ __m128 negCoef1 = _mm_load_ps(coefsN1);
+ coefsP1 += 4;
+ coefsN1 += 4;
+
+ // Calculate the final coefficient for interpolation
+ // posCoef = interp * (posCoef1 - posCoef) + posCoef
+ // negCoef = interp * (negCoef - negCoef1) + negCoef1
+ posCoef1 = _mm_sub_ps(posCoef1, posCoef);
+ negCoef = _mm_sub_ps(negCoef, negCoef1);
+
+ posCoef1 = _mm_mul_ps(posCoef1, interp);
+ negCoef = _mm_mul_ps(negCoef, interp);
+
+ posCoef = _mm_add_ps(posCoef1, posCoef);
+ negCoef = _mm_add_ps(negCoef, negCoef1);
+ }
+ switch (CHANNELS) {
+ case 1: {
+ __m128 posSamp = _mm_loadu_ps(sP);
+ __m128 negSamp = _mm_loadu_ps(sN);
+ sP -= 4;
+ sN += 4;
+
+ posSamp = _mm_shuffle_ps(posSamp, posSamp, 0x1B);
+ posSamp = _mm_mul_ps(posSamp, posCoef);
+ negSamp = _mm_mul_ps(negSamp, negCoef);
+
+ accL = _mm_add_ps(accL, posSamp);
+ accL = _mm_add_ps(accL, negSamp);
+ } break;
+ case 2: {
+ __m128 posSamp0 = _mm_loadu_ps(sP);
+ __m128 posSamp1 = _mm_loadu_ps(sP+4);
+ __m128 negSamp0 = _mm_loadu_ps(sN);
+ __m128 negSamp1 = _mm_loadu_ps(sN+4);
+ sP -= 8;
+ sN += 8;
+
+ // deinterleave everything and reverse the positives
+ __m128 posSampL = _mm_shuffle_ps(posSamp1, posSamp0, 0x22);
+ __m128 posSampR = _mm_shuffle_ps(posSamp1, posSamp0, 0x77);
+ __m128 negSampL = _mm_shuffle_ps(negSamp0, negSamp1, 0x88);
+ __m128 negSampR = _mm_shuffle_ps(negSamp0, negSamp1, 0xDD);
+
+ posSampL = _mm_mul_ps(posSampL, posCoef);
+ posSampR = _mm_mul_ps(posSampR, posCoef);
+ negSampL = _mm_mul_ps(negSampL, negCoef);
+ negSampR = _mm_mul_ps(negSampR, negCoef);
+
+ accL = _mm_add_ps(accL, posSampL);
+ accR = _mm_add_ps(accR, posSampR);
+ accL = _mm_add_ps(accL, negSampL);
+ accR = _mm_add_ps(accR, negSampR);
+ } break;
+ }
+ } while (count -= 4);
+
+ // multiply by volume and save
+ __m128 vLR = _mm_setzero_ps();
+ __m128 outSamp;
+ vLR = _mm_loadl_pi(vLR, reinterpret_cast<const __m64*>(volumeLR));
+ outSamp = _mm_loadl_pi(vLR, reinterpret_cast<__m64*>(out));
+
+ // combine and funnel down accumulator
+ __m128 outAccum = _mm_setzero_ps();
+ if (CHANNELS == 1) {
+ // duplicate accL to both L and R
+ outAccum = _mm_add_ps(accL, _mm_movehl_ps(accL, accL));
+ outAccum = _mm_add_ps(outAccum, _mm_shuffle_ps(outAccum, outAccum, 0x11));
+ } else if (CHANNELS == 2) {
+ // accR contains R, fold in
+ outAccum = _mm_hadd_ps(accL, accR);
+ outAccum = _mm_hadd_ps(outAccum, outAccum);
+ }
+
+ outAccum = _mm_mul_ps(outAccum, vLR);
+ outSamp = _mm_add_ps(outSamp, outAccum);
+ _mm_storel_pi(reinterpret_cast<__m64*>(out), outSamp);
+}
+
+template<>
+inline void ProcessL<1, 16>(float* const out,
+ int count,
+ const float* coefsP,
+ const float* coefsN,
+ const float* sP,
+ const float* sN,
+ const float* const volumeLR)
+{
+ ProcessSSEIntrinsic<1, 16, true>(out, count, coefsP, coefsN, sP, sN, volumeLR,
+ 0 /*lerpP*/, NULL /*coefsP1*/, NULL /*coefsN1*/);
+}
+
+template<>
+inline void ProcessL<2, 16>(float* const out,
+ int count,
+ const float* coefsP,
+ const float* coefsN,
+ const float* sP,
+ const float* sN,
+ const float* const volumeLR)
+{
+ ProcessSSEIntrinsic<2, 16, true>(out, count, coefsP, coefsN, sP, sN, volumeLR,
+ 0 /*lerpP*/, NULL /*coefsP1*/, NULL /*coefsN1*/);
+}
+
+template<>
+inline void Process<1, 16>(float* const out,
+ int count,
+ const float* coefsP,
+ const float* coefsN,
+ const float* coefsP1,
+ const float* coefsN1,
+ const float* sP,
+ const float* sN,
+ float lerpP,
+ const float* const volumeLR)
+{
+ ProcessSSEIntrinsic<1, 16, false>(out, count, coefsP, coefsN, sP, sN, volumeLR,
+ lerpP, coefsP1, coefsN1);
+}
+
+template<>
+inline void Process<2, 16>(float* const out,
+ int count,
+ const float* coefsP,
+ const float* coefsN,
+ const float* coefsP1,
+ const float* coefsN1,
+ const float* sP,
+ const float* sN,
+ float lerpP,
+ const float* const volumeLR)
+{
+ ProcessSSEIntrinsic<2, 16, false>(out, count, coefsP, coefsN, sP, sN, volumeLR,
+ lerpP, coefsP1, coefsN1);
+}
+
+#endif //USE_SSE
+
+} // namespace android
+
+#endif /*ANDROID_AUDIO_RESAMPLER_FIR_PROCESS_SSE_H*/
diff --git a/services/audioflinger/AudioResamplerSinc.h b/services/audioflinger/AudioResamplerSinc.h
index 0fbeac8..df8b45a 100644
--- a/services/audioflinger/AudioResamplerSinc.h
+++ b/services/audioflinger/AudioResamplerSinc.h
@@ -19,7 +19,7 @@
#include <stdint.h>
#include <sys/types.h>
-#include <cutils/log.h>
+#include <android/log.h>
#include "AudioResampler.h"
diff --git a/services/audioflinger/AudioWatchdog.h b/services/audioflinger/AudioWatchdog.h
index 4657530..7b69fc6 100644
--- a/services/audioflinger/AudioWatchdog.h
+++ b/services/audioflinger/AudioWatchdog.h
@@ -41,7 +41,7 @@
class AudioWatchdog : public Thread {
public:
- AudioWatchdog(unsigned periodMs = 50) : Thread(false /*canCallJava*/), mPaused(false),
+ explicit AudioWatchdog(unsigned periodMs = 50) : Thread(false /*canCallJava*/), mPaused(false),
mPeriodNs(periodMs * 1000000), mMaxCycleNs(mPeriodNs * 2),
// mOldTs
// mLogTs initialized below
diff --git a/services/audioflinger/AutoPark.h b/services/audioflinger/AutoPark.h
index e539e47..9ac7b65 100644
--- a/services/audioflinger/AutoPark.h
+++ b/services/audioflinger/AutoPark.h
@@ -21,7 +21,7 @@
public:
// Park the specific FastThread, which can be nullptr, in hot idle if not currently idling
- AutoPark(const sp<T>& fastThread) : mFastThread(fastThread)
+ explicit AutoPark(const sp<T>& fastThread) : mFastThread(fastThread)
{
mPreviousCommand = FastThreadState::HOT_IDLE;
if (fastThread != nullptr) {
diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp
index f908d6d..09e7fd8 100644
--- a/services/audioflinger/Effects.cpp
+++ b/services/audioflinger/Effects.cpp
@@ -361,6 +361,8 @@
if ((mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_AUXILIARY) {
mConfig.inputCfg.channels = AUDIO_CHANNEL_OUT_MONO;
+ mConfig.outputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
+ ALOGV("Overriding auxiliary effect input as MONO and output as STEREO");
} else {
mConfig.inputCfg.channels = channelMask;
// TODO: Update this logic when multichannel effects are implemented.
@@ -1555,7 +1557,7 @@
}
// Must be called with EffectChain::mLock locked
-void AudioFlinger::EffectChain::clearInputBuffer_l(sp<ThreadBase> thread)
+void AudioFlinger::EffectChain::clearInputBuffer_l(const sp<ThreadBase>& thread)
{
// TODO: This will change in the future, depending on multichannel
// and sample format changes for effects.
diff --git a/services/audioflinger/Effects.h b/services/audioflinger/Effects.h
index 864d508..8fe0b96 100644
--- a/services/audioflinger/Effects.h
+++ b/services/audioflinger/Effects.h
@@ -385,7 +385,7 @@
// types or implementations from the suspend/restore mechanism.
bool isEffectEligibleForSuspend(const effect_descriptor_t& desc);
- void clearInputBuffer_l(sp<ThreadBase> thread);
+ void clearInputBuffer_l(const sp<ThreadBase>& thread);
void setThread(const sp<ThreadBase>& thread);
diff --git a/services/audioflinger/LinearMap.h b/services/audioflinger/LinearMap.h
index fca14dd..2220a0c 100644
--- a/services/audioflinger/LinearMap.h
+++ b/services/audioflinger/LinearMap.h
@@ -134,7 +134,7 @@
FIND_METHOD_START_VALUE, // No samples in history, using start value
};
- LinearMap(size_t size)
+ explicit LinearMap(size_t size)
: mSize(size),
mPos(0), // a circular buffer, so could start anywhere. the first sample is at 1.
mSamples(0),
diff --git a/services/audioflinger/PatchPanel.h b/services/audioflinger/PatchPanel.h
index 16ec278..d37c0d3 100644
--- a/services/audioflinger/PatchPanel.h
+++ b/services/audioflinger/PatchPanel.h
@@ -24,7 +24,7 @@
class Patch;
- PatchPanel(const sp<AudioFlinger>& audioFlinger);
+ explicit PatchPanel(const sp<AudioFlinger>& audioFlinger);
virtual ~PatchPanel();
/* List connected audio ports and their attributes */
@@ -54,7 +54,7 @@
class Patch {
public:
- Patch(const struct audio_patch *patch) :
+ explicit Patch(const struct audio_patch *patch) :
mAudioPatch(*patch), mHandle(AUDIO_PATCH_HANDLE_NONE),
mHalHandle(AUDIO_PATCH_HANDLE_NONE), mRecordPatchHandle(AUDIO_PATCH_HANDLE_NONE),
mPlaybackPatchHandle(AUDIO_PATCH_HANDLE_NONE) {}
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 08834d8..4e17f12 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -97,7 +97,7 @@
}
#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#endif
namespace android {
@@ -1153,7 +1153,7 @@
mSuspendedSessions.valueAt(index);
for (size_t i = 0; i < sessionEffects.size(); i++) {
- sp<SuspendedSessionDesc> desc = sessionEffects.valueAt(i);
+ const sp<SuspendedSessionDesc>& desc = sessionEffects.valueAt(i);
for (int j = 0; j < desc->mRefCount; j++) {
if (sessionEffects.keyAt(i) == EffectChain::kKeyForSuspendAll) {
chain->setEffectSuspendedAll_l(true);
@@ -2965,14 +2965,14 @@
}
status_t AudioFlinger::PlaybackThread::attachAuxEffect(
- const sp<AudioFlinger::PlaybackThread::Track> track, int EffectId)
+ const sp<AudioFlinger::PlaybackThread::Track>& track, int EffectId)
{
Mutex::Autolock _l(mLock);
return attachAuxEffect_l(track, EffectId);
}
status_t AudioFlinger::PlaybackThread::attachAuxEffect_l(
- const sp<AudioFlinger::PlaybackThread::Track> track, int EffectId)
+ const sp<AudioFlinger::PlaybackThread::Track>& track, int EffectId)
{
status_t status = NO_ERROR;
diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h
index cb75b98..49aa984 100644
--- a/services/audioflinger/Threads.h
+++ b/services/audioflinger/Threads.h
@@ -97,7 +97,7 @@
sp<ConfigEventData> mData; // event specific parameter data
protected:
- ConfigEvent(int type, bool requiresSystemReady = false) :
+ explicit ConfigEvent(int type, bool requiresSystemReady = false) :
mType(type), mStatus(NO_ERROR), mWaitStatus(false),
mRequiresSystemReady(requiresSystemReady), mData(NULL) {}
};
@@ -149,7 +149,7 @@
class SetParameterConfigEventData : public ConfigEventData {
public:
- SetParameterConfigEventData(String8 keyValuePairs) :
+ explicit SetParameterConfigEventData(String8 keyValuePairs) :
mKeyValuePairs(keyValuePairs) {}
virtual void dump(char *buffer, size_t size) {
@@ -161,7 +161,7 @@
class SetParameterConfigEvent : public ConfigEvent {
public:
- SetParameterConfigEvent(String8 keyValuePairs) :
+ explicit SetParameterConfigEvent(String8 keyValuePairs) :
ConfigEvent(CFG_EVENT_SET_PARAMETER) {
mData = new SetParameterConfigEventData(keyValuePairs);
mWaitStatus = true;
@@ -196,7 +196,7 @@
class ReleaseAudioPatchConfigEventData : public ConfigEventData {
public:
- ReleaseAudioPatchConfigEventData(const audio_patch_handle_t handle) :
+ explicit ReleaseAudioPatchConfigEventData(const audio_patch_handle_t handle) :
mHandle(handle) {}
virtual void dump(char *buffer, size_t size) {
@@ -208,7 +208,7 @@
class ReleaseAudioPatchConfigEvent : public ConfigEvent {
public:
- ReleaseAudioPatchConfigEvent(const audio_patch_handle_t handle) :
+ explicit ReleaseAudioPatchConfigEvent(const audio_patch_handle_t handle) :
ConfigEvent(CFG_EVENT_RELEASE_AUDIO_PATCH) {
mData = new ReleaseAudioPatchConfigEventData(handle);
mWaitStatus = true;
@@ -218,7 +218,7 @@
class PMDeathRecipient : public IBinder::DeathRecipient {
public:
- PMDeathRecipient(const wp<ThreadBase>& thread) : mThread(thread) {}
+ explicit PMDeathRecipient(const wp<ThreadBase>& thread) : mThread(thread) {}
virtual ~PMDeathRecipient() {}
// IBinder::DeathRecipient
@@ -621,9 +621,9 @@
return reinterpret_cast<int16_t *>(mSinkBuffer); };
virtual void detachAuxEffect_l(int effectId);
- status_t attachAuxEffect(const sp<AudioFlinger::PlaybackThread::Track> track,
+ status_t attachAuxEffect(const sp<AudioFlinger::PlaybackThread::Track>& track,
int EffectId);
- status_t attachAuxEffect_l(const sp<AudioFlinger::PlaybackThread::Track> track,
+ status_t attachAuxEffect_l(const sp<AudioFlinger::PlaybackThread::Track>& track,
int EffectId);
virtual status_t addEffectChain_l(const sp<EffectChain>& chain);
@@ -1115,7 +1115,7 @@
class AsyncCallbackThread : public Thread {
public:
- AsyncCallbackThread(const wp<PlaybackThread>& playbackThread);
+ explicit AsyncCallbackThread(const wp<PlaybackThread>& playbackThread);
virtual ~AsyncCallbackThread();
@@ -1200,7 +1200,7 @@
class ResamplerBufferProvider : public AudioBufferProvider
{
public:
- ResamplerBufferProvider(RecordTrack* recordTrack) :
+ explicit ResamplerBufferProvider(RecordTrack* recordTrack) :
mRecordTrack(recordTrack),
mRsmpInUnrel(0), mRsmpInFront(0) { }
virtual ~ResamplerBufferProvider() { }
diff --git a/services/audioflinger/tests/resampler_tests.cpp b/services/audioflinger/tests/resampler_tests.cpp
index 9e375db..b0d384d 100644
--- a/services/audioflinger/tests/resampler_tests.cpp
+++ b/services/audioflinger/tests/resampler_tests.cpp
@@ -17,22 +17,25 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "audioflinger_resampler_tests"
-#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <math.h>
#include <stdio.h>
#include <stdlib.h>
-#include <fcntl.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
-#include <errno.h>
#include <time.h>
-#include <math.h>
-#include <vector>
-#include <utility>
+#include <unistd.h>
+
#include <iostream>
-#include <cutils/log.h>
+#include <utility>
+#include <vector>
+
#include <gtest/gtest.h>
+#include <log/log.h>
#include <media/AudioBufferProvider.h>
+
#include "AudioResampler.h"
#include "test_utils.h"
diff --git a/services/audioflinger/tests/test_utils.h b/services/audioflinger/tests/test_utils.h
index 283c768..b61a929 100644
--- a/services/audioflinger/tests/test_utils.h
+++ b/services/audioflinger/tests/test_utils.h
@@ -17,6 +17,12 @@
#ifndef ANDROID_AUDIO_TEST_UTILS_H
#define ANDROID_AUDIO_TEST_UTILS_H
+#ifndef LOG_TAG
+#define LOG_TAG "test_utils"
+#endif
+
+#include <log/log.h>
+
#include <audio_utils/sndfile.h>
#ifndef ARRAY_SIZE
diff --git a/services/audiopolicy/Android.mk b/services/audiopolicy/Android.mk
index c8e5148..69d22c0 100644
--- a/services/audiopolicy/Android.mk
+++ b/services/audiopolicy/Android.mk
@@ -31,8 +31,7 @@
libutils \
liblog \
libbinder \
- libmedia \
- libhardware \
+ libaudioclient \
libhardware_legacy \
libserviceutility
diff --git a/services/audiopolicy/AudioPolicyInterface.h b/services/audiopolicy/AudioPolicyInterface.h
index a215b95..d1b86da 100644
--- a/services/audiopolicy/AudioPolicyInterface.h
+++ b/services/audiopolicy/AudioPolicyInterface.h
@@ -81,6 +81,10 @@
// retrieve a device connection status
virtual audio_policy_dev_state_t getDeviceConnectionState(audio_devices_t device,
const char *device_address) = 0;
+ // indicate a change in device configuration
+ virtual status_t handleDeviceConfigChange(audio_devices_t device,
+ const char *device_address,
+ const char *device_name) = 0;
// indicate a change in phone state. Valid phones states are defined by audio_mode_t
virtual void setPhoneState(audio_mode_t state) = 0;
// force using a specific device category for the specified usage
@@ -220,7 +224,7 @@
virtual status_t releaseSoundTriggerSession(audio_session_t session) = 0;
- virtual status_t registerPolicyMixes(Vector<AudioMix> mixes) = 0;
+ virtual status_t registerPolicyMixes(const Vector<AudioMix>& mixes) = 0;
virtual status_t unregisterPolicyMixes(Vector<AudioMix> mixes) = 0;
virtual status_t startAudioSource(const struct audio_port_config *source,
diff --git a/services/audiopolicy/common/managerdefinitions/Android.mk b/services/audiopolicy/common/managerdefinitions/Android.mk
index d7da0ad..02118c4 100644
--- a/services/audiopolicy/common/managerdefinitions/Android.mk
+++ b/services/audiopolicy/common/managerdefinitions/Android.mk
@@ -25,9 +25,12 @@
LOCAL_SHARED_LIBRARIES := \
libcutils \
+ libmedia \
libutils \
liblog \
+LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libmedia
+
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include \
$(TOPDIR)frameworks/av/services/audiopolicy/common/include \
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioInputDescriptor.h b/services/audiopolicy/common/managerdefinitions/include/AudioInputDescriptor.h
index f2b39f2..e689320 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioInputDescriptor.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioInputDescriptor.h
@@ -34,7 +34,7 @@
class AudioInputDescriptor: public AudioPortConfig, public AudioSessionInfoProvider
{
public:
- AudioInputDescriptor(const sp<IOProfile>& profile);
+ explicit AudioInputDescriptor(const sp<IOProfile>& profile);
void setIoHandle(audio_io_handle_t ioHandle);
audio_port_handle_t getId() const;
audio_module_handle_t getModuleHandle() const;
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioOutputDescriptor.h b/services/audiopolicy/common/managerdefinitions/include/AudioOutputDescriptor.h
index dd3f8ae..35bb021 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioOutputDescriptor.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioOutputDescriptor.h
@@ -45,7 +45,7 @@
audio_port_handle_t getId() const;
virtual audio_devices_t device() const;
- virtual bool sharesHwModuleWith(const sp<AudioOutputDescriptor> outputDesc);
+ virtual bool sharesHwModuleWith(const sp<AudioOutputDescriptor>& outputDesc);
virtual audio_devices_t supportedDevices();
virtual bool isDuplicated() const { return false; }
virtual uint32_t latency() { return 0; }
@@ -102,7 +102,7 @@
void setIoHandle(audio_io_handle_t ioHandle);
virtual audio_devices_t device() const;
- virtual bool sharesHwModuleWith(const sp<AudioOutputDescriptor> outputDesc);
+ virtual bool sharesHwModuleWith(const sp<AudioOutputDescriptor>& outputDesc);
virtual audio_devices_t supportedDevices();
virtual uint32_t latency();
virtual bool isDuplicated() const { return (mOutput1 != NULL && mOutput2 != NULL); }
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioPolicyMix.h b/services/audiopolicy/common/managerdefinitions/include/AudioPolicyMix.h
index 8f5ebef..c9652de 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioPolicyMix.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioPolicyMix.h
@@ -52,11 +52,11 @@
class AudioPolicyMixCollection : public DefaultKeyedVector<String8, sp<AudioPolicyMix> >
{
public:
- status_t getAudioPolicyMix(String8 address, sp<AudioPolicyMix> &policyMix) const;
+ status_t getAudioPolicyMix(const String8& address, sp<AudioPolicyMix> &policyMix) const;
- status_t registerMix(String8 address, AudioMix mix, sp<SwAudioOutputDescriptor> desc);
+ status_t registerMix(const String8& address, AudioMix mix, sp<SwAudioOutputDescriptor> desc);
- status_t unregisterMix(String8 address);
+ status_t unregisterMix(const String8& address);
void closeOutput(sp<SwAudioOutputDescriptor> &desc);
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioPort.h b/services/audiopolicy/common/managerdefinitions/include/AudioPort.h
index 211ec98..d00d49f 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioPort.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioPort.h
@@ -71,7 +71,7 @@
virtual void toAudioPort(struct audio_port *port) const;
- virtual void importAudioPort(const sp<AudioPort> port);
+ virtual void importAudioPort(const sp<AudioPort>& port);
void addAudioProfile(const sp<AudioProfile> &profile) { mProfiles.add(profile); }
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioRoute.h b/services/audiopolicy/common/managerdefinitions/include/AudioRoute.h
index 67e197f..df54f48 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioRoute.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioRoute.h
@@ -36,7 +36,7 @@
class AudioRoute : public virtual RefBase
{
public:
- AudioRoute(audio_route_type_t type) : mType(type) {}
+ explicit AudioRoute(audio_route_type_t type) : mType(type) {}
void setSources(const AudioPortVector &sources) { mSources = sources; }
const AudioPortVector &getSources() const { return mSources; }
diff --git a/services/audiopolicy/common/managerdefinitions/include/DeviceDescriptor.h b/services/audiopolicy/common/managerdefinitions/include/DeviceDescriptor.h
index ed2450c..9a52d22 100644
--- a/services/audiopolicy/common/managerdefinitions/include/DeviceDescriptor.h
+++ b/services/audiopolicy/common/managerdefinitions/include/DeviceDescriptor.h
@@ -30,7 +30,7 @@
{
public:
// Note that empty name refers by convention to a generic device.
- DeviceDescriptor(audio_devices_t type, const String8 &tagName = String8(""));
+ explicit DeviceDescriptor(audio_devices_t type, const String8 &tagName = String8(""));
virtual ~DeviceDescriptor() {}
@@ -48,7 +48,7 @@
// AudioPort
virtual void attach(const sp<HwModule>& module);
virtual void toAudioPort(struct audio_port *port) const;
- virtual void importAudioPort(const sp<AudioPort> port);
+ virtual void importAudioPort(const sp<AudioPort>& port);
audio_port_handle_t getId() const;
status_t dump(int fd, int spaces, int index, bool verbose = true) const;
@@ -76,11 +76,11 @@
audio_devices_t types() const { return mDeviceTypes; }
- sp<DeviceDescriptor> getDevice(audio_devices_t type, String8 address) const;
+ sp<DeviceDescriptor> getDevice(audio_devices_t type, const String8& address) const;
DeviceVector getDevicesFromType(audio_devices_t types) const;
sp<DeviceDescriptor> getDeviceFromId(audio_port_handle_t id) const;
sp<DeviceDescriptor> getDeviceFromTagName(const String8 &tagName) const;
- DeviceVector getDevicesFromTypeAddr(audio_devices_t type, String8 address) const;
+ DeviceVector getDevicesFromTypeAddr(audio_devices_t type, const String8& address) const;
audio_devices_t getDevicesFromHwModule(audio_module_handle_t moduleHandle) const;
diff --git a/services/audiopolicy/common/managerdefinitions/include/HwModule.h b/services/audiopolicy/common/managerdefinitions/include/HwModule.h
index dd2993d..3a31672 100644
--- a/services/audiopolicy/common/managerdefinitions/include/HwModule.h
+++ b/services/audiopolicy/common/managerdefinitions/include/HwModule.h
@@ -40,7 +40,7 @@
class HwModule : public RefBase
{
public:
- HwModule(const char *name, uint32_t halVersion = AUDIO_DEVICE_API_VERSION_MIN);
+ explicit HwModule(const char *name, uint32_t halVersion = AUDIO_DEVICE_API_VERSION_MIN);
~HwModule();
const char *getName() const { return mName.string(); }
@@ -66,12 +66,12 @@
status_t addInputProfile(const sp<IOProfile> &profile);
status_t addProfile(const sp<IOProfile> &profile);
- status_t addOutputProfile(String8 name, const audio_config_t *config,
- audio_devices_t device, String8 address);
- status_t removeOutputProfile(String8 name);
- status_t addInputProfile(String8 name, const audio_config_t *config,
- audio_devices_t device, String8 address);
- status_t removeInputProfile(String8 name);
+ status_t addOutputProfile(const String8& name, const audio_config_t *config,
+ audio_devices_t device, const String8& address);
+ status_t removeOutputProfile(const String8& name);
+ status_t addInputProfile(const String8& name, const audio_config_t *config,
+ audio_devices_t device, const String8& address);
+ status_t removeInputProfile(const String8& name);
audio_module_handle_t getHandle() const { return mHandle; }
diff --git a/services/audiopolicy/common/managerdefinitions/include/IOProfile.h b/services/audiopolicy/common/managerdefinitions/include/IOProfile.h
index dd20e93..ec04ef7 100644
--- a/services/audiopolicy/common/managerdefinitions/include/IOProfile.h
+++ b/services/audiopolicy/common/managerdefinitions/include/IOProfile.h
@@ -44,7 +44,7 @@
// For input, flags is interpreted as audio_input_flags_t.
// TODO: merge audio_output_flags_t and audio_input_flags_t.
bool isCompatibleProfile(audio_devices_t device,
- String8 address,
+ const String8& address,
uint32_t samplingRate,
uint32_t *updatedSamplingRate,
audio_format_t format,
@@ -110,13 +110,13 @@
class InputProfile : public IOProfile
{
public:
- InputProfile(const String8 &name) : IOProfile(name, AUDIO_PORT_ROLE_SINK) {}
+ explicit InputProfile(const String8 &name) : IOProfile(name, AUDIO_PORT_ROLE_SINK) {}
};
class OutputProfile : public IOProfile
{
public:
- OutputProfile(const String8 &name) : IOProfile(name, AUDIO_PORT_ROLE_SOURCE) {}
+ explicit OutputProfile(const String8 &name) : IOProfile(name, AUDIO_PORT_ROLE_SOURCE) {}
};
}; // namespace android
diff --git a/services/audiopolicy/common/managerdefinitions/include/SessionRoute.h b/services/audiopolicy/common/managerdefinitions/include/SessionRoute.h
index b4feaf0..75bfd9d 100644
--- a/services/audiopolicy/common/managerdefinitions/include/SessionRoute.h
+++ b/services/audiopolicy/common/managerdefinitions/include/SessionRoute.h
@@ -86,7 +86,7 @@
MAPTYPE_OUTPUT = 1
} session_route_map_type_t;
- SessionRouteMap(session_route_map_type_t mapType) :
+ explicit SessionRouteMap(session_route_map_type_t mapType) :
mMapType(mapType)
{}
@@ -106,7 +106,7 @@
void addRoute(audio_session_t session,
audio_stream_type_t streamType,
audio_source_t source,
- sp<DeviceDescriptor> deviceDescriptor,
+ const sp<DeviceDescriptor>& deviceDescriptor,
uid_t uid);
private:
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp
index 79bbc54..1dbc3d0 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp
@@ -75,7 +75,7 @@
}
bool AudioOutputDescriptor::sharesHwModuleWith(
- const sp<AudioOutputDescriptor> outputDesc)
+ const sp<AudioOutputDescriptor>& outputDesc)
{
if (outputDesc->isDuplicated()) {
return sharesHwModuleWith(outputDesc->subOutput1()) ||
@@ -264,7 +264,7 @@
}
bool SwAudioOutputDescriptor::sharesHwModuleWith(
- const sp<AudioOutputDescriptor> outputDesc)
+ const sp<AudioOutputDescriptor>& outputDesc)
{
if (isDuplicated()) {
return mOutput1->sharesHwModuleWith(outputDesc) || mOutput2->sharesHwModuleWith(outputDesc);
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioPatch.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioPatch.cpp
index f382dec..6059009 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioPatch.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioPatch.cpp
@@ -20,7 +20,8 @@
#include "AudioPatch.h"
#include "AudioGain.h"
#include "TypeConverter.h"
-#include <cutils/log.h>
+
+#include <log/log.h>
#include <utils/String8.h>
namespace android {
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioPolicyMix.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioPolicyMix.cpp
index 7ee98b6..02833a9 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioPolicyMix.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioPolicyMix.cpp
@@ -51,7 +51,7 @@
return &mMix;
}
-status_t AudioPolicyMixCollection::registerMix(String8 address, AudioMix mix,
+status_t AudioPolicyMixCollection::registerMix(const String8& address, AudioMix mix,
sp<SwAudioOutputDescriptor> desc)
{
ssize_t index = indexOfKey(address);
@@ -70,7 +70,7 @@
return NO_ERROR;
}
-status_t AudioPolicyMixCollection::unregisterMix(String8 address)
+status_t AudioPolicyMixCollection::unregisterMix(const String8& address)
{
ssize_t index = indexOfKey(address);
if (index < 0) {
@@ -82,7 +82,7 @@
return NO_ERROR;
}
-status_t AudioPolicyMixCollection::getAudioPolicyMix(String8 address,
+status_t AudioPolicyMixCollection::getAudioPolicyMix(const String8& address,
sp<AudioPolicyMix> &policyMix) const
{
ssize_t index = indexOfKey(address);
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioPort.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioPort.cpp
index 17ed537..31bf95c 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioPort.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioPort.cpp
@@ -127,7 +127,7 @@
port->num_gains = i;
}
-void AudioPort::importAudioPort(const sp<AudioPort> port)
+void AudioPort::importAudioPort(const sp<AudioPort>& port)
{
size_t indexToImport;
for (indexToImport = 0; indexToImport < port->mProfiles.size(); indexToImport++) {
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioSession.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioSession.cpp
index da983c5..a246c3d 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioSession.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioSession.cpp
@@ -21,7 +21,8 @@
#include "AudioSession.h"
#include "AudioGain.h"
#include "TypeConverter.h"
-#include <cutils/log.h>
+
+#include <log/log.h>
#include <utils/String8.h>
namespace android {
diff --git a/services/audiopolicy/common/managerdefinitions/src/DeviceDescriptor.cpp b/services/audiopolicy/common/managerdefinitions/src/DeviceDescriptor.cpp
index 50453ad..ba2b9e3 100644
--- a/services/audiopolicy/common/managerdefinitions/src/DeviceDescriptor.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/DeviceDescriptor.cpp
@@ -128,7 +128,7 @@
return devices;
}
-sp<DeviceDescriptor> DeviceVector::getDevice(audio_devices_t type, String8 address) const
+sp<DeviceDescriptor> DeviceVector::getDevice(audio_devices_t type, const String8& address) const
{
sp<DeviceDescriptor> device;
for (size_t i = 0; i < size(); i++) {
@@ -177,7 +177,7 @@
}
DeviceVector DeviceVector::getDevicesFromTypeAddr(
- audio_devices_t type, String8 address) const
+ audio_devices_t type, const String8& address) const
{
DeviceVector devices;
for (size_t i = 0; i < size(); i++) {
@@ -263,7 +263,7 @@
strncpy(port->ext.device.address, mAddress.string(), AUDIO_DEVICE_MAX_ADDRESS_LEN);
}
-void DeviceDescriptor::importAudioPort(const sp<AudioPort> port) {
+void DeviceDescriptor::importAudioPort(const sp<AudioPort>& port) {
AudioPort::importAudioPort(port);
port->pickAudioProfile(mSamplingRate, mChannelMask, mFormat);
}
diff --git a/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp b/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp
index a85c07f..7a942cd 100644
--- a/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp
@@ -42,8 +42,8 @@
}
}
-status_t HwModule::addOutputProfile(String8 name, const audio_config_t *config,
- audio_devices_t device, String8 address)
+status_t HwModule::addOutputProfile(const String8 &name, const audio_config_t *config,
+ audio_devices_t device, const String8 &address)
{
sp<IOProfile> profile = new OutputProfile(name);
@@ -93,7 +93,7 @@
}
}
-status_t HwModule::removeOutputProfile(String8 name)
+status_t HwModule::removeOutputProfile(const String8& name)
{
for (size_t i = 0; i < mOutputProfiles.size(); i++) {
if (mOutputProfiles[i]->getName() == name) {
@@ -105,8 +105,8 @@
return NO_ERROR;
}
-status_t HwModule::addInputProfile(String8 name, const audio_config_t *config,
- audio_devices_t device, String8 address)
+status_t HwModule::addInputProfile(const String8& name, const audio_config_t *config,
+ audio_devices_t device, const String8& address)
{
sp<IOProfile> profile = new InputProfile(name);
profile->addAudioProfile(new AudioProfile(config->format, config->channel_mask,
@@ -122,7 +122,7 @@
return addInputProfile(profile);
}
-status_t HwModule::removeInputProfile(String8 name)
+status_t HwModule::removeInputProfile(const String8& name)
{
for (size_t i = 0; i < mInputProfiles.size(); i++) {
if (mInputProfiles[i]->getName() == name) {
diff --git a/services/audiopolicy/common/managerdefinitions/src/IOProfile.cpp b/services/audiopolicy/common/managerdefinitions/src/IOProfile.cpp
index abf2dd4..57f2534 100644
--- a/services/audiopolicy/common/managerdefinitions/src/IOProfile.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/IOProfile.cpp
@@ -28,7 +28,7 @@
// Sampling rate, format and channel mask must be specified in order to
// get a valid a match
bool IOProfile::isCompatibleProfile(audio_devices_t device,
- String8 address,
+ const String8& address,
uint32_t samplingRate,
uint32_t *updatedSamplingRate,
audio_format_t format,
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
index 3e5bb7d..2ecd6b1 100644
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
@@ -383,6 +383,7 @@
sp<AudioPort> source = ctx->findPortByTagName(String8(devTag));
if (source == NULL) {
ALOGE("%s: no source found with name=%s", __FUNCTION__, devTag);
+ free(sourcesLiteral);
return BAD_VALUE;
}
sources.add(source);
diff --git a/services/audiopolicy/common/managerdefinitions/src/SessionRoute.cpp b/services/audiopolicy/common/managerdefinitions/src/SessionRoute.cpp
index 7ecfa44..689f4e6 100644
--- a/services/audiopolicy/common/managerdefinitions/src/SessionRoute.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/SessionRoute.cpp
@@ -90,7 +90,7 @@
void SessionRouteMap::addRoute(audio_session_t session,
audio_stream_type_t streamType,
audio_source_t source,
- sp<DeviceDescriptor> descriptor,
+ const sp<DeviceDescriptor>& descriptor,
uid_t uid)
{
if (mMapType == MAPTYPE_INPUT && streamType != SessionRoute::STREAM_TYPE_NA) {
diff --git a/services/audiopolicy/config/a2dp_audio_policy_configuration.xml b/services/audiopolicy/config/a2dp_audio_policy_configuration.xml
index ced7463..7bcab5c 100644
--- a/services/audiopolicy/config/a2dp_audio_policy_configuration.xml
+++ b/services/audiopolicy/config/a2dp_audio_policy_configuration.xml
@@ -2,11 +2,7 @@
<!-- A2dp Audio HAL Audio Policy Configuration file -->
<module name="a2dp" halVersion="2.0">
<mixPorts>
- <mixPort name="a2dp output" role="source">
- <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
- samplingRates="44100"
- channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
- </mixPort>
+ <mixPort name="a2dp output" role="source"/>
<mixPort name="a2dp input" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="44100,48000"
diff --git a/services/audiopolicy/engineconfigurable/Android.mk b/services/audiopolicy/engineconfigurable/Android.mk
index 6dba75b..116077d 100755
--- a/services/audiopolicy/engineconfigurable/Android.mk
+++ b/services/audiopolicy/engineconfigurable/Android.mk
@@ -46,6 +46,7 @@
libxml2
LOCAL_SHARED_LIBRARIES := \
+ liblog \
libcutils \
libutils \
libaudioutils \
diff --git a/services/audiopolicy/engineconfigurable/wrapper/Android.mk b/services/audiopolicy/engineconfigurable/wrapper/Android.mk
index f4283a8..c5990ac 100644
--- a/services/audiopolicy/engineconfigurable/wrapper/Android.mk
+++ b/services/audiopolicy/engineconfigurable/wrapper/Android.mk
@@ -8,7 +8,6 @@
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include \
- $(TARGET_OUT_HEADERS)/parameter \
$(TOPDIR)frameworks/av/services/audiopolicy/engineconfigurable/include \
$(TOPDIR)frameworks/av/services/audiopolicy/engineconfigurable/interface \
$(TOPDIR)frameworks/av/services/audiopolicy/utilities/convert \
@@ -18,6 +17,9 @@
LOCAL_STATIC_LIBRARIES := \
libmedia_helper \
+LOCAL_SHARED_LIBRARIES := \
+ libparameter \
+
LOCAL_MULTILIB := $(AUDIOSERVER_MULTILIB)
LOCAL_MODULE:= libaudiopolicypfwwrapper
diff --git a/services/audiopolicy/engineconfigurable/wrapper/ParameterManagerWrapper.cpp b/services/audiopolicy/engineconfigurable/wrapper/ParameterManagerWrapper.cpp
index 6872e52..fe15d86 100755
--- a/services/audiopolicy/engineconfigurable/wrapper/ParameterManagerWrapper.cpp
+++ b/services/audiopolicy/engineconfigurable/wrapper/ParameterManagerWrapper.cpp
@@ -48,7 +48,7 @@
virtual void info(const string &log)
{
- ALOGD("policy-parameter-manager: %s", log.c_str());
+ ALOGV("policy-parameter-manager: %s", log.c_str());
}
virtual void warning(const string &log)
{
diff --git a/services/audiopolicy/enginedefault/Android.mk b/services/audiopolicy/enginedefault/Android.mk
index 85d1822..e6de8ae 100755
--- a/services/audiopolicy/enginedefault/Android.mk
+++ b/services/audiopolicy/enginedefault/Android.mk
@@ -40,8 +40,8 @@
libxml2
LOCAL_SHARED_LIBRARIES += \
+ liblog \
libcutils \
libutils \
- libaudioutils \
include $(BUILD_SHARED_LIBRARY)
diff --git a/services/audiopolicy/enginedefault/src/Engine.h b/services/audiopolicy/enginedefault/src/Engine.h
index 606ad28..57538c4 100755
--- a/services/audiopolicy/enginedefault/src/Engine.h
+++ b/services/audiopolicy/enginedefault/src/Engine.h
@@ -43,7 +43,7 @@
class ManagerInterfaceImpl : public AudioPolicyManagerInterface
{
public:
- ManagerInterfaceImpl(Engine *policyEngine)
+ explicit ManagerInterfaceImpl(Engine *policyEngine)
: mPolicyEngine(policyEngine) {}
virtual void setObserver(AudioPolicyManagerObserver *observer)
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index d265f11..8cb5e0f 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -64,6 +64,17 @@
return setDeviceConnectionStateInt(device, state, device_address, device_name);
}
+void AudioPolicyManager::broadcastDeviceConnectionState(audio_devices_t device,
+ audio_policy_dev_state_t state,
+ const String8 &device_address)
+{
+ AudioParameter param(device_address);
+ const String8 key(state == AUDIO_POLICY_DEVICE_STATE_AVAILABLE ?
+ AUDIO_PARAMETER_DEVICE_CONNECT : AUDIO_PARAMETER_DEVICE_DISCONNECT);
+ param.addInt(key, device);
+ mpClientInterface->setParameters(AUDIO_IO_HANDLE_NONE, param.toString());
+}
+
status_t AudioPolicyManager::setDeviceConnectionStateInt(audio_devices_t device,
audio_policy_dev_state_t state,
const char *device_address,
@@ -112,8 +123,15 @@
return NO_MEMORY;
}
+ // Before checking outputs, broadcast connect event to allow HAL to retrieve dynamic
+ // parameters on newly connected devices (instead of opening the outputs...)
+ broadcastDeviceConnectionState(device, state, devDesc->mAddress);
+
if (checkOutputsForDevice(devDesc, state, outputs, devDesc->mAddress) != NO_ERROR) {
mAvailableOutputDevices.remove(devDesc);
+
+ broadcastDeviceConnectionState(device, AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE,
+ devDesc->mAddress);
return INVALID_OPERATION;
}
// Propagate device availability to Engine
@@ -125,11 +143,6 @@
ALOGV("setDeviceConnectionState() checkOutputsForDevice() returned %zu outputs",
outputs.size());
- // Send connect to HALs
- AudioParameter param = AudioParameter(devDesc->mAddress);
- param.addInt(String8(AUDIO_PARAMETER_DEVICE_CONNECT), device);
- mpClientInterface->setParameters(AUDIO_IO_HANDLE_NONE, param.toString());
-
} break;
// handle output device disconnection
case AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE: {
@@ -141,9 +154,7 @@
ALOGV("setDeviceConnectionState() disconnecting output device %x", device);
// Send Disconnect to HALs
- AudioParameter param = AudioParameter(devDesc->mAddress);
- param.addInt(String8(AUDIO_PARAMETER_DEVICE_DISCONNECT), device);
- mpClientInterface->setParameters(AUDIO_IO_HANDLE_NONE, param.toString());
+ broadcastDeviceConnectionState(device, state, devDesc->mAddress);
// remove device from available output devices
mAvailableOutputDevices.remove(devDesc);
@@ -226,7 +237,14 @@
device);
return INVALID_OPERATION;
}
+
+ // Before checking intputs, broadcast connect event to allow HAL to retrieve dynamic
+ // parameters on newly connected devices (instead of opening the inputs...)
+ broadcastDeviceConnectionState(device, state, devDesc->mAddress);
+
if (checkInputsForDevice(devDesc, state, inputs, devDesc->mAddress) != NO_ERROR) {
+ broadcastDeviceConnectionState(device, AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE,
+ devDesc->mAddress);
return INVALID_OPERATION;
}
@@ -237,11 +255,6 @@
return NO_MEMORY;
}
- // Set connect to HALs
- AudioParameter param = AudioParameter(devDesc->mAddress);
- param.addInt(String8(AUDIO_PARAMETER_DEVICE_CONNECT), device);
- mpClientInterface->setParameters(AUDIO_IO_HANDLE_NONE, param.toString());
-
// Propagate device availability to Engine
mEngine->setDeviceConnectionState(devDesc, state);
} break;
@@ -256,9 +269,7 @@
ALOGV("setDeviceConnectionState() disconnecting input device %x", device);
// Set Disconnect to HALs
- AudioParameter param = AudioParameter(devDesc->mAddress);
- param.addInt(String8(AUDIO_PARAMETER_DEVICE_DISCONNECT), device);
- mpClientInterface->setParameters(AUDIO_IO_HANDLE_NONE, param.toString());
+ broadcastDeviceConnectionState(device, state, devDesc->mAddress);
checkInputsForDevice(devDesc, state, inputs, devDesc->mAddress);
mAvailableInputDevices.remove(devDesc);
@@ -322,6 +333,50 @@
AUDIO_POLICY_DEVICE_STATE_AVAILABLE : AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE;
}
+status_t AudioPolicyManager::handleDeviceConfigChange(audio_devices_t device,
+ const char *device_address,
+ const char *device_name)
+{
+ status_t status;
+
+ ALOGV("handleDeviceConfigChange(() device: 0x%X, address %s name %s",
+ device, device_address, device_name);
+
+ // connect/disconnect only 1 device at a time
+ if (!audio_is_output_device(device) && !audio_is_input_device(device)) return BAD_VALUE;
+
+ // Check if the device is currently connected
+ sp<DeviceDescriptor> devDesc =
+ mHwModules.getDeviceDescriptor(device, device_address, device_name);
+ ssize_t index = mAvailableOutputDevices.indexOf(devDesc);
+ if (index < 0) {
+ // Nothing to do: device is not connected
+ return NO_ERROR;
+ }
+
+ // Toggle the device state: UNAVAILABLE -> AVAILABLE
+ // This will force reading again the device configuration
+ status = setDeviceConnectionState(device,
+ AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE,
+ device_address, device_name);
+ if (status != NO_ERROR) {
+ ALOGW("handleDeviceConfigChange() error disabling connection state: %d",
+ status);
+ return status;
+ }
+
+ status = setDeviceConnectionState(device,
+ AUDIO_POLICY_DEVICE_STATE_AVAILABLE,
+ device_address, device_name);
+ if (status != NO_ERROR) {
+ ALOGW("handleDeviceConfigChange() error enabling connection state: %d",
+ status);
+ return status;
+ }
+
+ return NO_ERROR;
+}
+
uint32_t AudioPolicyManager::updateCallRouting(audio_devices_t rxDevice, uint32_t delayMs)
{
bool createTxPatch = false;
@@ -1148,7 +1203,7 @@
return status;
}
-status_t AudioPolicyManager::startSource(sp<AudioOutputDescriptor> outputDesc,
+status_t AudioPolicyManager::startSource(const sp<AudioOutputDescriptor>& outputDesc,
audio_stream_type_t stream,
audio_devices_t device,
const char *address,
@@ -1286,7 +1341,7 @@
return stopSource(outputDesc, stream, forceDeviceUpdate);
}
-status_t AudioPolicyManager::stopSource(sp<AudioOutputDescriptor> outputDesc,
+status_t AudioPolicyManager::stopSource(const sp<AudioOutputDescriptor>& outputDesc,
audio_stream_type_t stream,
bool forceDeviceUpdate)
{
@@ -2094,7 +2149,7 @@
// - 2 if none found, look for a mix matching the attributes usage
// - 3 if none found, default to device and output selection by policy rules.
-status_t AudioPolicyManager::registerPolicyMixes(Vector<AudioMix> mixes)
+status_t AudioPolicyManager::registerPolicyMixes(const Vector<AudioMix>& mixes)
{
ALOGV("registerPolicyMixes() %zu mix(es)", mixes.size());
status_t res = NO_ERROR;
@@ -3633,7 +3688,7 @@
// ---
-void AudioPolicyManager::addOutput(audio_io_handle_t output, sp<SwAudioOutputDescriptor> outputDesc)
+void AudioPolicyManager::addOutput(audio_io_handle_t output, const sp<SwAudioOutputDescriptor>& outputDesc)
{
outputDesc->setIoHandle(output);
mOutputs.add(output, outputDesc);
@@ -3646,16 +3701,16 @@
mOutputs.removeItem(output);
}
-void AudioPolicyManager::addInput(audio_io_handle_t input, sp<AudioInputDescriptor> inputDesc)
+void AudioPolicyManager::addInput(audio_io_handle_t input, const sp<AudioInputDescriptor>& inputDesc)
{
inputDesc->setIoHandle(input);
mInputs.add(input, inputDesc);
nextAudioPortGeneration();
}
-void AudioPolicyManager::findIoHandlesByAddress(sp<SwAudioOutputDescriptor> desc /*in*/,
+void AudioPolicyManager::findIoHandlesByAddress(const sp<SwAudioOutputDescriptor>& desc /*in*/,
const audio_devices_t device /*in*/,
- const String8 address /*in*/,
+ const String8& address /*in*/,
SortedVector<audio_io_handle_t>& outputs /*out*/) {
sp<DeviceDescriptor> devDesc =
desc->mProfile->getSupportedDeviceByAddress(device, address);
@@ -3666,10 +3721,10 @@
}
}
-status_t AudioPolicyManager::checkOutputsForDevice(const sp<DeviceDescriptor> devDesc,
+status_t AudioPolicyManager::checkOutputsForDevice(const sp<DeviceDescriptor>& devDesc,
audio_policy_dev_state_t state,
SortedVector<audio_io_handle_t>& outputs,
- const String8 address)
+ const String8& address)
{
audio_devices_t device = devDesc->type();
sp<SwAudioOutputDescriptor> desc;
@@ -3912,10 +3967,10 @@
return NO_ERROR;
}
-status_t AudioPolicyManager::checkInputsForDevice(const sp<DeviceDescriptor> devDesc,
+status_t AudioPolicyManager::checkInputsForDevice(const sp<DeviceDescriptor>& devDesc,
audio_policy_dev_state_t state,
SortedVector<audio_io_handle_t>& inputs,
- const String8 address)
+ const String8& address)
{
audio_devices_t device = devDesc->type();
sp<AudioInputDescriptor> desc;
@@ -4156,13 +4211,13 @@
SortedVector<audio_io_handle_t> AudioPolicyManager::getOutputsForDevice(
audio_devices_t device,
- SwAudioOutputCollection openOutputs)
+ const SwAudioOutputCollection& openOutputs)
{
SortedVector<audio_io_handle_t> outputs;
ALOGVV("getOutputsForDevice() device %04x", device);
for (size_t i = 0; i < openOutputs.size(); i++) {
- ALOGVV("output %d isDuplicated=%d device=%04x",
+ ALOGVV("output %zu isDuplicated=%d device=%04x",
i, openOutputs.valueAt(i)->isDuplicated(),
openOutputs.valueAt(i)->supportedDevices());
if ((device & openOutputs.valueAt(i)->supportedDevices()) == device) {
@@ -4567,7 +4622,7 @@
mPreviousOutputs = mOutputs;
}
-uint32_t AudioPolicyManager::checkDeviceMuteStrategies(sp<AudioOutputDescriptor> outputDesc,
+uint32_t AudioPolicyManager::checkDeviceMuteStrategies(const sp<AudioOutputDescriptor>& outputDesc,
audio_devices_t prevDevice,
uint32_t delayMs)
{
@@ -4603,7 +4658,7 @@
== AUDIO_DEVICE_NONE) {
continue;
}
- ALOGVV("checkDeviceMuteStrategies() %s strategy %d (curDevice %04x)",
+ ALOGVV("checkDeviceMuteStrategies() %s strategy %zu (curDevice %04x)",
mute ? "muting" : "unmuting", i, curDevice);
setStrategyMute((routing_strategy)i, mute, desc, mute ? 0 : delayMs);
if (isStrategyActive(desc, (routing_strategy)i)) {
@@ -4889,7 +4944,7 @@
}
sp<IOProfile> AudioPolicyManager::getInputProfile(audio_devices_t device,
- String8 address,
+ const String8& address,
uint32_t& samplingRate,
audio_format_t& format,
audio_channel_mask_t& channelMask,
@@ -5275,7 +5330,7 @@
return true;
}
-bool AudioPolicyManager::isStrategyActive(const sp<AudioOutputDescriptor> outputDesc,
+bool AudioPolicyManager::isStrategyActive(const sp<AudioOutputDescriptor>& outputDesc,
routing_strategy strategy, uint32_t inPastMs,
nsecs_t sysTime) const
{
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.h b/services/audiopolicy/managerdefault/AudioPolicyManager.h
index 71bcd5f..3cfe508 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.h
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h
@@ -83,7 +83,7 @@
{
public:
- AudioPolicyManager(AudioPolicyClientInterface *clientInterface);
+ explicit AudioPolicyManager(AudioPolicyClientInterface *clientInterface);
virtual ~AudioPolicyManager();
// AudioPolicyInterface
@@ -93,6 +93,9 @@
const char *device_name);
virtual audio_policy_dev_state_t getDeviceConnectionState(audio_devices_t device,
const char *device_address);
+ virtual status_t handleDeviceConfigChange(audio_devices_t device,
+ const char *device_address,
+ const char *device_name);
virtual void setPhoneState(audio_mode_t state);
virtual void setForceUse(audio_policy_force_use_t usage,
audio_policy_forced_cfg_t config);
@@ -222,7 +225,7 @@
return mSoundTriggerSessions.releaseSession(session);
}
- virtual status_t registerPolicyMixes(Vector<AudioMix> mixes);
+ virtual status_t registerPolicyMixes(const Vector<AudioMix>& mixes);
virtual status_t unregisterPolicyMixes(Vector<AudioMix> mixes);
virtual status_t startAudioSource(const struct audio_port_config *source,
@@ -273,9 +276,9 @@
return mDefaultOutputDevice;
}
protected:
- void addOutput(audio_io_handle_t output, sp<SwAudioOutputDescriptor> outputDesc);
+ void addOutput(audio_io_handle_t output, const sp<SwAudioOutputDescriptor>& outputDesc);
void removeOutput(audio_io_handle_t output);
- void addInput(audio_io_handle_t input, sp<AudioInputDescriptor> inputDesc);
+ void addInput(audio_io_handle_t input, const sp<AudioInputDescriptor>& inputDesc);
// return appropriate device for streams handled by the specified strategy according to current
// phone state, connected devices...
@@ -291,7 +294,7 @@
virtual audio_devices_t getDeviceForStrategy(routing_strategy strategy,
bool fromCache);
- bool isStrategyActive(const sp<AudioOutputDescriptor> outputDesc, routing_strategy strategy,
+ bool isStrategyActive(const sp<AudioOutputDescriptor>& outputDesc, routing_strategy strategy,
uint32_t inPastMs = 0, nsecs_t sysTime = 0) const;
// change the route of the specified output. Returns the number of ms we have slept to
@@ -362,15 +365,15 @@
// when a device is disconnected, checks if an output is not used any more and
// returns its handle if any.
// transfers the audio tracks and effects from one output thread to another accordingly.
- status_t checkOutputsForDevice(const sp<DeviceDescriptor> devDesc,
+ status_t checkOutputsForDevice(const sp<DeviceDescriptor>& devDesc,
audio_policy_dev_state_t state,
SortedVector<audio_io_handle_t>& outputs,
- const String8 address);
+ const String8& address);
- status_t checkInputsForDevice(const sp<DeviceDescriptor> devDesc,
+ status_t checkInputsForDevice(const sp<DeviceDescriptor>& devDesc,
audio_policy_dev_state_t state,
SortedVector<audio_io_handle_t>& inputs,
- const String8 address);
+ const String8& address);
// close an output and its companion duplicating output.
void closeOutput(audio_io_handle_t output);
@@ -423,7 +426,7 @@
#endif //AUDIO_POLICY_TEST
SortedVector<audio_io_handle_t> getOutputsForDevice(audio_devices_t device,
- SwAudioOutputCollection openOutputs);
+ const SwAudioOutputCollection& openOutputs);
bool vectorsEqual(SortedVector<audio_io_handle_t>& outputs1,
SortedVector<audio_io_handle_t>& outputs2);
@@ -431,7 +434,7 @@
// if muting, wait for the audio in pcm buffer to be drained before proceeding
// if unmuting, unmute only after the specified delay
// Returns the number of ms waited
- virtual uint32_t checkDeviceMuteStrategies(sp<AudioOutputDescriptor> outputDesc,
+ virtual uint32_t checkDeviceMuteStrategies(const sp<AudioOutputDescriptor>& outputDesc,
audio_devices_t prevDevice,
uint32_t delayMs);
@@ -440,7 +443,7 @@
audio_format_t format);
// samplingRate, format, channelMask are in/out and so may be modified
sp<IOProfile> getInputProfile(audio_devices_t device,
- String8 address,
+ const String8& address,
uint32_t& samplingRate,
audio_format_t& format,
audio_channel_mask_t& channelMask,
@@ -481,12 +484,12 @@
// if argument "device" is different from AUDIO_DEVICE_NONE, startSource() will force
// the re-evaluation of the output device.
- status_t startSource(sp<AudioOutputDescriptor> outputDesc,
+ status_t startSource(const sp<AudioOutputDescriptor>& outputDesc,
audio_stream_type_t stream,
audio_devices_t device,
const char *address,
uint32_t *delayMs);
- status_t stopSource(sp<AudioOutputDescriptor> outputDesc,
+ status_t stopSource(const sp<AudioOutputDescriptor>& outputDesc,
audio_stream_type_t stream,
bool forceDeviceUpdate);
@@ -594,6 +597,15 @@
void updateAudioProfiles(audio_devices_t device, audio_io_handle_t ioHandle,
AudioProfileVector &profiles);
+ // Notify the policy client of any change of device state with AUDIO_IO_HANDLE_NONE,
+ // so that the client interprets it as global to audio hardware interfaces.
+ // It can give a chance to HAL implementer to retrieve dynamic capabilities associated
+ // to this device for example.
+ // TODO avoid opening stream to retrieve capabilities of a profile.
+ void broadcastDeviceConnectionState(audio_devices_t device,
+ audio_policy_dev_state_t state,
+ const String8 &device_address);
+
// updates device caching and output for streams that can influence the
// routing of notifications
void handleNotificationRoutingForStream(audio_stream_type_t stream);
@@ -602,9 +614,9 @@
// in mProfile->mSupportedDevices) matches the device whose address is to be matched.
// see deviceDistinguishesOnAddress(audio_devices_t) for whether the device type is one
// where addresses are used to distinguish between one connected device and another.
- void findIoHandlesByAddress(sp<SwAudioOutputDescriptor> desc /*in*/,
+ void findIoHandlesByAddress(const sp<SwAudioOutputDescriptor>& desc /*in*/,
const audio_devices_t device /*in*/,
- const String8 address /*in*/,
+ const String8& address /*in*/,
SortedVector<audio_io_handle_t>& outputs /*out*/);
uint32_t curAudioPortGeneration() const { return mAudioPortGeneration; }
// internal method to return the output handle for the given device and format
diff --git a/services/audiopolicy/service/AudioPolicyClientImplLegacy.cpp b/services/audiopolicy/service/AudioPolicyClientImplLegacy.cpp
index 151d066..dabffe6 100644
--- a/services/audiopolicy/service/AudioPolicyClientImplLegacy.cpp
+++ b/services/audiopolicy/service/AudioPolicyClientImplLegacy.cpp
@@ -56,7 +56,7 @@
sp<IAudioFlinger> af = AudioSystem::get_audio_flinger();
if (af == 0) {
ALOGW("%s: could not get AudioFlinger", __func__);
- return 0;
+ return AUDIO_MODULE_HANDLE_NONE;
}
return af->loadHwModule(name);
diff --git a/services/audiopolicy/service/AudioPolicyEffects.h b/services/audiopolicy/service/AudioPolicyEffects.h
index ee9bd50..afdaf98 100644
--- a/services/audiopolicy/service/AudioPolicyEffects.h
+++ b/services/audiopolicy/service/AudioPolicyEffects.h
@@ -135,7 +135,7 @@
// class to store voctor of AudioEffects
class EffectVector {
public:
- EffectVector(audio_session_t session) : mSessionId(session), mRefCount(0) {}
+ explicit EffectVector(audio_session_t session) : mSessionId(session), mRefCount(0) {}
/*virtual*/ ~EffectVector() {}
// Enable or disable all effects in effect vector
diff --git a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
index a75e3dd..0387ee6 100644
--- a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
+++ b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
@@ -37,9 +37,6 @@
if (!settingsAllowed()) {
return PERMISSION_DENIED;
}
- if (!audio_is_output_device(device) && !audio_is_input_device(device)) {
- return BAD_VALUE;
- }
if (state != AUDIO_POLICY_DEVICE_STATE_AVAILABLE &&
state != AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE) {
return BAD_VALUE;
@@ -62,6 +59,23 @@
device_address);
}
+status_t AudioPolicyService::handleDeviceConfigChange(audio_devices_t device,
+ const char *device_address,
+ const char *device_name)
+{
+ if (mAudioPolicyManager == NULL) {
+ return NO_INIT;
+ }
+ if (!settingsAllowed()) {
+ return PERMISSION_DENIED;
+ }
+
+ ALOGV("handleDeviceConfigChange()");
+ Mutex::Autolock _l(mLock);
+ return mAudioPolicyManager->handleDeviceConfigChange(device, device_address,
+ device_name);
+}
+
status_t AudioPolicyService::setPhoneState(audio_mode_t state)
{
if (mAudioPolicyManager == NULL) {
@@ -681,7 +695,7 @@
return mAudioPolicyManager->releaseSoundTriggerSession(session);
}
-status_t AudioPolicyService::registerPolicyMixes(Vector<AudioMix> mixes, bool registration)
+status_t AudioPolicyService::registerPolicyMixes(const Vector<AudioMix>& mixes, bool registration)
{
Mutex::Autolock _l(mLock);
if(!modifyAudioRoutingAllowed()) {
diff --git a/services/audiopolicy/service/AudioPolicyInterfaceImplLegacy.cpp b/services/audiopolicy/service/AudioPolicyInterfaceImplLegacy.cpp
index 7c9315d..946c380 100644
--- a/services/audiopolicy/service/AudioPolicyInterfaceImplLegacy.cpp
+++ b/services/audiopolicy/service/AudioPolicyInterfaceImplLegacy.cpp
@@ -602,7 +602,7 @@
return INVALID_OPERATION;
}
-status_t AudioPolicyService::registerPolicyMixes(Vector<AudioMix> mixes __unused,
+status_t AudioPolicyService::registerPolicyMixes(const Vector<AudioMix>& mixes __unused,
bool registration __unused)
{
return INVALID_OPERATION;
diff --git a/services/audiopolicy/service/AudioPolicyService.cpp b/services/audiopolicy/service/AudioPolicyService.cpp
index d24e9a0..52ed73e 100644
--- a/services/audiopolicy/service/AudioPolicyService.cpp
+++ b/services/audiopolicy/service/AudioPolicyService.cpp
@@ -221,14 +221,14 @@
}
}
-void AudioPolicyService::onDynamicPolicyMixStateUpdate(String8 regId, int32_t state)
+void AudioPolicyService::onDynamicPolicyMixStateUpdate(const String8& regId, int32_t state)
{
ALOGV("AudioPolicyService::onDynamicPolicyMixStateUpdate(%s, %d)",
regId.string(), state);
mOutputCommandThread->dynamicPolicyMixStateUpdateCommand(regId, state);
}
-void AudioPolicyService::doOnDynamicPolicyMixStateUpdate(String8 regId, int32_t state)
+void AudioPolicyService::doOnDynamicPolicyMixStateUpdate(const String8& regId, int32_t state)
{
Mutex::Autolock _l(mNotificationClientsLock);
for (size_t i = 0; i < mNotificationClients.size(); i++) {
@@ -310,7 +310,7 @@
}
void AudioPolicyService::NotificationClient::onDynamicPolicyMixStateUpdate(
- String8 regId, int32_t state)
+ const String8& regId, int32_t state)
{
if (mAudioPolicyServiceClient != 0) {
mAudioPolicyServiceClient->onDynamicPolicyMixStateUpdate(regId, state);
@@ -857,7 +857,7 @@
}
void AudioPolicyService::AudioCommandThread::dynamicPolicyMixStateUpdateCommand(
- String8 regId, int32_t state)
+ const String8& regId, int32_t state)
{
sp<AudioCommand> command = new AudioCommand();
command->mCommand = DYN_POLICY_MIX_STATE_UPDATE;
diff --git a/services/audiopolicy/service/AudioPolicyService.h b/services/audiopolicy/service/AudioPolicyService.h
index 0b2cb35..8c9b23c 100644
--- a/services/audiopolicy/service/AudioPolicyService.h
+++ b/services/audiopolicy/service/AudioPolicyService.h
@@ -66,6 +66,9 @@
virtual audio_policy_dev_state_t getDeviceConnectionState(
audio_devices_t device,
const char *device_address);
+ virtual status_t handleDeviceConfigChange(audio_devices_t device,
+ const char *device_address,
+ const char *device_name);
virtual status_t setPhoneState(audio_mode_t state);
virtual status_t setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config);
virtual audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage);
@@ -196,7 +199,7 @@
virtual audio_mode_t getPhoneState();
- virtual status_t registerPolicyMixes(Vector<AudioMix> mixes, bool registration);
+ virtual status_t registerPolicyMixes(const Vector<AudioMix>& mixes, bool registration);
virtual status_t startAudioSource(const struct audio_port_config *source,
const audio_attributes_t *attributes,
@@ -227,8 +230,8 @@
void onAudioPatchListUpdate();
void doOnAudioPatchListUpdate();
- void onDynamicPolicyMixStateUpdate(String8 regId, int32_t state);
- void doOnDynamicPolicyMixStateUpdate(String8 regId, int32_t state);
+ void onDynamicPolicyMixStateUpdate(const String8& regId, int32_t state);
+ void doOnDynamicPolicyMixStateUpdate(const String8& regId, int32_t state);
void onRecordingConfigurationUpdate(int event, audio_session_t session,
audio_source_t source, const audio_config_base_t *clientConfig,
const audio_config_base_t *deviceConfig, audio_patch_handle_t patchHandle);
@@ -305,7 +308,7 @@
void updateAudioPatchListCommand();
status_t setAudioPortConfigCommand(const struct audio_port_config *config,
int delayMs);
- void dynamicPolicyMixStateUpdateCommand(String8 regId, int32_t state);
+ void dynamicPolicyMixStateUpdateCommand(const String8& regId, int32_t state);
void recordingConfigurationUpdateCommand(
int event, audio_session_t session,
audio_source_t source,
@@ -424,7 +427,7 @@
class AudioPolicyClient : public AudioPolicyClientInterface
{
public:
- AudioPolicyClient(AudioPolicyService *service) : mAudioPolicyService(service) {}
+ explicit AudioPolicyClient(AudioPolicyService *service) : mAudioPolicyService(service) {}
virtual ~AudioPolicyClient() {}
//
@@ -539,7 +542,7 @@
void onAudioPortListUpdate();
void onAudioPatchListUpdate();
- void onDynamicPolicyMixStateUpdate(String8 regId, int32_t state);
+ void onDynamicPolicyMixStateUpdate(const String8& regId, int32_t state);
void onRecordingConfigurationUpdate(
int event, audio_session_t session,
audio_source_t source,
diff --git a/services/camera/libcameraservice/Android.mk b/services/camera/libcameraservice/Android.mk
index 8d7f71c..7feed6b 100644
--- a/services/camera/libcameraservice/Android.mk
+++ b/services/camera/libcameraservice/Android.mk
@@ -65,11 +65,12 @@
libcamera_client \
libgui \
libhardware \
- libsync \
libcamera_metadata \
libjpeg \
libmemunreachable
+LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libbinder libcamera_client
+
LOCAL_C_INCLUDES += \
system/media/private/camera/include \
frameworks/native/include/media/openmax \
diff --git a/services/camera/libcameraservice/CameraFlashlight.cpp b/services/camera/libcameraservice/CameraFlashlight.cpp
index ad08a68..6314ba5 100644
--- a/services/camera/libcameraservice/CameraFlashlight.cpp
+++ b/services/camera/libcameraservice/CameraFlashlight.cpp
@@ -812,7 +812,7 @@
}
status_t CameraHardwareInterfaceFlashControl::initializePreviewWindow(
- sp<CameraHardwareInterface> device, int32_t width, int32_t height) {
+ const sp<CameraHardwareInterface>& device, int32_t width, int32_t height) {
status_t res;
BufferQueue::createBufferQueue(&mProducer, &mConsumer);
diff --git a/services/camera/libcameraservice/CameraFlashlight.h b/services/camera/libcameraservice/CameraFlashlight.h
index 5cde372..59fc87d 100644
--- a/services/camera/libcameraservice/CameraFlashlight.h
+++ b/services/camera/libcameraservice/CameraFlashlight.h
@@ -193,7 +193,7 @@
status_t disconnectCameraDevice();
// initialize the preview window
- status_t initializePreviewWindow(sp<CameraHardwareInterface> device,
+ status_t initializePreviewWindow(const sp<CameraHardwareInterface>& device,
int32_t width, int32_t height);
// start preview and enable torch
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index 6124fed..85faac6 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -31,6 +31,7 @@
#include <android/hardware/ICamera.h>
#include <android/hardware/ICameraClient.h>
+#include <android-base/macros.h>
#include <binder/AppOpsManager.h>
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
@@ -103,7 +104,7 @@
sp<CameraService> cs = const_cast<CameraService*>(
static_cast<const CameraService*>(callbacks));
- cs->onDeviceStatusChanged(static_cast<camera_device_status_t>(camera_id),
+ cs->onDeviceStatusChanged(camera_id,
static_cast<camera_device_status_t>(new_status));
}
@@ -272,12 +273,14 @@
}
sp<ICameraServiceProxy> CameraService::getCameraServiceProxy() {
+ sp<ICameraServiceProxy> proxyBinder = nullptr;
+#ifndef __BRILLO__
sp<IServiceManager> sm = defaultServiceManager();
sp<IBinder> binder = sm->getService(String16("media.camera.proxy"));
- if (binder == nullptr) {
- return nullptr;
+ if (binder != nullptr) {
+ proxyBinder = interface_cast<ICameraServiceProxy>(binder);
}
- sp<ICameraServiceProxy> proxyBinder = interface_cast<ICameraServiceProxy>(binder);
+#endif
return proxyBinder;
}
@@ -296,7 +299,7 @@
gCameraService = nullptr;
}
-void CameraService::onDeviceStatusChanged(camera_device_status_t cameraId,
+void CameraService::onDeviceStatusChanged(int cameraId,
camera_device_status_t newStatus) {
ALOGI("%s: Status changed for cameraId=%d, newStatus=%d", __FUNCTION__,
cameraId, newStatus);
@@ -924,6 +927,53 @@
const String8& clientName8, /*inout*/int& clientUid, /*inout*/int& clientPid,
/*out*/int& originalClientPid) const {
+#ifdef __BRILLO__
+ UNUSED(clientName8);
+ UNUSED(clientUid);
+ UNUSED(clientPid);
+ UNUSED(originalClientPid);
+#else
+ Status allowed = validateClientPermissionsLocked(cameraId, clientName8, clientUid, clientPid,
+ originalClientPid);
+ if (!allowed.isOk()) {
+ return allowed;
+ }
+#endif // __BRILLO__
+
+ int callingPid = getCallingPid();
+
+ if (!mModule) {
+ ALOGE("CameraService::connect X (PID %d) rejected (camera HAL module not loaded)",
+ callingPid);
+ return STATUS_ERROR_FMT(ERROR_DISCONNECTED,
+ "No camera HAL module available to open camera device \"%s\"", cameraId.string());
+ }
+
+ if (getCameraState(cameraId) == nullptr) {
+ ALOGE("CameraService::connect X (PID %d) rejected (invalid camera ID %s)", callingPid,
+ cameraId.string());
+ return STATUS_ERROR_FMT(ERROR_DISCONNECTED,
+ "No camera device with ID \"%s\" available", cameraId.string());
+ }
+
+ status_t err = checkIfDeviceIsUsable(cameraId);
+ if (err != NO_ERROR) {
+ switch(err) {
+ case -ENODEV:
+ case -EBUSY:
+ return STATUS_ERROR_FMT(ERROR_DISCONNECTED,
+ "No camera device with ID \"%s\" currently available", cameraId.string());
+ default:
+ return STATUS_ERROR_FMT(ERROR_INVALID_OPERATION,
+ "Unknown error connecting to ID \"%s\"", cameraId.string());
+ }
+ }
+ return Status::ok();
+}
+
+Status CameraService::validateClientPermissionsLocked(const String8& cameraId,
+ const String8& clientName8, int& clientUid, int& clientPid,
+ /*out*/int& originalClientPid) const {
int callingPid = getCallingPid();
int callingUid = getCallingUid();
@@ -967,20 +1017,6 @@
originalClientPid = clientPid;
clientPid = callingPid;
- if (!mModule) {
- ALOGE("CameraService::connect X (PID %d) rejected (camera HAL module not loaded)",
- callingPid);
- return STATUS_ERROR_FMT(ERROR_DISCONNECTED,
- "No camera HAL module available to open camera device \"%s\"", cameraId.string());
- }
-
- if (getCameraState(cameraId) == nullptr) {
- ALOGE("CameraService::connect X (PID %d) rejected (invalid camera ID %s)", callingPid,
- cameraId.string());
- return STATUS_ERROR_FMT(ERROR_DISCONNECTED,
- "No camera device with ID \"%s\" available", cameraId.string());
- }
-
userid_t clientUserId = multiuser_get_user_id(clientUid);
// Only allow clients who are being used by the current foreground device user, unless calling
@@ -994,18 +1030,6 @@
clientUserId, cameraId.string());
}
- status_t err = checkIfDeviceIsUsable(cameraId);
- if (err != NO_ERROR) {
- switch(err) {
- case -ENODEV:
- case -EBUSY:
- return STATUS_ERROR_FMT(ERROR_DISCONNECTED,
- "No camera device with ID \"%s\" currently available", cameraId.string());
- default:
- return STATUS_ERROR_FMT(ERROR_INVALID_OPERATION,
- "Unknown error connecting to ID \"%s\"", cameraId.string());
- }
- }
return Status::ok();
}
@@ -2348,7 +2372,7 @@
void CameraService::ClientEventListener::onClientAdded(
const resource_policy::ClientDescriptor<String8,
sp<CameraService::BasicClient>>& descriptor) {
- auto basicClient = descriptor.getValue();
+ const auto& basicClient = descriptor.getValue();
if (basicClient.get() != nullptr) {
BatteryNotifier& notifier(BatteryNotifier::getInstance());
notifier.noteStartCamera(descriptor.getKey(),
@@ -2359,7 +2383,7 @@
void CameraService::ClientEventListener::onClientRemoved(
const resource_policy::ClientDescriptor<String8,
sp<CameraService::BasicClient>>& descriptor) {
- auto basicClient = descriptor.getValue();
+ const auto& basicClient = descriptor.getValue();
if (basicClient.get() != nullptr) {
BatteryNotifier& notifier(BatteryNotifier::getInstance());
notifier.noteStopCamera(descriptor.getKey(),
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index 11b1351..b35f35c 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -95,7 +95,7 @@
/////////////////////////////////////////////////////////////////////
// HAL Callbacks
- virtual void onDeviceStatusChanged(camera_device_status_t cameraId,
+ virtual void onDeviceStatusChanged(int cameraId,
camera_device_status_t newStatus);
virtual void onTorchStatusChanged(const String8& cameraId,
int32_t newStatus);
@@ -265,7 +265,7 @@
class OpsCallback : public BnAppOpsCallback {
public:
- OpsCallback(wp<BasicClient> client);
+ explicit OpsCallback(wp<BasicClient> client);
virtual void opChanged(int32_t op, const String16& packageName);
private:
@@ -495,7 +495,9 @@
// mediaserver to connect to camera (using MediaRecorder to connect to camera). In that case,
// clientPid is the PID of mediaserver and originalClientPid is the PID of the application.
binder::Status validateConnectLocked(const String8& cameraId, const String8& clientName8,
- /*inout*/int& clientUid, /*inout*/int& clientPid, /*out*/int& originalClientPid) const;
+ /*inout*/int& clientUid, /*inout*/int& clientPid, /*out*/int& originalClientPid) const;
+ binder::Status validateClientPermissionsLocked(const String8& cameraId, const String8& clientName8,
+ /*inout*/int& clientUid, /*inout*/int& clientPid, /*out*/int& originalClientPid) const;
// Handle active client evictions, and update service state.
// Only call with with mServiceLock held.
diff --git a/services/camera/libcameraservice/api1/Camera2Client.cpp b/services/camera/libcameraservice/api1/Camera2Client.cpp
index 005dd69..bcd62d6 100644
--- a/services/camera/libcameraservice/api1/Camera2Client.cpp
+++ b/services/camera/libcameraservice/api1/Camera2Client.cpp
@@ -526,7 +526,7 @@
}
status_t Camera2Client::setPreviewWindowL(const sp<IBinder>& binder,
- sp<Surface> window) {
+ const sp<Surface>& window) {
ATRACE_CALL();
status_t res;
@@ -1903,12 +1903,12 @@
}
status_t Camera2Client::registerFrameListener(int32_t minId, int32_t maxId,
- wp<camera2::FrameProcessor::FilteredListener> listener, bool sendPartials) {
+ const wp<camera2::FrameProcessor::FilteredListener>& listener, bool sendPartials) {
return mFrameProcessor->registerListener(minId, maxId, listener, sendPartials);
}
status_t Camera2Client::removeFrameListener(int32_t minId, int32_t maxId,
- wp<camera2::FrameProcessor::FilteredListener> listener) {
+ const wp<camera2::FrameProcessor::FilteredListener>& listener) {
return mFrameProcessor->removeListener(minId, maxId, listener);
}
diff --git a/services/camera/libcameraservice/api1/Camera2Client.h b/services/camera/libcameraservice/api1/Camera2Client.h
index 3cb9e4f..e2129f5 100644
--- a/services/camera/libcameraservice/api1/Camera2Client.h
+++ b/services/camera/libcameraservice/api1/Camera2Client.h
@@ -126,10 +126,10 @@
int getZslStreamId() const;
status_t registerFrameListener(int32_t minId, int32_t maxId,
- wp<camera2::FrameProcessor::FilteredListener> listener,
+ const wp<camera2::FrameProcessor::FilteredListener>& listener,
bool sendPartials = true);
status_t removeFrameListener(int32_t minId, int32_t maxId,
- wp<camera2::FrameProcessor::FilteredListener> listener);
+ const wp<camera2::FrameProcessor::FilteredListener>& listener);
status_t stopStream();
@@ -160,7 +160,7 @@
typedef camera2::Parameters Parameters;
status_t setPreviewWindowL(const sp<IBinder>& binder,
- sp<Surface> window);
+ const sp<Surface>& window);
status_t startPreviewL(Parameters ¶ms, bool restart);
void stopPreviewL();
status_t startRecordingL(Parameters ¶ms, bool restart);
diff --git a/services/camera/libcameraservice/api1/client2/CallbackProcessor.cpp b/services/camera/libcameraservice/api1/client2/CallbackProcessor.cpp
index b4b269a..3f4017f 100644
--- a/services/camera/libcameraservice/api1/client2/CallbackProcessor.cpp
+++ b/services/camera/libcameraservice/api1/client2/CallbackProcessor.cpp
@@ -55,7 +55,7 @@
}
status_t CallbackProcessor::setCallbackWindow(
- sp<Surface> callbackWindow) {
+ const sp<Surface>& callbackWindow) {
ATRACE_CALL();
status_t res;
diff --git a/services/camera/libcameraservice/api1/client2/CallbackProcessor.h b/services/camera/libcameraservice/api1/client2/CallbackProcessor.h
index a22442f..5231688 100644
--- a/services/camera/libcameraservice/api1/client2/CallbackProcessor.h
+++ b/services/camera/libcameraservice/api1/client2/CallbackProcessor.h
@@ -41,13 +41,13 @@
class CallbackProcessor:
public Thread, public CpuConsumer::FrameAvailableListener {
public:
- CallbackProcessor(sp<Camera2Client> client);
+ explicit CallbackProcessor(sp<Camera2Client> client);
~CallbackProcessor();
void onFrameAvailable(const BufferItem& item);
// Set to NULL to disable the direct-to-app callback window
- status_t setCallbackWindow(sp<Surface> callbackWindow);
+ status_t setCallbackWindow(const sp<Surface>& callbackWindow);
status_t updateStream(const Parameters ¶ms);
status_t deleteStream();
int getStreamId() const;
diff --git a/services/camera/libcameraservice/api1/client2/Camera2Heap.h b/services/camera/libcameraservice/api1/client2/Camera2Heap.h
index 9c72d76..fe3afcb 100644
--- a/services/camera/libcameraservice/api1/client2/Camera2Heap.h
+++ b/services/camera/libcameraservice/api1/client2/Camera2Heap.h
@@ -26,7 +26,7 @@
// Utility class for managing a set of IMemory blocks
class Camera2Heap : public RefBase {
public:
- Camera2Heap(size_t buf_size, uint_t num_buffers = 1,
+ explicit Camera2Heap(size_t buf_size, uint_t num_buffers = 1,
const char *name = NULL) :
mBufSize(buf_size),
mNumBufs(num_buffers) {
diff --git a/services/camera/libcameraservice/api1/client2/CaptureSequencer.cpp b/services/camera/libcameraservice/api1/client2/CaptureSequencer.cpp
index 05adb29..b65f1c7 100644
--- a/services/camera/libcameraservice/api1/client2/CaptureSequencer.cpp
+++ b/services/camera/libcameraservice/api1/client2/CaptureSequencer.cpp
@@ -59,7 +59,7 @@
ALOGV("%s: Exit", __FUNCTION__);
}
-void CaptureSequencer::setZslProcessor(wp<ZslProcessor> processor) {
+void CaptureSequencer::setZslProcessor(const wp<ZslProcessor>& processor) {
Mutex::Autolock l(mInputMutex);
mZslProcessor = processor;
}
@@ -132,7 +132,7 @@
}
void CaptureSequencer::onCaptureAvailable(nsecs_t timestamp,
- sp<MemoryBase> captureBuffer, bool captureError) {
+ const sp<MemoryBase>& captureBuffer, bool captureError) {
ATRACE_CALL();
ALOGV("%s", __FUNCTION__);
Mutex::Autolock l(mInputMutex);
@@ -709,7 +709,7 @@
}
/*static*/ void CaptureSequencer::shutterNotifyLocked(const Parameters ¶ms,
- sp<Camera2Client> client, int msgType) {
+ const sp<Camera2Client>& client, int msgType) {
ATRACE_CALL();
if (params.state == Parameters::STILL_CAPTURE
diff --git a/services/camera/libcameraservice/api1/client2/CaptureSequencer.h b/services/camera/libcameraservice/api1/client2/CaptureSequencer.h
index a7c61d2..f2e3750 100644
--- a/services/camera/libcameraservice/api1/client2/CaptureSequencer.h
+++ b/services/camera/libcameraservice/api1/client2/CaptureSequencer.h
@@ -44,11 +44,11 @@
virtual public Thread,
virtual public FrameProcessor::FilteredListener {
public:
- CaptureSequencer(wp<Camera2Client> client);
+ explicit CaptureSequencer(wp<Camera2Client> client);
~CaptureSequencer();
// Get reference to the ZslProcessor, which holds the ZSL buffers and frames
- void setZslProcessor(wp<ZslProcessor> processor);
+ void setZslProcessor(const wp<ZslProcessor>& processor);
// Begin still image capture
status_t startCapture(int msgType);
@@ -69,7 +69,7 @@
virtual void onResultAvailable(const CaptureResult &result);
// Notifications from the JPEG processor
- void onCaptureAvailable(nsecs_t timestamp, sp<MemoryBase> captureBuffer, bool captureError);
+ void onCaptureAvailable(nsecs_t timestamp, const sp<MemoryBase>& captureBuffer, bool captureError);
void dump(int fd, const Vector<String16>& args);
@@ -172,7 +172,7 @@
// Emit Shutter/Raw callback to java, and maybe play a shutter sound
static void shutterNotifyLocked(const Parameters ¶ms,
- sp<Camera2Client> client, int msgType);
+ const sp<Camera2Client>& client, int msgType);
};
}; // namespace camera2
diff --git a/services/camera/libcameraservice/api1/client2/FrameProcessor.cpp b/services/camera/libcameraservice/api1/client2/FrameProcessor.cpp
index 4d12015..394eb4c 100644
--- a/services/camera/libcameraservice/api1/client2/FrameProcessor.cpp
+++ b/services/camera/libcameraservice/api1/client2/FrameProcessor.cpp
@@ -389,7 +389,7 @@
}
-void FrameProcessor::callbackFaceDetection(sp<Camera2Client> client,
+void FrameProcessor::callbackFaceDetection(const sp<Camera2Client>& client,
const camera_frame_metadata &metadata) {
camera_frame_metadata *metadata_ptr =
diff --git a/services/camera/libcameraservice/api1/client2/FrameProcessor.h b/services/camera/libcameraservice/api1/client2/FrameProcessor.h
index a5b81a7..62a4e91 100644
--- a/services/camera/libcameraservice/api1/client2/FrameProcessor.h
+++ b/services/camera/libcameraservice/api1/client2/FrameProcessor.h
@@ -107,7 +107,7 @@
int32_t mLast3AFrameNumber;
// Emit FaceDetection event to java if faces changed
- void callbackFaceDetection(sp<Camera2Client> client,
+ void callbackFaceDetection(const sp<Camera2Client>& client,
const camera_frame_metadata &metadata);
};
diff --git a/services/camera/libcameraservice/api1/client2/JpegCompressor.cpp b/services/camera/libcameraservice/api1/client2/JpegCompressor.cpp
index 9ecab71..01951a0 100644
--- a/services/camera/libcameraservice/api1/client2/JpegCompressor.cpp
+++ b/services/camera/libcameraservice/api1/client2/JpegCompressor.cpp
@@ -36,7 +36,7 @@
Mutex::Autolock lock(mMutex);
}
-status_t JpegCompressor::start(Vector<CpuConsumer::LockedBuffer*> buffers,
+status_t JpegCompressor::start(const Vector<CpuConsumer::LockedBuffer*>& buffers,
nsecs_t captureTime) {
ALOGV("%s", __FUNCTION__);
Mutex::Autolock busyLock(mBusyMutex);
diff --git a/services/camera/libcameraservice/api1/client2/JpegCompressor.h b/services/camera/libcameraservice/api1/client2/JpegCompressor.h
index df5da54..589a2fd 100644
--- a/services/camera/libcameraservice/api1/client2/JpegCompressor.h
+++ b/services/camera/libcameraservice/api1/client2/JpegCompressor.h
@@ -48,7 +48,7 @@
// Start compressing COMPRESSED format buffers; JpegCompressor takes
// ownership of the Buffers vector.
- status_t start(Vector<CpuConsumer::LockedBuffer*> buffers,
+ status_t start(const Vector<CpuConsumer::LockedBuffer*>& buffers,
nsecs_t captureTime);
status_t cancel();
diff --git a/services/camera/libcameraservice/api1/client2/Parameters.h b/services/camera/libcameraservice/api1/client2/Parameters.h
index 687ac3e..c8ecbba 100644
--- a/services/camera/libcameraservice/api1/client2/Parameters.h
+++ b/services/camera/libcameraservice/api1/client2/Parameters.h
@@ -426,7 +426,7 @@
template<typename S, typename P>
class BaseLock {
public:
- BaseLock(S &p):
+ explicit BaseLock(S &p):
mParameters(p.mParameters),
mSharedParameters(p) {
mSharedParameters.mLock.lock();
diff --git a/services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp b/services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp
index de42fb2..bf92a2b 100644
--- a/services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp
+++ b/services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp
@@ -58,7 +58,7 @@
deleteRecordingStream();
}
-status_t StreamingProcessor::setPreviewWindow(sp<Surface> window) {
+status_t StreamingProcessor::setPreviewWindow(const sp<Surface>& window) {
ATRACE_CALL();
status_t res;
@@ -72,7 +72,7 @@
return OK;
}
-status_t StreamingProcessor::setRecordingWindow(sp<Surface> window) {
+status_t StreamingProcessor::setRecordingWindow(const sp<Surface>& window) {
ATRACE_CALL();
status_t res;
diff --git a/services/camera/libcameraservice/api1/client2/StreamingProcessor.h b/services/camera/libcameraservice/api1/client2/StreamingProcessor.h
index 57e6389..22231d5 100644
--- a/services/camera/libcameraservice/api1/client2/StreamingProcessor.h
+++ b/services/camera/libcameraservice/api1/client2/StreamingProcessor.h
@@ -39,11 +39,11 @@
*/
class StreamingProcessor : public virtual VirtualLightRefBase {
public:
- StreamingProcessor(sp<Camera2Client> client);
+ explicit StreamingProcessor(sp<Camera2Client> client);
~StreamingProcessor();
- status_t setPreviewWindow(sp<Surface> window);
- status_t setRecordingWindow(sp<Surface> window);
+ status_t setPreviewWindow(const sp<Surface>& window);
+ status_t setRecordingWindow(const sp<Surface>& window);
bool haveValidPreviewWindow() const;
bool haveValidRecordingWindow() const;
diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
index a7fe5e7..b4f8e21 100644
--- a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
+++ b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
@@ -530,7 +530,8 @@
}
// Round dimensions to the nearest dimensions available for this format
- if (flexibleConsumer && !CameraDeviceClient::roundBufferDimensionNearest(width, height,
+ if (flexibleConsumer && isPublicFormat(format) &&
+ !CameraDeviceClient::roundBufferDimensionNearest(width, height,
format, dataSpace, mDevice->info(), /*out*/&width, /*out*/&height)) {
String8 msg = String8::format("Camera %d: No supported stream configurations with "
"format %#x defined, failed to create output stream", mCameraId, format);
@@ -714,6 +715,37 @@
return res;
}
+bool CameraDeviceClient::isPublicFormat(int32_t format)
+{
+ switch(format) {
+ case HAL_PIXEL_FORMAT_RGBA_8888:
+ case HAL_PIXEL_FORMAT_RGBX_8888:
+ case HAL_PIXEL_FORMAT_RGB_888:
+ case HAL_PIXEL_FORMAT_RGB_565:
+ case HAL_PIXEL_FORMAT_BGRA_8888:
+ case HAL_PIXEL_FORMAT_YV12:
+ case HAL_PIXEL_FORMAT_Y8:
+ case HAL_PIXEL_FORMAT_Y16:
+ case HAL_PIXEL_FORMAT_RAW16:
+ case HAL_PIXEL_FORMAT_RAW10:
+ case HAL_PIXEL_FORMAT_RAW12:
+ case HAL_PIXEL_FORMAT_RAW_OPAQUE:
+ case HAL_PIXEL_FORMAT_BLOB:
+ case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
+ case HAL_PIXEL_FORMAT_YCbCr_420_888:
+ case HAL_PIXEL_FORMAT_YCbCr_422_888:
+ case HAL_PIXEL_FORMAT_YCbCr_444_888:
+ case HAL_PIXEL_FORMAT_FLEX_RGB_888:
+ case HAL_PIXEL_FORMAT_FLEX_RGBA_8888:
+ case HAL_PIXEL_FORMAT_YCbCr_422_SP:
+ case HAL_PIXEL_FORMAT_YCrCb_420_SP:
+ case HAL_PIXEL_FORMAT_YCbCr_422_I:
+ return true;
+ default:
+ return false;
+ }
+}
+
bool CameraDeviceClient::roundBufferDimensionNearest(int32_t width, int32_t height,
int32_t format, android_dataspace dataSpace, const CameraMetadata& info,
/*out*/int32_t* outWidth, /*out*/int32_t* outHeight) {
diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.h b/services/camera/libcameraservice/api2/CameraDeviceClient.h
index dde23fb..de283ea 100644
--- a/services/camera/libcameraservice/api2/CameraDeviceClient.h
+++ b/services/camera/libcameraservice/api2/CameraDeviceClient.h
@@ -208,6 +208,9 @@
android_dataspace dataSpace, const CameraMetadata& info,
/*out*/int32_t* outWidth, /*out*/int32_t* outHeight);
+ //check if format is not custom format
+ static bool isPublicFormat(int32_t format);
+
// IGraphicsBufferProducer binder -> Stream ID for output streams
KeyedVector<sp<IBinder>, int> mStreamMap;
diff --git a/services/camera/libcameraservice/common/Camera2ClientBase.h b/services/camera/libcameraservice/common/Camera2ClientBase.h
index 4f60034..dbbf638 100644
--- a/services/camera/libcameraservice/common/Camera2ClientBase.h
+++ b/services/camera/libcameraservice/common/Camera2ClientBase.h
@@ -93,13 +93,13 @@
public:
class Lock {
public:
- Lock(SharedCameraCallbacks &client);
+ explicit Lock(SharedCameraCallbacks &client);
~Lock();
sp<TCamCallbacks> &mRemoteCallback;
private:
SharedCameraCallbacks &mSharedClient;
};
- SharedCameraCallbacks(const sp<TCamCallbacks>& client);
+ explicit SharedCameraCallbacks(const sp<TCamCallbacks>& client);
SharedCameraCallbacks& operator=(const sp<TCamCallbacks>& client);
void clear();
private:
diff --git a/services/camera/libcameraservice/common/CameraModule.h b/services/camera/libcameraservice/common/CameraModule.h
index 1a1c274..d131a26 100644
--- a/services/camera/libcameraservice/common/CameraModule.h
+++ b/services/camera/libcameraservice/common/CameraModule.h
@@ -32,7 +32,7 @@
*/
class CameraModule {
public:
- CameraModule(camera_module_t *module);
+ explicit CameraModule(camera_module_t *module);
virtual ~CameraModule();
// Must be called after construction
diff --git a/services/camera/libcameraservice/common/FrameProcessorBase.cpp b/services/camera/libcameraservice/common/FrameProcessorBase.cpp
index 29eb78f..2ef3057 100644
--- a/services/camera/libcameraservice/common/FrameProcessorBase.cpp
+++ b/services/camera/libcameraservice/common/FrameProcessorBase.cpp
@@ -47,7 +47,7 @@
}
status_t FrameProcessorBase::registerListener(int32_t minId,
- int32_t maxId, wp<FilteredListener> listener, bool sendPartials) {
+ int32_t maxId, const wp<FilteredListener>& listener, bool sendPartials) {
Mutex::Autolock l(mInputMutex);
List<RangeListener>::iterator item = mRangeListeners.begin();
while (item != mRangeListeners.end()) {
@@ -70,7 +70,7 @@
status_t FrameProcessorBase::removeListener(int32_t minId,
int32_t maxId,
- wp<FilteredListener> listener) {
+ const wp<FilteredListener>& listener) {
Mutex::Autolock l(mInputMutex);
List<RangeListener>::iterator item = mRangeListeners.begin();
while (item != mRangeListeners.end()) {
diff --git a/services/camera/libcameraservice/common/FrameProcessorBase.h b/services/camera/libcameraservice/common/FrameProcessorBase.h
index a618d84..00763a4 100644
--- a/services/camera/libcameraservice/common/FrameProcessorBase.h
+++ b/services/camera/libcameraservice/common/FrameProcessorBase.h
@@ -36,7 +36,7 @@
*/
class FrameProcessorBase: public Thread {
public:
- FrameProcessorBase(wp<CameraDeviceBase> device);
+ explicit FrameProcessorBase(wp<CameraDeviceBase> device);
virtual ~FrameProcessorBase();
struct FilteredListener: virtual public RefBase {
@@ -48,10 +48,10 @@
// the same range of IDs has no effect.
// sendPartials controls whether partial results will be sent.
status_t registerListener(int32_t minId, int32_t maxId,
- wp<FilteredListener> listener,
+ const wp<FilteredListener>& listener,
bool sendPartials = true);
status_t removeListener(int32_t minId, int32_t maxId,
- wp<FilteredListener> listener);
+ const wp<FilteredListener>& listener);
void dump(int fd, const Vector<String16>& args);
protected:
diff --git a/services/camera/libcameraservice/device1/CameraHardwareInterface.h b/services/camera/libcameraservice/device1/CameraHardwareInterface.h
index bce0762..952bae1 100644
--- a/services/camera/libcameraservice/device1/CameraHardwareInterface.h
+++ b/services/camera/libcameraservice/device1/CameraHardwareInterface.h
@@ -73,7 +73,7 @@
class CameraHardwareInterface : public virtual RefBase {
public:
- CameraHardwareInterface(const char *name):
+ explicit CameraHardwareInterface(const char *name):
mDevice(nullptr),
mName(name),
mPreviewScalingMode(NOT_SET),
@@ -543,9 +543,9 @@
commonInitialization();
}
- CameraHeapMemory(size_t buf_size, uint_t num_buffers = 1) :
- mBufSize(buf_size),
- mNumBufs(num_buffers)
+ explicit CameraHeapMemory(size_t buf_size, uint_t num_buffers = 1) :
+ mBufSize(buf_size),
+ mNumBufs(num_buffers)
{
mHeap = new MemoryHeapBase(buf_size * num_buffers);
commonInitialization();
@@ -606,9 +606,9 @@
reinterpret_cast<CameraHardwareInterface *>(user);
return __this->mPreviewWindow.get();
}
-#define anw(n) __to_anw(((struct camera_preview_window *)n)->user)
+#define anw(n) __to_anw(((struct camera_preview_window *)(n))->user)
#define hwi(n) reinterpret_cast<CameraHardwareInterface *>(\
- ((struct camera_preview_window *)n)->user)
+ ((struct camera_preview_window *)(n))->user)
static int __dequeue_buffer(struct preview_stream_ops* w,
buffer_handle_t** buffer, int *stride)
diff --git a/services/camera/libcameraservice/device3/Camera3BufferManager.h b/services/camera/libcameraservice/device3/Camera3BufferManager.h
index ab6541e..b5b86a3 100644
--- a/services/camera/libcameraservice/device3/Camera3BufferManager.h
+++ b/services/camera/libcameraservice/device3/Camera3BufferManager.h
@@ -44,7 +44,7 @@
*/
class Camera3BufferManager: public virtual RefBase {
public:
- Camera3BufferManager(const sp<IGraphicBufferAlloc>& allocator = NULL);
+ explicit Camera3BufferManager(const sp<IGraphicBufferAlloc>& allocator = NULL);
virtual ~Camera3BufferManager();
@@ -195,7 +195,7 @@
struct GraphicBufferEntry {
sp<GraphicBuffer> graphicBuffer;
int fenceFd;
- GraphicBufferEntry(const sp<GraphicBuffer>& gb = 0, int fd = -1) :
+ explicit GraphicBufferEntry(const sp<GraphicBuffer>& gb = 0, int fd = -1) :
graphicBuffer(gb),
fenceFd(fd) {}
};
diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp
index eece01b..495de44 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.cpp
+++ b/services/camera/libcameraservice/device3/Camera3Device.cpp
@@ -2894,7 +2894,7 @@
return OK;
}
-bool Camera3Device::RequestThread::isRepeatingRequestLocked(const sp<CaptureRequest> requestIn) {
+bool Camera3Device::RequestThread::isRepeatingRequestLocked(const sp<CaptureRequest>& requestIn) {
if (mRepeatingRequests.empty()) {
return false;
}
@@ -2958,6 +2958,8 @@
}
}
mRequestQueue.clear();
+
+ Mutex::Autolock al(mTriggerMutex);
mTriggerMap.clear();
if (lastFrameNumber != NULL) {
*lastFrameNumber = mRepeatingLastFrameNumber;
@@ -3015,7 +3017,7 @@
* AE_PRECAPTURE_TRIGGER_CANCEL to AE_PRECAPTURE_TRIGGER_IDLE but doesn't add AE_LOCK_ON to the
* request.
*/
-void Camera3Device::RequestThread::handleAePrecaptureCancelRequest(sp<CaptureRequest> request) {
+void Camera3Device::RequestThread::handleAePrecaptureCancelRequest(const sp<CaptureRequest>& request) {
request->mAeTriggerCancelOverride.applyAeLock = false;
request->mAeTriggerCancelOverride.applyAePrecaptureTrigger = false;
diff --git a/services/camera/libcameraservice/device3/Camera3Device.h b/services/camera/libcameraservice/device3/Camera3Device.h
index f422813..87c43f3 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.h
+++ b/services/camera/libcameraservice/device3/Camera3Device.h
@@ -65,7 +65,7 @@
private camera3_callback_ops {
public:
- Camera3Device(int id);
+ explicit Camera3Device(int id);
virtual ~Camera3Device();
@@ -220,7 +220,7 @@
struct Size {
uint32_t width;
uint32_t height;
- Size(uint32_t w = 0, uint32_t h = 0) : width(w), height(h){}
+ explicit Size(uint32_t w = 0, uint32_t h = 0) : width(w), height(h){}
};
// Map from format to size.
Vector<Size> mSupportedOpaqueInputSizes;
@@ -589,10 +589,10 @@
void setErrorState(const char *fmt, ...);
// If the input request is in mRepeatingRequests. Must be called with mRequestLock hold
- bool isRepeatingRequestLocked(const sp<CaptureRequest>);
+ bool isRepeatingRequestLocked(const sp<CaptureRequest>&);
// Handle AE precapture trigger cancel for devices <= CAMERA_DEVICE_API_VERSION_3_2.
- void handleAePrecaptureCancelRequest(sp<CaptureRequest> request);
+ void handleAePrecaptureCancelRequest(const sp<CaptureRequest>& request);
// Clear repeating requests. Must be called with mRequestLock held.
status_t clearRepeatingRequestsLocked(/*out*/ int64_t *lastFrameNumber = NULL);
diff --git a/services/camera/libcameraservice/device3/Camera3DummyStream.h b/services/camera/libcameraservice/device3/Camera3DummyStream.h
index 639619e..18e8a23 100644
--- a/services/camera/libcameraservice/device3/Camera3DummyStream.h
+++ b/services/camera/libcameraservice/device3/Camera3DummyStream.h
@@ -42,7 +42,7 @@
* Set up a dummy stream; doesn't actually connect to anything, and uses
* a default dummy format and size.
*/
- Camera3DummyStream(int id);
+ explicit Camera3DummyStream(int id);
virtual ~Camera3DummyStream();
diff --git a/services/camera/libcameraservice/device3/Camera3OutputStream.h b/services/camera/libcameraservice/device3/Camera3OutputStream.h
index d450a69..12d497e 100644
--- a/services/camera/libcameraservice/device3/Camera3OutputStream.h
+++ b/services/camera/libcameraservice/device3/Camera3OutputStream.h
@@ -46,7 +46,7 @@
uint32_t combinedUsage;
size_t totalBufferCount;
bool isConfigured;
- StreamInfo(int id = CAMERA3_STREAM_ID_INVALID,
+ explicit StreamInfo(int id = CAMERA3_STREAM_ID_INVALID,
int setId = CAMERA3_STREAM_SET_ID_INVALID,
uint32_t w = 0,
uint32_t h = 0,
diff --git a/services/camera/libcameraservice/device3/Camera3ZslStream.cpp b/services/camera/libcameraservice/device3/Camera3ZslStream.cpp
index 7414c4c..ea138b7 100644
--- a/services/camera/libcameraservice/device3/Camera3ZslStream.cpp
+++ b/services/camera/libcameraservice/device3/Camera3ZslStream.cpp
@@ -40,7 +40,7 @@
SELECT_NEITHER = 0,
};
- TimestampFinder(nsecs_t timestamp) : mTimestamp(timestamp) {}
+ explicit TimestampFinder(nsecs_t timestamp) : mTimestamp(timestamp) {}
~TimestampFinder() {}
template <typename T>
diff --git a/services/camera/libcameraservice/device3/StatusTracker.h b/services/camera/libcameraservice/device3/StatusTracker.h
index 49cecb3..3a1d85c 100644
--- a/services/camera/libcameraservice/device3/StatusTracker.h
+++ b/services/camera/libcameraservice/device3/StatusTracker.h
@@ -45,7 +45,7 @@
*/
class StatusTracker: public Thread {
public:
- StatusTracker(wp<Camera3Device> parent);
+ explicit StatusTracker(wp<Camera3Device> parent);
~StatusTracker();
// An always-invalid component ID
diff --git a/services/camera/libcameraservice/utils/AutoConditionLock.h b/services/camera/libcameraservice/utils/AutoConditionLock.h
index b7f167b..cdbb01b 100644
--- a/services/camera/libcameraservice/utils/AutoConditionLock.h
+++ b/services/camera/libcameraservice/utils/AutoConditionLock.h
@@ -37,7 +37,7 @@
/**
* Construct the ConditionManger with the given Mutex.
*/
- WaitableMutexWrapper(Mutex* mutex);
+ explicit WaitableMutexWrapper(Mutex* mutex);
virtual ~WaitableMutexWrapper();
private:
@@ -88,7 +88,7 @@
static std::unique_ptr<AutoConditionLock> waitAndAcquire(
const std::shared_ptr<WaitableMutexWrapper>& manager);
private:
- AutoConditionLock(const std::shared_ptr<WaitableMutexWrapper>& manager);
+ explicit AutoConditionLock(const std::shared_ptr<WaitableMutexWrapper>& manager);
std::shared_ptr<WaitableMutexWrapper> mManager;
Mutex::Autolock mAutoLock;
diff --git a/services/camera/libcameraservice/utils/ClientManager.h b/services/camera/libcameraservice/utils/ClientManager.h
index 7ae58d5..830c50b 100644
--- a/services/camera/libcameraservice/utils/ClientManager.h
+++ b/services/camera/libcameraservice/utils/ClientManager.h
@@ -216,7 +216,7 @@
static constexpr int32_t DEFAULT_MAX_COST = 100;
ClientManager();
- ClientManager(int32_t totalCost);
+ explicit ClientManager(int32_t totalCost);
/**
* Add a given ClientDescriptor to the managed list. ClientDescriptors for clients that
diff --git a/services/mediacodec/minijail/Android.mk b/services/mediacodec/minijail/Android.mk
index d2becb4..de05bc3 100644
--- a/services/mediacodec/minijail/Android.mk
+++ b/services/mediacodec/minijail/Android.mk
@@ -15,9 +15,8 @@
endif
# allow device specific additions to the syscall whitelist
-ifneq (,$(wildcard $(BOARD_SECCOMP_POLICY)/mediacodec-seccomp.policy))
- LOCAL_SRC_FILES += $(BOARD_SECCOMP_POLICY)/mediacodec-seccomp.policy
-endif
+LOCAL_SRC_FILES += $(wildcard $(foreach dir, $(BOARD_SECCOMP_POLICY), \
+ $(dir)/mediacodec-seccomp.policy))
include $(BUILD_SYSTEM)/base_rules.mk
diff --git a/services/mediacodec/minijail/minijail.cpp b/services/mediacodec/minijail/minijail.cpp
index 72bb1af..463f161 100644
--- a/services/mediacodec/minijail/minijail.cpp
+++ b/services/mediacodec/minijail/minijail.cpp
@@ -15,7 +15,12 @@
** limitations under the License.
*/
-#include <cutils/log.h>
+#define LOG_TAG "minijail"
+
+#include <unistd.h>
+
+#include <log/log.h>
+
#include <libminijail.h>
#include "minijail.h"
diff --git a/services/mediadrm/Android.mk b/services/mediadrm/Android.mk
index 8baaf13..4ce5c38 100644
--- a/services/mediadrm/Android.mk
+++ b/services/mediadrm/Android.mk
@@ -27,14 +27,8 @@
liblog \
libmedia \
libmediadrm \
- libmediaplayerservice \
- libstagefright \
- libui \
libutils \
-LOCAL_C_INCLUDES := \
- frameworks/av/media/libmediaplayerservice \
-
LOCAL_CFLAGS += -Wall -Wextra -Werror
LOCAL_MODULE:= mediadrmserver
diff --git a/services/mediaextractor/minijail/Android.mk b/services/mediaextractor/minijail/Android.mk
index 79c5505..0cf8eff 100644
--- a/services/mediaextractor/minijail/Android.mk
+++ b/services/mediaextractor/minijail/Android.mk
@@ -15,9 +15,8 @@
endif
# allow device specific additions to the syscall whitelist
-ifneq (,$(wildcard $(BOARD_SECCOMP_POLICY)/mediaextractor-seccomp.policy))
- LOCAL_SRC_FILES += $(BOARD_SECCOMP_POLICY)/mediaextractor-seccomp.policy
-endif
+LOCAL_SRC_FILES += $(wildcard $(foreach dir, $(BOARD_SECCOMP_POLICY), \
+ $(dir)/mediaextractor-seccomp.policy))
include $(BUILD_SYSTEM)/base_rules.mk
diff --git a/services/mediaextractor/minijail/minijail.cpp b/services/mediaextractor/minijail/minijail.cpp
index 421a1e0..c44d00d 100644
--- a/services/mediaextractor/minijail/minijail.cpp
+++ b/services/mediaextractor/minijail/minijail.cpp
@@ -15,7 +15,12 @@
** limitations under the License.
*/
-#include <cutils/log.h>
+#define LOG_TAG "minijail"
+
+#include <unistd.h>
+
+#include <log/log.h>
+
#include <libminijail.h>
#include "minijail.h"
diff --git a/services/medialog/Android.mk b/services/medialog/Android.mk
index 88f98cf..a1da63d 100644
--- a/services/medialog/Android.mk
+++ b/services/medialog/Android.mk
@@ -2,9 +2,9 @@
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := MediaLogService.cpp
+LOCAL_SRC_FILES := MediaLogService.cpp IMediaLogService.cpp
-LOCAL_SHARED_LIBRARIES := libmedia libbinder libutils liblog libnbaio
+LOCAL_SHARED_LIBRARIES := libbinder libutils liblog libnbaio
LOCAL_MULTILIB := $(AUDIOSERVER_MULTILIB)
diff --git a/media/libmedia/IMediaLogService.cpp b/services/medialog/IMediaLogService.cpp
similarity index 97%
rename from media/libmedia/IMediaLogService.cpp
rename to services/medialog/IMediaLogService.cpp
index 1536337..bc445ff 100644
--- a/media/libmedia/IMediaLogService.cpp
+++ b/services/medialog/IMediaLogService.cpp
@@ -34,7 +34,7 @@
class BpMediaLogService : public BpInterface<IMediaLogService>
{
public:
- BpMediaLogService(const sp<IBinder>& impl)
+ explicit BpMediaLogService(const sp<IBinder>& impl)
: BpInterface<IMediaLogService>(impl)
{
}
diff --git a/services/mediaresourcemanager/ResourceManagerService.cpp b/services/mediaresourcemanager/ResourceManagerService.cpp
index 3ed0189..7346f51 100644
--- a/services/mediaresourcemanager/ResourceManagerService.cpp
+++ b/services/mediaresourcemanager/ResourceManagerService.cpp
@@ -43,7 +43,7 @@
return itemsStr;
}
-static bool hasResourceType(MediaResource::Type type, Vector<MediaResource> resources) {
+static bool hasResourceType(MediaResource::Type type, const Vector<MediaResource>& resources) {
for (size_t i = 0; i < resources.size(); ++i) {
if (resources[i].mType == type) {
return true;
@@ -52,7 +52,7 @@
return false;
}
-static bool hasResourceType(MediaResource::Type type, ResourceInfos infos) {
+static bool hasResourceType(MediaResource::Type type, const ResourceInfos& infos) {
for (size_t i = 0; i < infos.size(); ++i) {
if (hasResourceType(type, infos[i].resources)) {
return true;
@@ -76,7 +76,7 @@
static ResourceInfo& getResourceInfoForEdit(
int64_t clientId,
- const sp<IResourceManagerClient> client,
+ const sp<IResourceManagerClient>& client,
ResourceInfos& infos) {
for (size_t i = 0; i < infos.size(); ++i) {
if (infos[i].clientId == clientId) {
diff --git a/services/mediaresourcemanager/ResourceManagerService.h b/services/mediaresourcemanager/ResourceManagerService.h
index 8f6fe9a..2a4a6b2 100644
--- a/services/mediaresourcemanager/ResourceManagerService.h
+++ b/services/mediaresourcemanager/ResourceManagerService.h
@@ -52,7 +52,7 @@
virtual status_t dump(int fd, const Vector<String16>& args);
ResourceManagerService();
- ResourceManagerService(sp<ProcessInfoInterface> processInfo);
+ explicit ResourceManagerService(sp<ProcessInfoInterface> processInfo);
// IResourceManagerService interface
virtual void config(const Vector<MediaResourcePolicy> &policies);
diff --git a/services/mediaresourcemanager/ServiceLog.h b/services/mediaresourcemanager/ServiceLog.h
index a6f16eb..380e86a 100644
--- a/services/mediaresourcemanager/ServiceLog.h
+++ b/services/mediaresourcemanager/ServiceLog.h
@@ -30,7 +30,7 @@
class ServiceLog : public RefBase {
public:
ServiceLog();
- ServiceLog(size_t maxNum);
+ explicit ServiceLog(size_t maxNum);
void add(const String8 &log);
String8 toString(const char *linePrefix = NULL) const;
diff --git a/services/mediaresourcemanager/test/ResourceManagerService_test.cpp b/services/mediaresourcemanager/test/ResourceManagerService_test.cpp
index 62b7711..ed0b0ef 100644
--- a/services/mediaresourcemanager/test/ResourceManagerService_test.cpp
+++ b/services/mediaresourcemanager/test/ResourceManagerService_test.cpp
@@ -29,7 +29,7 @@
namespace android {
-static int64_t getId(sp<IResourceManagerClient> client) {
+static int64_t getId(const sp<IResourceManagerClient>& client) {
return (int64_t) client.get();
}
diff --git a/services/radio/Android.mk b/services/radio/Android.mk
index f5d74d3..fc8f00c 100644
--- a/services/radio/Android.mk
+++ b/services/radio/Android.mk
@@ -21,12 +21,11 @@
RadioService.cpp
LOCAL_SHARED_LIBRARIES:= \
- libui \
liblog \
libutils \
libbinder \
libcutils \
- libmedia \
+ libaudioclient \
libhardware \
libradio \
libradio_metadata
diff --git a/services/radio/RadioService.h b/services/radio/RadioService.h
index 49feda6..ac3481e 100644
--- a/services/radio/RadioService.h
+++ b/services/radio/RadioService.h
@@ -103,7 +103,7 @@
class CallbackThread : public Thread {
public:
- CallbackThread(const wp<ModuleClient>& moduleClient);
+ explicit CallbackThread(const wp<ModuleClient>& moduleClient);
virtual ~CallbackThread();
diff --git a/services/soundtrigger/Android.mk b/services/soundtrigger/Android.mk
index c55ac7f..0f5bbba 100644
--- a/services/soundtrigger/Android.mk
+++ b/services/soundtrigger/Android.mk
@@ -25,14 +25,13 @@
SoundTriggerHwService.cpp
LOCAL_SHARED_LIBRARIES:= \
- libui \
liblog \
libutils \
libbinder \
libcutils \
libhardware \
libsoundtrigger \
- libmedia \
+ libaudioclient \
libserviceutility
LOCAL_C_INCLUDES += \
diff --git a/services/soundtrigger/SoundTriggerHwService.cpp b/services/soundtrigger/SoundTriggerHwService.cpp
index eebc487..6a52b9c 100644
--- a/services/soundtrigger/SoundTriggerHwService.cpp
+++ b/services/soundtrigger/SoundTriggerHwService.cpp
@@ -164,7 +164,7 @@
}
-void SoundTriggerHwService::detachModule(sp<Module> module)
+void SoundTriggerHwService::detachModule(const sp<Module>& module)
{
ALOGV("detachModule");
AutoMutex lock(mServiceLock);
diff --git a/services/soundtrigger/SoundTriggerHwService.h b/services/soundtrigger/SoundTriggerHwService.h
index 2619a5f..13a577a 100644
--- a/services/soundtrigger/SoundTriggerHwService.h
+++ b/services/soundtrigger/SoundTriggerHwService.h
@@ -125,7 +125,7 @@
sound_trigger_hw_device *hwDevice() const { return mHwDevice; }
struct sound_trigger_module_descriptor descriptor() { return mDescriptor; }
- void setClient(sp<ISoundTriggerClient> client) { mClient = client; }
+ void setClient(const sp<ISoundTriggerClient>& client) { mClient = client; }
void clearClient() { mClient.clear(); }
sp<ISoundTriggerClient> client() const { return mClient; }
wp<SoundTriggerHwService> service() const { return mService; }
@@ -156,7 +156,7 @@
class CallbackThread : public Thread {
public:
- CallbackThread(const wp<SoundTriggerHwService>& service);
+ explicit CallbackThread(const wp<SoundTriggerHwService>& service);
virtual ~CallbackThread();
@@ -176,7 +176,7 @@
Vector< sp<CallbackEvent> > mEventQueue;
};
- void detachModule(sp<Module> module);
+ void detachModule(const sp<Module>& module);
static void recognitionCallback(struct sound_trigger_recognition_event *event, void *cookie);
sp<IMemory> prepareRecognitionEvent_l(struct sound_trigger_recognition_event *event);
diff --git a/soundtrigger/Android.mk b/soundtrigger/Android.mk
index c794cc1..e29adbf 100644
--- a/soundtrigger/Android.mk
+++ b/soundtrigger/Android.mk
@@ -27,7 +27,6 @@
libutils \
liblog \
libbinder \
- libhardware
#LOCAL_C_INCLUDES += \
system/media/camera/include \
diff --git a/soundtrigger/ISoundTrigger.cpp b/soundtrigger/ISoundTrigger.cpp
index 4df2068..25332a4 100644
--- a/soundtrigger/ISoundTrigger.cpp
+++ b/soundtrigger/ISoundTrigger.cpp
@@ -37,7 +37,7 @@
class BpSoundTrigger: public BpInterface<ISoundTrigger>
{
public:
- BpSoundTrigger(const sp<IBinder>& impl)
+ explicit BpSoundTrigger(const sp<IBinder>& impl)
: BpInterface<ISoundTrigger>(impl)
{
}
diff --git a/soundtrigger/ISoundTriggerClient.cpp b/soundtrigger/ISoundTriggerClient.cpp
index e0d3add..1385631 100644
--- a/soundtrigger/ISoundTriggerClient.cpp
+++ b/soundtrigger/ISoundTriggerClient.cpp
@@ -35,7 +35,7 @@
{
public:
- BpSoundTriggerClient(const sp<IBinder>& impl)
+ explicit BpSoundTriggerClient(const sp<IBinder>& impl)
: BpInterface<ISoundTriggerClient>(impl)
{
}
diff --git a/soundtrigger/ISoundTriggerHwService.cpp b/soundtrigger/ISoundTriggerHwService.cpp
index e37bae3..d44f5cb 100644
--- a/soundtrigger/ISoundTriggerHwService.cpp
+++ b/soundtrigger/ISoundTriggerHwService.cpp
@@ -45,7 +45,7 @@
class BpSoundTriggerHwService: public BpInterface<ISoundTriggerHwService>
{
public:
- BpSoundTriggerHwService(const sp<IBinder>& impl)
+ explicit BpSoundTriggerHwService(const sp<IBinder>& impl)
: BpInterface<ISoundTriggerHwService>(impl)
{
}