Camera metadata: Check source metadata size am: 489bbd13bf am: 90045db6e6 am: 6dc0f83407 am: e1d6665905 am: 7a854a6066 am: c5fe6aefeb am: 3fdaebe730 am: 9b1ebd3fba am: a98aeeb454 am: 852082d995
am: 451248f8cf
Change-Id: I859f983afd66dedb1b924601cdcd86b0221ae40c
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 1096f5d..7bc9963 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -53,6 +53,10 @@
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libaudioutils_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/filterfw_intermediates)
$(call add-clean-step, rm -f $(PRODUCT_OUT)/system/framework/filterfw.jar)
+$(call add-clean-step, rm -f $(PRODUCT_OUT)/symbols/system/lib/libalsautils.so)
+$(call add-clean-step, rm -f $(PRODUCT_OUT)/symbols/system/lib64/libalsautils.so)
+$(call add-clean-step, rm -f $(PRODUCT_OUT)/system/lib/libalsautils.so)
+$(call add-clean-step, rm -f $(PRODUCT_OUT)/system/lib64/libalsautils.so)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
diff --git a/audio_effects/Android.bp b/audio_effects/Android.bp
new file mode 100644
index 0000000..e4e44b7
--- /dev/null
+++ b/audio_effects/Android.bp
@@ -0,0 +1,6 @@
+cc_library_headers {
+ name: "libaudioeffects",
+ header_libs: ["libhardware_headers"],
+ export_header_lib_headers: ["libhardware_headers"],
+ export_include_dirs: ["include"],
+}
diff --git a/audio_route/audio_route.c b/audio_route/audio_route.c
index 89b076b..123e7c6 100644
--- a/audio_route/audio_route.c
+++ b/audio_route/audio_route.c
@@ -378,6 +378,7 @@
struct mixer_ctl *ctl;
enum mixer_ctl_type type;
+ ALOGD("Apply path: %s", path->name != NULL ? path->name : "none");
for (i = 0; i < path->length; i++) {
ctl_index = path->setting[i].ctl_index;
ctl = index_to_ctl(ar, ctl_index);
@@ -399,6 +400,7 @@
struct mixer_ctl *ctl;
enum mixer_ctl_type type;
+ ALOGV("Reset path: %s", path->name != NULL ? path->name : "none");
for (i = 0; i < path->length; i++) {
ctl_index = path->setting[i].ctl_index;
ctl = index_to_ctl(ar, ctl_index);
diff --git a/audio_utils/Android.bp b/audio_utils/Android.bp
index c73b0f3..713ae2b 100644
--- a/audio_utils/Android.bp
+++ b/audio_utils/Android.bp
@@ -23,6 +23,7 @@
"ErrorLog.cpp",
"fifo.cpp",
"fifo_index.cpp",
+ "fifo_writer32.cpp",
"format.c",
"limiter.c",
"minifloat.c",
diff --git a/audio_utils/fifo_index.cpp b/audio_utils/fifo_index.cpp
index d9a200a..ebb085d 100644
--- a/audio_utils/fifo_index.cpp
+++ b/audio_utils/fifo_index.cpp
@@ -27,6 +27,7 @@
return atomic_load_explicit(&mIndex, std::memory_order_acquire);
}
+// FIXME should inline this, so that writer32 can also inline it
void audio_utils_fifo_index::storeRelease(uint32_t value)
{
atomic_store_explicit(&mIndex, value, std::memory_order_release);
diff --git a/audio_utils/fifo_writer32.cpp b/audio_utils/fifo_writer32.cpp
new file mode 100644
index 0000000..7551e67
--- /dev/null
+++ b/audio_utils/fifo_writer32.cpp
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <atomic>
+#include <stdlib.h>
+#include <string.h>
+
+// TODO templatize int32_t
+
+#include <audio_utils/fifo_writer32.h>
+
+static inline void memcpyWords(int32_t *dst, const int32_t *src, uint32_t count)
+{
+ switch (count) {
+ case 0: break;
+// TODO templatize here also, but first confirm no performance regression compared to current
+#define _(n) \
+ case n: { \
+ struct s##n { int32_t a[n]; }; \
+ *(struct s##n *)dst = *(const struct s##n *)src; \
+ break; \
+ }
+ _(1) _(2) _(3) _(4) _(5) _(6) _(7) _(8) _(9) _(10) _(11) _(12) _(13) _(14) _(15) _(16)
+#undef _
+ default:
+ memcpy(dst, src, count * sizeof(int32_t));
+ break;
+ }
+}
+
+audio_utils_fifo_writer32::audio_utils_fifo_writer32(audio_utils_fifo& fifo) :
+ mLocalRear(0), mFrameCountP2(fifo.mFrameCountP2), mBuffer((int32_t *) fifo.mBuffer),
+ mWriterRear(fifo.mWriterRear)
+{
+ if (fifo.mFrameSize != sizeof(int32_t) || fifo.mFudgeFactor != 0 ||
+ ((size_t) mBuffer & ((sizeof(int32_t) - 1))) != 0) {
+ abort();
+ }
+}
+
+audio_utils_fifo_writer32::~audio_utils_fifo_writer32()
+{
+}
+
+void audio_utils_fifo_writer32::write(const int32_t *buffer, uint32_t count)
+ __attribute__((no_sanitize("integer"))) // mLocalRear += can wrap
+{
+ uint32_t availToWrite = mFrameCountP2;
+ if (availToWrite > count) {
+ availToWrite = count;
+ }
+ uint32_t rearOffset = mLocalRear & (mFrameCountP2 - 1);
+ uint32_t part1 = mFrameCountP2 - rearOffset;
+ if (part1 > availToWrite) {
+ part1 = availToWrite;
+ }
+ memcpyWords(&mBuffer[rearOffset], buffer, part1);
+ // TODO apply this simplification to other copies of the code
+ uint32_t part2 = availToWrite - part1;
+ memcpyWords(&mBuffer[0], &buffer[part1], part2);
+ mLocalRear += availToWrite;
+}
diff --git a/audio_utils/include/audio_utils/PowerLog.h b/audio_utils/include/audio_utils/PowerLog.h
index 1f5a8b7..8ff766b 100644
--- a/audio_utils/include/audio_utils/PowerLog.h
+++ b/audio_utils/include/audio_utils/PowerLog.h
@@ -143,6 +143,7 @@
*
* \param power_log object returned by create, if NULL nothing happens.
* \param fd file descriptor to use.
+ * \param prefix displayed at start of each line.
* \param lines maximum number of lines to output (0 disables).
* \param limit_ns limit dump to data more recent than limit_ns (0 disables).
* \return
diff --git a/audio_utils/include/audio_utils/fifo.h b/audio_utils/include/audio_utils/fifo.h
index 14b50da..e933f9b 100644
--- a/audio_utils/include/audio_utils/fifo.h
+++ b/audio_utils/include/audio_utils/fifo.h
@@ -140,6 +140,7 @@
friend class audio_utils_fifo_reader;
friend class audio_utils_fifo_writer;
+ friend class audio_utils_fifo_writer32;
public:
@@ -253,6 +254,9 @@
*
* \return Actual number of frames available, if greater than or equal to zero.
* Guaranteed to be <= \p count and == iovec[0].mLength + iovec[1].mLength.
+ * For a reader this is also guaranteed to be <= capacity.
+ * For a writer this is also guaranteed to be <= effective buffer size,
+ * even if there is no reader that throttles writer.
*
* \retval -EIO corrupted indices, no recovery is possible
* \retval -EOVERFLOW reader doesn't throttle writer, and frames were lost because reader
@@ -361,6 +365,8 @@
*
* \return Actual number of frames written, if greater than or equal to zero.
* Guaranteed to be <= \p count.
+ * Also guaranteed to be <= effective buffer size,
+ * even if there is no reader that throttles writer.
* The actual transfer count may be zero if the FIFO is full,
* or partial if the FIFO was almost full.
* \retval -EIO corrupted indices, no recovery is possible
@@ -485,6 +491,7 @@
*
* \return Actual number of frames read, if greater than or equal to zero.
* Guaranteed to be <= \p count.
+ * Also guaranteed to be <= capacity.
* The actual transfer count may be zero if the FIFO is empty,
* or partial if the FIFO was almost empty.
* \retval -EIO corrupted indices, no recovery is possible
diff --git a/audio_utils/include/audio_utils/fifo_index.h b/audio_utils/include/audio_utils/fifo_index.h
index 1b8401f..9d2ab51 100644
--- a/audio_utils/include/audio_utils/fifo_index.h
+++ b/audio_utils/include/audio_utils/fifo_index.h
@@ -52,6 +52,7 @@
* Wait for value of index to change from the specified expected value.
*
* \param op Either FUTEX_WAIT or FUTEX_WAIT_PRIVATE.
+ * \param expected Current/expected value of index.
* \param timeout Indicates the maximum time to block while waiting for value to change.
* NULL means to block forever.
* Time is expressed as relative CLOCK_MONOTONIC.
diff --git a/audio_utils/include/audio_utils/fifo_writer32.h b/audio_utils/include/audio_utils/fifo_writer32.h
new file mode 100644
index 0000000..d17d58d
--- /dev/null
+++ b/audio_utils/include/audio_utils/fifo_writer32.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_AUDIO_FIFO_WRITER32_H
+#define ANDROID_AUDIO_FIFO_WRITER32_H
+
+#include <audio_utils/fifo.h>
+
+/**
+ * Optimized FIFO writer for 32-bit words.
+ *
+ * Has these restrictions compared to the ordinary FIFO writer:
+ * - buffer must be aligned on a 32-bit boundary
+ * - frame size must be sizeof(int32_t)
+ * - capacity must be power-of-2
+ * - effective size must be equal to capacity
+ * - no support for throttling of writer by one reader, and thus no blocking writes
+ * - does not implement the provider interface
+ * - does not implement the ordinary writer interface
+ * - does not unblock a reader
+ * - return value from write methods is void
+ * - no implied store-release; must be done explicitly
+ * - may not be combined with ordinary writer
+ *
+ * Usage:
+ * - construct an ordinary FIFO that follows the restrictions above
+ * - construct an ordinary reader based on that FIFO
+ * - construct a writer32 using the FIFO
+ * - use a sequence of write and write1, followed by storeRelease to commit
+ */
+class audio_utils_fifo_writer32 /* : public audio_utils_fifo_provider */ {
+
+public:
+ /**
+ * Construct a writer32 from a FIFO.
+ */
+ explicit audio_utils_fifo_writer32(audio_utils_fifo& fifo);
+ /*virtual*/ ~audio_utils_fifo_writer32();
+
+ /**
+ * Write an array of int32_t to FIFO.
+ * If count is larger than capacity, then only the initial 'capacity' frames will be written.
+ * TODO Instead of a silent truncation, consider adding a size_t or ssize_t return value
+ * to indicate the actual transfer count.
+ */
+ void write(const int32_t *buffer, uint32_t count /* FIXME size_t in writer */);
+
+ /**
+ * Write one int32_t value to FIFO.
+ */
+ void write1(const int32_t value)
+ __attribute__((no_sanitize("integer"))) // mLocalRear ++ can wrap
+ {
+ mBuffer[mLocalRear++ & (mFrameCountP2 - 1)] = value;
+ }
+
+ /**
+ * Commit all previous write and write1 so that they are observable by reader(s).
+ */
+ void storeRelease() {
+ mWriterRear.storeRelease(mLocalRear);
+ }
+
+private:
+ // Accessed by writer only using ordinary operations
+ uint32_t mLocalRear; // frame index of next frame slot available to write, or write index
+
+ // These fields are copied from fifo for better performance (avoids an extra de-reference)
+ const uint32_t mFrameCountP2;
+ int32_t * const mBuffer;
+ audio_utils_fifo_index& mWriterRear;
+};
+
+#endif // ANDROID_AUDIO_FIFO_WRITER32_H
diff --git a/camera/docs/metadata-generate b/camera/docs/metadata-generate
index 0e4dfc2..4912421 100755
--- a/camera/docs/metadata-generate
+++ b/camera/docs/metadata-generate
@@ -21,7 +21,7 @@
# docs.html
# ../src/camera_metadata_tag_info.c
# ../src/camera_metadata_tags.h
-# ../../../../frameworks/av/include/camera/ndk/NdkCameraMetadataTags.h
+# ../../../../frameworks/av/camera/ndk/include/camera/NdkCameraMetadataTags.h
# ../../../../frameworks/av/camera/ndk/impl/ACameraMetadata.cpp
# ../../../../cts/tests/camera/src/android/hardware/camera2/cts/CaptureResultTest.java
# ../../../../frameworks/base/core/java/android/hardware/camera2/CameraCharacteristics.java
@@ -38,7 +38,7 @@
fwkdir_html="$ANDROID_BUILD_TOP/frameworks/base/docs/html"
ctsdir="$ANDROID_BUILD_TOP/cts/tests/camera/src/android/hardware/camera2/cts"
outdir="$ANDROID_PRODUCT_OUT/obj/ETC/system-media-camera-docs_intermediates"
-ndk_header_dir="$ANDROID_BUILD_TOP/frameworks/av/include/camera/ndk"
+ndk_header_dir="$ANDROID_BUILD_TOP/frameworks/av/camera/ndk/include/camera"
ndk_impl_dir="$ANDROID_BUILD_TOP/frameworks/av/camera/ndk/impl"
device_info_dir="$ANDROID_BUILD_TOP/cts/tools/cts-device-info/"`
`"src/com/android/cts/deviceinfo"