summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAri Hausman-Cohen <arihc@google.com>2018-08-13 18:39:23 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-08-13 18:39:23 +0000
commitc8096012179a66163720ba7373e7bdbf42862a58 (patch)
tree356f1ff1c23821383930b38cd39992f6c0961389
parentdc62b58d3dfb4da034e3e2acfb9a26f02f57e696 (diff)
parent628e9d98e7989ac6270714deb0d3b1b555d54323 (diff)
downloadlibhardware-master-cuttlefish-testing-release.tar.gz
Merge changes Ib7227f18,I96926932,I46476112,I2c17b1e4,I47ee9e39, ...android-o-mr1-iot-release-1.0.5android-o-mr1-iot-release-1.0.4master-cuttlefish-testing-release
* changes: camera: replace `-Wno-error` flag with `-Werror` camera: fix `-Wunused-function` compiler warnings camera: fix `-Wpessimizing-move` compiler warnings camera: fix `-Wmissing-field-initializers` compiler warnings camera: fix `-Wsign-compare` compiler warnings camera: fix `-Wunused-variable` compiler warnings camera: fix `-Wunused-private-field` compiler warnings camera: fix `-Wreorder` compiler warnings camera: fix `-Wunused-parameter` compiler warnings camera: fix `-Wformat` compiler warnings camera: fix `-Wmacro-redefined` compiler warnings
-rw-r--r--modules/camera/3_4/Android.mk2
-rw-r--r--modules/camera/3_4/camera.cpp14
-rw-r--r--modules/camera/3_4/common.h10
-rw-r--r--modules/camera/3_4/format_metadata_factory.cpp5
-rw-r--r--modules/camera/3_4/metadata/boottime_state_delegate.cpp3
-rw-r--r--modules/camera/3_4/metadata/control.h2
-rw-r--r--modules/camera/3_4/metadata/enum_converter.cpp3
-rw-r--r--modules/camera/3_4/metadata/enum_converter.h3
-rw-r--r--modules/camera/3_4/metadata/ignored_control_delegate.h2
-rw-r--r--modules/camera/3_4/metadata/map_converter.h3
-rw-r--r--modules/camera/3_4/metadata/metadata.cpp3
-rw-r--r--modules/camera/3_4/metadata/metadata.h2
-rw-r--r--modules/camera/3_4/metadata/metadata_common.h27
-rw-r--r--modules/camera/3_4/metadata/metadata_reader.cpp9
-rw-r--r--modules/camera/3_4/metadata/metadata_reader.h2
-rw-r--r--modules/camera/3_4/metadata/property.h8
-rw-r--r--modules/camera/3_4/metadata/ranged_converter.h3
-rw-r--r--modules/camera/3_4/metadata/state.h10
-rw-r--r--modules/camera/3_4/request_tracker.cpp8
-rw-r--r--modules/camera/3_4/request_tracker.h2
-rw-r--r--modules/camera/3_4/request_tracker_test.cpp6
-rw-r--r--modules/camera/3_4/static_properties.cpp21
-rw-r--r--modules/camera/3_4/static_properties_test.cpp25
-rw-r--r--modules/camera/3_4/stream_format.cpp12
-rw-r--r--modules/camera/3_4/stream_format.h1
-rw-r--r--modules/camera/3_4/v4l2_camera.cpp21
-rw-r--r--modules/camera/3_4/v4l2_camera_hal.cpp19
-rw-r--r--modules/camera/3_4/v4l2_metadata_factory.cpp3
-rw-r--r--modules/camera/3_4/v4l2_wrapper.cpp3
29 files changed, 131 insertions, 101 deletions
diff --git a/modules/camera/3_4/Android.mk b/modules/camera/3_4/Android.mk
index 6ecedaca..3395b5bd 100644
--- a/modules/camera/3_4/Android.mk
+++ b/modules/camera/3_4/Android.mk
@@ -36,7 +36,7 @@ v4l2_static_libs := \
libyuv_static \
libjpeg_static_ndk \
-v4l2_cflags := -fno-short-enums -Wall -Wno-error -Wextra -fvisibility=hidden -DHAVE_JPEG
+v4l2_cflags := -fno-short-enums -Wall -Wextra -Werror -fvisibility=hidden -DHAVE_JPEG
v4l2_c_includes := $(call include-path-for, camera) \
external/libyuv/files/include \
diff --git a/modules/camera/3_4/camera.cpp b/modules/camera/3_4/camera.cpp
index 79dca0b8..387134f9 100644
--- a/modules/camera/3_4/camera.cpp
+++ b/modules/camera/3_4/camera.cpp
@@ -16,6 +16,9 @@
// Modified from hardware/libhardware/modules/camera/Camera.cpp
+//#define LOG_NDEBUG 0
+#define LOG_TAG "Camera"
+
#include <cstdlib>
#include <memory>
#include <vector>
@@ -28,8 +31,6 @@
#include "metadata/metadata_common.h"
-//#define LOG_NDEBUG 0
-#define LOG_TAG "Camera"
#include <cutils/log.h>
#define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
@@ -343,7 +344,7 @@ int Camera::processCaptureRequest(camera3_capture_request_t *temp_request)
// Pre-process output buffers.
if (request->output_buffers.size() <= 0) {
- ALOGE("%s:%d: Invalid number of output buffers: %d", __func__, mId,
+ ALOGE("%s:%d: Invalid number of output buffers: %zu", __func__, mId,
request->output_buffers.size());
return -EINVAL;
}
@@ -433,7 +434,7 @@ int Camera::flush()
completeRequestWithError(request);
}
- ALOGV("%s:%d: Flushed %u requests.", __func__, mId, requests.size());
+ ALOGV("%s:%d: Flushed %zu requests.", __func__, mId, requests.size());
// Call down into the device flushing.
return flushBuffers();
@@ -503,7 +504,10 @@ void Camera::sendResult(std::shared_ptr<CaptureRequest> request) {
static_cast<uint32_t>(request->output_buffers.size()),
request->output_buffers.data(),
request->input_buffer.get(),
- 1 // Total result; only 1 part.
+ 1, // Total result; only 1 part.
+ 0, // Number of physical camera metadata.
+ nullptr,
+ nullptr
};
// Make the framework callback.
mCallbackOps->process_capture_result(mCallbackOps, &result);
diff --git a/modules/camera/3_4/common.h b/modules/camera/3_4/common.h
index ca5151d5..48cf2bd4 100644
--- a/modules/camera/3_4/common.h
+++ b/modules/camera/3_4/common.h
@@ -17,11 +17,8 @@
#ifndef V4L2_CAMERA_HAL_COMMON_H_
#define V4L2_CAMERA_HAL_COMMON_H_
-// #define LOG_NDEBUG 0
#include <cutils/log.h>
-#define LOG_TAG "V4L2CameraHAL"
-
// Helpers of logging (showing function name and line number).
#define HAL_LOGE(fmt, args...) do { \
ALOGE("%s:%d: " fmt, __func__, __LINE__, ##args); \
@@ -59,11 +56,4 @@
#define HAL_LOG_ENTER() HAL_LOGV("enter")
#define HAL_LOG_EXIT() HAL_LOGV("exit")
-// Fix confliction in case it's defined elsewhere.
-#ifndef DISALLOW_COPY_AND_ASSIGN
-#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
- TypeName(const TypeName&); \
- void operator=(const TypeName&);
-#endif
-
#endif // V4L2_CAMERA_HAL_COMMON_H_
diff --git a/modules/camera/3_4/format_metadata_factory.cpp b/modules/camera/3_4/format_metadata_factory.cpp
index db03678d..5eed134e 100644
--- a/modules/camera/3_4/format_metadata_factory.cpp
+++ b/modules/camera/3_4/format_metadata_factory.cpp
@@ -14,6 +14,9 @@
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
+#define LOG_TAG "FormatMetadataFactory"
+
#include "format_metadata_factory.h"
#include "arc/image_processor.h"
@@ -101,7 +104,7 @@ int AddFormatComponents(
return res;
}
- HAL_LOGI("Supports %d qualified formats.", qualified_formats.size());
+ HAL_LOGI("Supports %zu qualified formats.", qualified_formats.size());
// Find sizes and frame/stall durations for all formats.
// We also want to find the smallest max frame duration amongst all formats,
diff --git a/modules/camera/3_4/metadata/boottime_state_delegate.cpp b/modules/camera/3_4/metadata/boottime_state_delegate.cpp
index 5024cb2e..3508e852 100644
--- a/modules/camera/3_4/metadata/boottime_state_delegate.cpp
+++ b/modules/camera/3_4/metadata/boottime_state_delegate.cpp
@@ -14,6 +14,9 @@
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
+#define LOG_TAG "BoottimeStateDelegate"
+
#include <errno.h>
#include <string.h>
diff --git a/modules/camera/3_4/metadata/control.h b/modules/camera/3_4/metadata/control.h
index ad3f87b6..902a60c0 100644
--- a/modules/camera/3_4/metadata/control.h
+++ b/modules/camera/3_4/metadata/control.h
@@ -19,9 +19,9 @@
#include <vector>
+#include <android-base/macros.h>
#include <system/camera_metadata.h>
-#include "../common.h"
#include "metadata_common.h"
#include "partial_metadata_interface.h"
#include "tagged_control_delegate.h"
diff --git a/modules/camera/3_4/metadata/enum_converter.cpp b/modules/camera/3_4/metadata/enum_converter.cpp
index d5e0a876..14da006d 100644
--- a/modules/camera/3_4/metadata/enum_converter.cpp
+++ b/modules/camera/3_4/metadata/enum_converter.cpp
@@ -14,6 +14,9 @@
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
+#define LOG_TAG "EnumConverter"
+
#include "enum_converter.h"
#include <errno.h>
diff --git a/modules/camera/3_4/metadata/enum_converter.h b/modules/camera/3_4/metadata/enum_converter.h
index df5cabb1..83f4daae 100644
--- a/modules/camera/3_4/metadata/enum_converter.h
+++ b/modules/camera/3_4/metadata/enum_converter.h
@@ -19,7 +19,8 @@
#include <map>
-#include "../common.h"
+#include <android-base/macros.h>
+
#include "converter_interface.h"
namespace v4l2_camera_hal {
diff --git a/modules/camera/3_4/metadata/ignored_control_delegate.h b/modules/camera/3_4/metadata/ignored_control_delegate.h
index f1d5da1b..dce457b1 100644
--- a/modules/camera/3_4/metadata/ignored_control_delegate.h
+++ b/modules/camera/3_4/metadata/ignored_control_delegate.h
@@ -32,7 +32,7 @@ class IgnoredControlDelegate : public ControlDelegateInterface<T> {
*value = value_;
return 0;
};
- int SetValue(const T& value) override { return 0; };
+ int SetValue(const T& /*value*/) override { return 0; };
private:
const T value_;
diff --git a/modules/camera/3_4/metadata/map_converter.h b/modules/camera/3_4/metadata/map_converter.h
index b1734b5b..2324d744 100644
--- a/modules/camera/3_4/metadata/map_converter.h
+++ b/modules/camera/3_4/metadata/map_converter.h
@@ -22,7 +22,8 @@
#include <map>
#include <memory>
-#include "../common.h"
+#include <android-base/macros.h>
+
#include "converter_interface.h"
namespace v4l2_camera_hal {
diff --git a/modules/camera/3_4/metadata/metadata.cpp b/modules/camera/3_4/metadata/metadata.cpp
index efc99592..c5106c71 100644
--- a/modules/camera/3_4/metadata/metadata.cpp
+++ b/modules/camera/3_4/metadata/metadata.cpp
@@ -14,6 +14,9 @@
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
+#define LOG_TAG "Metadata"
+
#include "metadata.h"
#include <camera/CameraMetadata.h>
diff --git a/modules/camera/3_4/metadata/metadata.h b/modules/camera/3_4/metadata/metadata.h
index e2232b5f..615b5899 100644
--- a/modules/camera/3_4/metadata/metadata.h
+++ b/modules/camera/3_4/metadata/metadata.h
@@ -19,10 +19,10 @@
#include <set>
+#include <android-base/macros.h>
#include <camera/CameraMetadata.h>
#include <hardware/camera3.h>
-#include "../common.h"
#include "metadata_common.h"
namespace v4l2_camera_hal {
diff --git a/modules/camera/3_4/metadata/metadata_common.h b/modules/camera/3_4/metadata/metadata_common.h
index 34b77777..52fb3ea5 100644
--- a/modules/camera/3_4/metadata/metadata_common.h
+++ b/modules/camera/3_4/metadata/metadata_common.h
@@ -120,32 +120,41 @@ static int UpdateMetadata(android::CameraMetadata* metadata,
// A helper for other methods in this file.
// Gets the data pointer of a given metadata entry into |*val|.
-static void GetDataPointer(camera_metadata_ro_entry_t& entry,
+template <typename T>
+inline void GetDataPointer(camera_metadata_ro_entry_t&, const T**);
+
+template <>
+inline void GetDataPointer<uint8_t>(camera_metadata_ro_entry_t& entry,
const uint8_t** val) {
*val = entry.data.u8;
}
-static void GetDataPointer(camera_metadata_ro_entry_t& entry,
+template <>
+inline void GetDataPointer<int32_t>(camera_metadata_ro_entry_t& entry,
const int32_t** val) {
*val = entry.data.i32;
}
-static void GetDataPointer(camera_metadata_ro_entry_t& entry,
+template <>
+inline void GetDataPointer<float>(camera_metadata_ro_entry_t& entry,
const float** val) {
*val = entry.data.f;
}
-static void GetDataPointer(camera_metadata_ro_entry_t& entry,
+template <>
+inline void GetDataPointer<int64_t>(camera_metadata_ro_entry_t& entry,
const int64_t** val) {
*val = entry.data.i64;
}
-static void GetDataPointer(camera_metadata_ro_entry_t& entry,
+template <>
+inline void GetDataPointer<double>(camera_metadata_ro_entry_t& entry,
const double** val) {
*val = entry.data.d;
}
-static void GetDataPointer(camera_metadata_ro_entry_t& entry,
+template <>
+inline void GetDataPointer<camera_metadata_rational_t>(camera_metadata_ro_entry_t& entry,
const camera_metadata_rational_t** val) {
*val = entry.data.r;
}
@@ -180,7 +189,7 @@ static int SingleTagValue(const android::CameraMetadata& metadata,
} else if (entry.count != 1) {
HAL_LOGE(
"Error: expected metadata tag %d to contain exactly 1 value "
- "(had %d).",
+ "(had %zu).",
tag,
entry.count);
return -EINVAL;
@@ -211,7 +220,7 @@ static int SingleTagValue(const android::CameraMetadata& metadata,
} else if (entry.count != N) {
HAL_LOGE(
"Error: expected metadata tag %d to contain a single array of "
- "exactly %d values (had %d).",
+ "exactly %zu values (had %zu).",
tag,
N,
entry.count);
@@ -284,7 +293,7 @@ static int VectorTagValue(const android::CameraMetadata& metadata,
if (entry.count % N != 0) {
HAL_LOGE(
"Error: expected metadata tag %d to contain a vector of arrays of "
- "length %d (had %d entries, which is not divisible by %d).",
+ "length %zu (had %zu entries, which is not divisible by %zu).",
tag,
N,
entry.count,
diff --git a/modules/camera/3_4/metadata/metadata_reader.cpp b/modules/camera/3_4/metadata/metadata_reader.cpp
index fe2ff859..6a25127c 100644
--- a/modules/camera/3_4/metadata/metadata_reader.cpp
+++ b/modules/camera/3_4/metadata/metadata_reader.cpp
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-#include "metadata_reader.h"
-
// #define LOG_NDEBUG 0
#define LOG_TAG "MetadataReader"
+
+#include "metadata_reader.h"
+
#include <cutils/log.h>
#include <system/camera.h>
@@ -200,9 +201,9 @@ int MetadataReader::StreamStallDurations(
}
// Must have a non-negative stall.
if (stall.duration < 0) {
- ALOGE("%s: Invalid stall duration: negative stall %d.",
+ ALOGE("%s: Invalid stall duration: negative stall %lld.",
__func__,
- stall.duration);
+ static_cast<long long>(stall.duration));
return -EINVAL;
}
// TODO(b/31384253): YUV_420_888, RAW10, RAW12, RAW_OPAQUE,
diff --git a/modules/camera/3_4/metadata/metadata_reader.h b/modules/camera/3_4/metadata/metadata_reader.h
index 996bf8b4..8e05079e 100644
--- a/modules/camera/3_4/metadata/metadata_reader.h
+++ b/modules/camera/3_4/metadata/metadata_reader.h
@@ -22,9 +22,9 @@
#include <set>
#include <vector>
+#include <android-base/macros.h>
#include <camera/CameraMetadata.h>
-#include "../common.h"
#include "types.h"
namespace default_camera_hal {
diff --git a/modules/camera/3_4/metadata/property.h b/modules/camera/3_4/metadata/property.h
index 6884c7dd..6a542b28 100644
--- a/modules/camera/3_4/metadata/property.h
+++ b/modules/camera/3_4/metadata/property.h
@@ -41,22 +41,22 @@ class Property : public PartialMetadataInterface {
};
virtual int PopulateDynamicFields(
- android::CameraMetadata* metadata) const override {
+ android::CameraMetadata* /*metadata*/) const override {
return 0;
};
virtual int PopulateTemplateRequest(
- int template_type, android::CameraMetadata* metadata) const override {
+ int /*template_type*/, android::CameraMetadata* /*metadata*/) const override {
return 0;
};
virtual bool SupportsRequestValues(
- const android::CameraMetadata& metadata) const override {
+ const android::CameraMetadata& /*metadata*/) const override {
return true;
};
virtual int SetRequestValues(
- const android::CameraMetadata& metadata) override {
+ const android::CameraMetadata& /*metadata*/) override {
return 0;
};
diff --git a/modules/camera/3_4/metadata/ranged_converter.h b/modules/camera/3_4/metadata/ranged_converter.h
index 115ac2a7..bc48767f 100644
--- a/modules/camera/3_4/metadata/ranged_converter.h
+++ b/modules/camera/3_4/metadata/ranged_converter.h
@@ -19,7 +19,8 @@
#include <memory>
-#include "../common.h"
+#include <android-base/macros.h>
+
#include "converter_interface.h"
namespace v4l2_camera_hal {
diff --git a/modules/camera/3_4/metadata/state.h b/modules/camera/3_4/metadata/state.h
index 54f66e47..13f2ea5f 100644
--- a/modules/camera/3_4/metadata/state.h
+++ b/modules/camera/3_4/metadata/state.h
@@ -54,7 +54,7 @@ class State : public PartialMetadataInterface {
// -----------------------------------------------------------------------------
template <typename T>
-int State<T>::PopulateStaticFields(android::CameraMetadata* metadata) const {
+int State<T>::PopulateStaticFields(android::CameraMetadata* /*metadata*/) const {
HAL_LOG_ENTER();
return 0;
}
@@ -72,21 +72,21 @@ int State<T>::PopulateDynamicFields(android::CameraMetadata* metadata) const {
};
template <typename T>
-int State<T>::PopulateTemplateRequest(int template_type,
- android::CameraMetadata* metadata) const {
+int State<T>::PopulateTemplateRequest(int /*template_type*/,
+ android::CameraMetadata* /*metadata*/) const {
HAL_LOG_ENTER();
return 0;
};
template <typename T>
bool State<T>::SupportsRequestValues(
- const android::CameraMetadata& metadata) const {
+ const android::CameraMetadata& /*metadata*/) const {
HAL_LOG_ENTER();
return true;
};
template <typename T>
-int State<T>::SetRequestValues(const android::CameraMetadata& metadata) {
+int State<T>::SetRequestValues(const android::CameraMetadata& /*metadata*/) {
HAL_LOG_ENTER();
return 0;
};
diff --git a/modules/camera/3_4/request_tracker.cpp b/modules/camera/3_4/request_tracker.cpp
index 09f634d1..f92d2544 100644
--- a/modules/camera/3_4/request_tracker.cpp
+++ b/modules/camera/3_4/request_tracker.cpp
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-#include "request_tracker.h"
-
// #define LOG_NDEBUG 0
#define LOG_TAG "RequestTracker"
+
+#include "request_tracker.h"
+
#include <cutils/log.h>
namespace default_camera_hal {
@@ -50,7 +51,7 @@ std::set<camera3_stream_t*> RequestStreams(const CaptureRequest& request) {
for (const auto& output_buffer : request.output_buffers) {
result.insert(output_buffer.stream);
}
- return std::move(result);
+ return result;
}
bool RequestTracker::Add(std::shared_ptr<CaptureRequest> request) {
@@ -127,7 +128,6 @@ bool RequestTracker::CanAddRequest(const CaptureRequest& request) const {
// Check that each stream has space
// (which implicitly checks if it is configured).
- bool result = true;
for (const auto stream : RequestStreams(request)) {
if (StreamFull(stream)) {
ALOGE("%s: Stream %p is full.", __func__, stream);
diff --git a/modules/camera/3_4/request_tracker.h b/modules/camera/3_4/request_tracker.h
index a632a614..e0bb4b52 100644
--- a/modules/camera/3_4/request_tracker.h
+++ b/modules/camera/3_4/request_tracker.h
@@ -22,9 +22,9 @@
#include <set>
#include <hardware/camera3.h>
+#include <android-base/macros.h>
#include "capture_request.h"
-#include "common.h"
namespace default_camera_hal {
diff --git a/modules/camera/3_4/request_tracker_test.cpp b/modules/camera/3_4/request_tracker_test.cpp
index 8b73bd89..001ba78b 100644
--- a/modules/camera/3_4/request_tracker_test.cpp
+++ b/modules/camera/3_4/request_tracker_test.cpp
@@ -35,7 +35,11 @@ class RequestTrackerTest : public Test {
stream2_.max_buffers = 3;
dut_.reset(new RequestTracker());
streams_ = {&stream1_, &stream2_};
- camera3_stream_configuration_t config{static_cast<uint32_t>(streams_.size()), streams_.data(), 0};
+ camera3_stream_configuration_t config{
+ static_cast<uint32_t>(streams_.size()),
+ streams_.data(),
+ 0,
+ nullptr};
dut_->SetStreamConfiguration(config);
}
diff --git a/modules/camera/3_4/static_properties.cpp b/modules/camera/3_4/static_properties.cpp
index 5be9dcdd..0e8ba230 100644
--- a/modules/camera/3_4/static_properties.cpp
+++ b/modules/camera/3_4/static_properties.cpp
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-#include "static_properties.h"
-
// #define LOG_NDEBUG 0
#define LOG_TAG "StaticProperties"
+
+#include "static_properties.h"
+
#include <cutils/log.h>
#include <hardware/camera3.h>
#include <system/camera.h>
@@ -276,11 +277,11 @@ bool StaticProperties::SanityCheckStreamConfiguration(
for (size_t i = 0; i < stream_config->num_streams; ++i) {
const camera3_stream_t* stream = stream_config->streams[i];
if (stream == nullptr) {
- ALOGE("%s: Stream %d is null", __func__, i);
+ ALOGE("%s: Stream %zu is null", __func__, i);
return false;
} else if (!IsInputType(stream->stream_type) &&
!IsOutputType(stream->stream_type)) {
- ALOGE("%s: Stream %d type %d is neither an input nor an output type",
+ ALOGE("%s: Stream %zu type %d is neither an input nor an output type",
__func__,
i,
stream->stream_type);
@@ -294,7 +295,7 @@ bool StaticProperties::SanityCheckStreamConfiguration(
bool StaticProperties::InputStreamsSupported(
const camera3_stream_configuration_t* stream_config) {
// Find the input stream(s).
- size_t num_input_streams = 0;
+ int32_t num_input_streams = 0;
int input_format = -1;
for (size_t i = 0; i < stream_config->num_streams; ++i) {
const camera3_stream_t* stream = stream_config->streams[i];
@@ -370,10 +371,10 @@ bool StaticProperties::InputStreamsSupported(
bool StaticProperties::OutputStreamsSupported(
const camera3_stream_configuration_t* stream_config) {
// Find and count output streams.
- size_t num_raw = 0;
- size_t num_stalling = 0;
- size_t num_non_stalling = 0;
- for (int i = 0; i < stream_config->num_streams; ++i) {
+ int32_t num_raw = 0;
+ int32_t num_stalling = 0;
+ int32_t num_non_stalling = 0;
+ for (size_t i = 0; i < stream_config->num_streams; ++i) {
const camera3_stream_t* stream = stream_config->streams[i];
if (IsOutputType(stream->stream_type)) {
// Check that this stream is valid as an output.
@@ -413,7 +414,7 @@ bool StaticProperties::OutputStreamsSupported(
} else if (num_stalling > max_stalling_output_streams_) {
ALOGE(
"%s: Requested stream configuration exceeds maximum supported "
- "stalling output streams %d (requested %d).",
+ "stalling output streams %d (requested %u).",
__func__,
max_stalling_output_streams_,
num_stalling);
diff --git a/modules/camera/3_4/static_properties_test.cpp b/modules/camera/3_4/static_properties_test.cpp
index 2cdb9d4d..13b9e964 100644
--- a/modules/camera/3_4/static_properties_test.cpp
+++ b/modules/camera/3_4/static_properties_test.cpp
@@ -94,10 +94,12 @@ class StaticPropertiesTest : public Test {
} else if (input) {
type = CAMERA3_STREAM_INPUT;
}
- return {static_cast<int>(type),
- static_cast<uint32_t>(width),
- static_cast<uint32_t>(height),
- static_cast<int>(format)};
+ camera3_stream_t stream;
+ stream.stream_type = type;
+ stream.width = width;
+ stream.height = height;
+ stream.format = format;
+ return stream;
}
void ExpectConfigurationSupported(std::vector<camera3_stream_t>& streams,
@@ -109,7 +111,8 @@ class StaticPropertiesTest : public Test {
camera3_stream_configuration_t config = {
static_cast<uint32_t>(stream_addresses.size()),
stream_addresses.data(),
- CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE};
+ CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE,
+ nullptr};
PrepareDefaultDUT();
EXPECT_EQ(dut_->StreamConfigurationSupported(&config), expected);
}
@@ -435,7 +438,7 @@ TEST_F(StaticPropertiesTest, ConfigureNull) {
TEST_F(StaticPropertiesTest, ConfigureEmptyStreams) {
std::vector<camera3_stream_t*> streams(1);
camera3_stream_configuration_t config = {
- 0, streams.data(), CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE};
+ 0, streams.data(), CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE, nullptr};
PrepareDefaultDUT();
EXPECT_FALSE(dut_->StreamConfigurationSupported(&config));
}
@@ -443,7 +446,10 @@ TEST_F(StaticPropertiesTest, ConfigureEmptyStreams) {
TEST_F(StaticPropertiesTest, ConfigureNullStreams) {
std::vector<camera3_stream_t*> streams(2, nullptr);
camera3_stream_configuration_t config = {
- static_cast<uint32_t>(streams.size()), streams.data(), CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE};
+ static_cast<uint32_t>(streams.size()),
+ streams.data(),
+ CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE,
+ nullptr};
PrepareDefaultDUT();
EXPECT_FALSE(dut_->StreamConfigurationSupported(&config));
}
@@ -451,7 +457,7 @@ TEST_F(StaticPropertiesTest, ConfigureNullStreams) {
TEST_F(StaticPropertiesTest, ConfigureNullStreamVector) {
// Even if the camera claims to have multiple streams, check for null.
camera3_stream_configuration_t config = {
- 3, nullptr, CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE};
+ 3, nullptr, CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE, nullptr};
PrepareDefaultDUT();
EXPECT_FALSE(dut_->StreamConfigurationSupported(&config));
}
@@ -616,7 +622,8 @@ TEST_F(StaticPropertiesTest, ConfigureBadOperationMode) {
camera3_stream_configuration_t config = {
1,
&stream_address,
- 99 // Not a valid operation mode.
+ 99, // Not a valid operation mode.
+ nullptr
};
PrepareDefaultDUT();
EXPECT_FALSE(dut_->StreamConfigurationSupported(&config));
diff --git a/modules/camera/3_4/stream_format.cpp b/modules/camera/3_4/stream_format.cpp
index 5f35e425..401a2f09 100644
--- a/modules/camera/3_4/stream_format.cpp
+++ b/modules/camera/3_4/stream_format.cpp
@@ -14,6 +14,9 @@
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
+#define LOG_TAG "StreamFormat"
+
#include "stream_format.h"
#include <linux/videodev2.h>
@@ -41,8 +44,7 @@ StreamFormat::StreamFormat(int format, uint32_t width, uint32_t height)
v4l2_pixel_format_(StreamFormat::HalToV4L2PixelFormat(format)),
width_(width),
height_(height),
- bytes_per_line_(0),
- min_buffer_size_(0) {}
+ bytes_per_line_(0) {}
StreamFormat::StreamFormat(const v4l2_format& format)
: type_(format.type),
@@ -50,16 +52,14 @@ StreamFormat::StreamFormat(const v4l2_format& format)
v4l2_pixel_format_(format.fmt.pix.pixelformat),
width_(format.fmt.pix.width),
height_(format.fmt.pix.height),
- bytes_per_line_(format.fmt.pix.bytesperline),
- min_buffer_size_(format.fmt.pix.sizeimage) {}
+ bytes_per_line_(format.fmt.pix.bytesperline) {}
StreamFormat::StreamFormat(const arc::SupportedFormat& format)
: type_(V4L2_BUF_TYPE_VIDEO_CAPTURE),
v4l2_pixel_format_(format.fourcc),
width_(format.width),
height_(format.height),
- bytes_per_line_(0),
- min_buffer_size_(0) {}
+ bytes_per_line_(0) {}
void StreamFormat::FillFormatRequest(v4l2_format* format) const {
memset(format, 0, sizeof(*format));
diff --git a/modules/camera/3_4/stream_format.h b/modules/camera/3_4/stream_format.h
index 720e3800..82ec440d 100644
--- a/modules/camera/3_4/stream_format.h
+++ b/modules/camera/3_4/stream_format.h
@@ -78,7 +78,6 @@ class StreamFormat {
uint32_t width_;
uint32_t height_;
uint32_t bytes_per_line_;
- uint32_t min_buffer_size_;
};
} // namespace v4l2_camera_hal
diff --git a/modules/camera/3_4/v4l2_camera.cpp b/modules/camera/3_4/v4l2_camera.cpp
index 98b80622..558b4535 100644
--- a/modules/camera/3_4/v4l2_camera.cpp
+++ b/modules/camera/3_4/v4l2_camera.cpp
@@ -14,6 +14,9 @@
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
+#define LOG_TAG "V4L2Camera"
+
#include "v4l2_camera.h"
#include <fcntl.h>
@@ -36,18 +39,6 @@
namespace v4l2_camera_hal {
-// Helper function for managing metadata.
-static std::vector<int32_t> getMetadataKeys(const camera_metadata_t* metadata) {
- std::vector<int32_t> keys;
- size_t num_entries = get_camera_metadata_entry_count(metadata);
- for (size_t i = 0; i < num_entries; ++i) {
- camera_metadata_ro_entry_t entry;
- get_camera_metadata_ro_entry(metadata, i, &entry);
- keys.push_back(entry.tag);
- }
- return keys;
-}
-
V4L2Camera* V4L2Camera::NewV4L2Camera(int id, const std::string path) {
HAL_LOG_ENTER();
@@ -73,12 +64,12 @@ V4L2Camera::V4L2Camera(int id,
: default_camera_hal::Camera(id),
device_(std::move(v4l2_wrapper)),
metadata_(std::move(metadata)),
- max_input_streams_(0),
- max_output_streams_({{0, 0, 0}}),
buffer_enqueuer_(new FunctionThread(
std::bind(&V4L2Camera::enqueueRequestBuffers, this))),
buffer_dequeuer_(new FunctionThread(
- std::bind(&V4L2Camera::dequeueRequestBuffers, this))) {
+ std::bind(&V4L2Camera::dequeueRequestBuffers, this))),
+ max_input_streams_(0),
+ max_output_streams_({{0, 0, 0}}) {
HAL_LOG_ENTER();
}
diff --git a/modules/camera/3_4/v4l2_camera_hal.cpp b/modules/camera/3_4/v4l2_camera_hal.cpp
index 83746ceb..386160f4 100644
--- a/modules/camera/3_4/v4l2_camera_hal.cpp
+++ b/modules/camera/3_4/v4l2_camera_hal.cpp
@@ -16,6 +16,9 @@
// Modified from hardware/libhardware/modules/camera/CameraHAL.cpp
+//#define LOG_NDEBUG 0
+#define LOG_TAG "V4L2CameraHAL"
+
#include "v4l2_camera_hal.h"
#include <dirent.h>
@@ -112,13 +115,13 @@ V4L2CameraHAL::~V4L2CameraHAL() {
}
int V4L2CameraHAL::getNumberOfCameras() {
- HAL_LOGV("returns %d", mCameras.size());
+ HAL_LOGV("returns %zu", mCameras.size());
return mCameras.size();
}
int V4L2CameraHAL::getCameraInfo(int id, camera_info_t* info) {
HAL_LOG_ENTER();
- if (id < 0 || id >= mCameras.size()) {
+ if (id < 0 || static_cast<size_t>(id) >= mCameras.size()) {
return -EINVAL;
}
// TODO(b/29185945): Hotplugging: return -EINVAL if unplugged.
@@ -131,22 +134,22 @@ int V4L2CameraHAL::setCallbacks(const camera_module_callbacks_t* callbacks) {
return 0;
}
-void V4L2CameraHAL::getVendorTagOps(vendor_tag_ops_t* ops) {
+void V4L2CameraHAL::getVendorTagOps(vendor_tag_ops_t* /*ops*/) {
HAL_LOG_ENTER();
// No vendor ops for this HAL. From <hardware/camera_common.h>:
// "leave ops unchanged if no vendor tags are defined."
}
-int V4L2CameraHAL::openLegacy(const hw_module_t* module,
- const char* id,
- uint32_t halVersion,
- hw_device_t** device) {
+int V4L2CameraHAL::openLegacy(const hw_module_t* /*module*/,
+ const char* /*id*/,
+ uint32_t /*halVersion*/,
+ hw_device_t** /*device*/) {
HAL_LOG_ENTER();
// Not supported.
return -ENOSYS;
}
-int V4L2CameraHAL::setTorchMode(const char* camera_id, bool enabled) {
+int V4L2CameraHAL::setTorchMode(const char* /*camera_id*/, bool /*enabled*/) {
HAL_LOG_ENTER();
// TODO(b/29158098): HAL is required to respond appropriately if
// the desired camera actually does support flash.
diff --git a/modules/camera/3_4/v4l2_metadata_factory.cpp b/modules/camera/3_4/v4l2_metadata_factory.cpp
index bc8806f7..535f5629 100644
--- a/modules/camera/3_4/v4l2_metadata_factory.cpp
+++ b/modules/camera/3_4/v4l2_metadata_factory.cpp
@@ -14,6 +14,9 @@
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
+#define LOG_TAG "V4L2MetadataFactory"
+
#include "v4l2_metadata_factory.h"
#include <camera/CameraMetadata.h>
diff --git a/modules/camera/3_4/v4l2_wrapper.cpp b/modules/camera/3_4/v4l2_wrapper.cpp
index d715e7ec..085683d6 100644
--- a/modules/camera/3_4/v4l2_wrapper.cpp
+++ b/modules/camera/3_4/v4l2_wrapper.cpp
@@ -14,6 +14,9 @@
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
+#define LOG_TAG "V4L2Wrapper"
+
#include "v4l2_wrapper.h"
#include <algorithm>