c2_e2e_test: ignore configuration changes am: c6443ab01d
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/v4l2_codec2/+/16265240
Change-Id: I7d1e181ab8b7e2e0219a5715dbf9a57838e62682
diff --git a/common/V4L2Device.cpp b/common/V4L2Device.cpp
index 1efb4e3..68a9dca 100644
--- a/common/V4L2Device.cpp
+++ b/common/V4L2Device.cpp
@@ -1986,8 +1986,8 @@
candidatePaths.push_back(devicePattern);
// We are sandboxed, so we can't query directory contents to check which devices are actually
- // available. Try to open the first 10; if not present, we will just fail to open immediately.
- for (int i = 0; i < 10; ++i) {
+ // available. Try to open the first 16; if not present, we will just fail to open immediately.
+ for (int i = 0; i < 16; ++i) {
candidatePaths.push_back(base::StringPrintf("%s%d", devicePattern.c_str(), i));
}
diff --git a/components/V4L2Decoder.cpp b/components/V4L2Decoder.cpp
index 18d62d2..aa59e91 100644
--- a/components/V4L2Decoder.cpp
+++ b/components/V4L2Decoder.cpp
@@ -529,10 +529,13 @@
mFrameAtDevice.clear();
mBlockIdToV4L2Id.clear();
- if (mOutputQueue->allocateBuffers(*numOutputBuffers, V4L2_MEMORY_DMABUF) == 0) {
+ const size_t adjustedNumOutputBuffers =
+ mOutputQueue->allocateBuffers(*numOutputBuffers, V4L2_MEMORY_DMABUF);
+ if (adjustedNumOutputBuffers == 0) {
ALOGE("Failed to allocate output buffer.");
return false;
}
+ ALOGV("Allocated %zu output buffers.", adjustedNumOutputBuffers);
if (!mOutputQueue->streamon()) {
ALOGE("Failed to streamon output queue.");
return false;
@@ -542,7 +545,8 @@
// exists at the same time.
mVideoFramePool.reset();
// Always use flexible pixel 420 format YCBCR_420_888 in Android.
- mVideoFramePool = mGetPoolCb.Run(mCodedSize, HalPixelFormat::YCBCR_420_888, *numOutputBuffers);
+ mVideoFramePool =
+ mGetPoolCb.Run(mCodedSize, HalPixelFormat::YCBCR_420_888, adjustedNumOutputBuffers);
if (!mVideoFramePool) {
ALOGE("Failed to get block pool with size: %s", toString(mCodedSize).c_str());
return false;
diff --git a/service/Android.bp b/service/Android.bp
index 29ee3ff..c901a02 100644
--- a/service/Android.bp
+++ b/service/Android.bp
@@ -23,7 +23,7 @@
shared_libs: [
"libv4l2_codec2_components",
- "libavservices_minijail_vendor",
+ "libavservices_minijail",
"libchrome",
"libcutils",
"libhidlbase",
diff --git a/service/[email protected] b/service/[email protected]
index 266a73e..e4ddbc3 100644
--- a/service/[email protected]
+++ b/service/[email protected]
@@ -3,5 +3,5 @@
user media
group mediadrm drmrpc
ioprio rt 4
- writepid /dev/cpuset/foreground/tasks
+ task_profiles ProcessCapacityHigh
setenv MESA_GLSL_CACHE_DISABLE 1
diff --git a/service/[email protected] b/service/[email protected]
index a9e1c6f..454953b 100644
--- a/service/[email protected]
+++ b/service/[email protected]
@@ -3,5 +3,5 @@
user media
group mediadrm drmrpc
ioprio rt 4
- writepid /dev/cpuset/foreground/tasks
+ task_profiles ProcessCapacityHigh
setenv MESA_GLSL_CACHE_DISABLE 1
diff --git a/tests/c2_e2e_test/jni/Android.bp b/tests/c2_e2e_test/jni/Android.bp
new file mode 100644
index 0000000..7507c30
--- /dev/null
+++ b/tests/c2_e2e_test/jni/Android.bp
@@ -0,0 +1,36 @@
+// Copyright 2019 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package {
+ // See: http://go/android-license-faq
+ default_applicable_licenses: [
+ "external_v4l2_codec2_license",
+ ],
+}
+
+cc_library_shared {
+ name: "libcodectest",
+ srcs: [
+ "video_encoder_e2e_test.cpp",
+ "video_decoder_e2e_test.cpp",
+ "e2e_test_jni.cpp",
+ "common.cpp",
+ "encoded_data_helper.cpp",
+ "video_frame.cpp",
+ "md5.cpp",
+ "mediacodec_encoder.cpp",
+ "mediacodec_decoder.cpp",
+ ],
+ shared_libs: [
+ "liblog",
+ "libmediandk",
+ "libandroid",
+ ],
+ header_libs: ["liblog_headers"],
+ sdk_version: "28",
+ stl: "c++_static",
+ static_libs: ["libgtest_ndk_c++"],
+ // TODO(stevensd): Fix and reenable warnings
+ cflags: ["-Wno-everything"],
+}
diff --git a/tests/c2_e2e_test/jni/Android.mk b/tests/c2_e2e_test/jni/Android.mk
deleted file mode 100644
index 890a74b..0000000
--- a/tests/c2_e2e_test/jni/Android.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- video_encoder_e2e_test.cpp \
- video_decoder_e2e_test.cpp \
- e2e_test_jni.cpp \
- common.cpp \
- encoded_data_helper.cpp \
- video_frame.cpp \
- md5.cpp \
- mediacodec_encoder.cpp \
- mediacodec_decoder.cpp \
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SHARED_LIBRARIES := \
- liblog \
- libmediandk \
- libandroid \
-
-LOCAL_HEADER_LIBRARIES := liblog_headers
-
-LOCAL_SDK_VERSION := 28
-LOCAL_NDK_STL_VARIANT := c++_static
-
-LOCAL_STATIC_LIBRARIES := libgtest_ndk_c++
-
-LOCAL_MODULE := libcodectest
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-BSD legacy_unencumbered
-LOCAL_LICENSE_CONDITIONS := notice unencumbered
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE
-
-# TODO(stevensd): Fix and reenable warnings
-LOCAL_CFLAGS += -Wno-everything
-
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/c2_e2e_test/res/layout/main_activity.xml b/tests/c2_e2e_test/res/layout/main_activity.xml
index be9191e..668aa0c 100644
--- a/tests/c2_e2e_test/res/layout/main_activity.xml
+++ b/tests/c2_e2e_test/res/layout/main_activity.xml
@@ -8,6 +8,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:keepScreenOn="true"
android:orientation="vertical"
android:background="@android:color/darker_gray"
tools:context="org.chromium.c2.test.E2eTestActivity">