Merge "GNSS HAL radio group for E911 SUPL"
diff --git a/audio/2.0/default/Stream.cpp b/audio/2.0/default/Stream.cpp
index 671f171..effdd28 100644
--- a/audio/2.0/default/Stream.cpp
+++ b/audio/2.0/default/Stream.cpp
@@ -44,8 +44,20 @@
}
// static
-Result Stream::analyzeStatus(const char* funcName, int status, int ignoreError, int ignoreError2) {
- if (status != 0 && status != -ignoreError && status != -ignoreError2) {
+Result Stream::analyzeStatus(const char* funcName, int status) {
+ static const std::vector<int> empty;
+ return analyzeStatus(funcName, status, empty);
+}
+
+template <typename T>
+inline bool element_in(T e, const std::vector<T>& v) {
+ return std::find(v.begin(), v.end(), e) != v.end();
+}
+
+// static
+Result Stream::analyzeStatus(const char* funcName, int status,
+ const std::vector<int>& ignoreErrors) {
+ if (status != 0 && (ignoreErrors.empty() || !element_in(-status, ignoreErrors))) {
ALOGW("Error from HAL stream in function %s: %s", funcName, strerror(-status));
}
switch (status) {
diff --git a/audio/2.0/default/Stream.h b/audio/2.0/default/Stream.h
index b49e658..82f05a7 100644
--- a/audio/2.0/default/Stream.h
+++ b/audio/2.0/default/Stream.h
@@ -17,6 +17,8 @@
#ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H
#define ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H
+#include <vector>
+
#include <android/hardware/audio/2.0/IStream.h>
#include <hardware/audio.h>
#include <hidl/Status.h>
@@ -79,10 +81,11 @@
Return<Result> close() override;
// Utility methods for extending interfaces.
- static Result analyzeStatus(
- const char* funcName, int status, int ignoreError = OK, int ignoreError2 = OK);
+ static Result analyzeStatus(const char* funcName, int status);
+ static Result analyzeStatus(const char* funcName, int status,
+ const std::vector<int>& ignoreErrors);
- private:
+ private:
audio_stream_t *mStream;
virtual ~Stream();
diff --git a/audio/2.0/default/StreamIn.cpp b/audio/2.0/default/StreamIn.cpp
index abd0497..b81cbb9 100644
--- a/audio/2.0/default/StreamIn.cpp
+++ b/audio/2.0/default/StreamIn.cpp
@@ -416,15 +416,15 @@
// static
Result StreamIn::getCapturePositionImpl(audio_stream_in_t* stream,
uint64_t* frames, uint64_t* time) {
+ // HAL may have a stub function, always returning ENOSYS, don't
+ // spam the log in this case.
+ static const std::vector<int> ignoredErrors{ENOSYS};
Result retval(Result::NOT_SUPPORTED);
if (stream->get_capture_position != NULL) return retval;
int64_t halFrames, halTime;
- retval = Stream::analyzeStatus(
- "get_capture_position",
- stream->get_capture_position(stream, &halFrames, &halTime),
- // HAL may have a stub function, always returning ENOSYS, don't
- // spam the log in this case.
- ENOSYS);
+ retval = Stream::analyzeStatus("get_capture_position",
+ stream->get_capture_position(stream, &halFrames, &halTime),
+ ignoredErrors);
if (retval == Result::OK) {
*frames = halFrames;
*time = halTime;
diff --git a/audio/2.0/default/StreamOut.cpp b/audio/2.0/default/StreamOut.cpp
index e48497f..290d0b1 100644
--- a/audio/2.0/default/StreamOut.cpp
+++ b/audio/2.0/default/StreamOut.cpp
@@ -487,16 +487,17 @@
Result StreamOut::getPresentationPositionImpl(audio_stream_out_t* stream,
uint64_t* frames,
TimeSpec* timeStamp) {
+ // Don't logspam on EINVAL--it's normal for get_presentation_position
+ // to return it sometimes. EAGAIN may be returned by A2DP audio HAL
+ // implementation. ENODATA can also be reported while the writer is
+ // continuously querying it, but the stream has been stopped.
+ static const std::vector<int> ignoredErrors{EINVAL, EAGAIN, ENODATA};
Result retval(Result::NOT_SUPPORTED);
if (stream->get_presentation_position == NULL) return retval;
struct timespec halTimeStamp;
- retval = Stream::analyzeStatus(
- "get_presentation_position",
- stream->get_presentation_position(stream, frames, &halTimeStamp),
- // Don't logspam on EINVAL--it's normal for get_presentation_position
- // to return it sometimes. EAGAIN may be returned by A2DP audio HAL
- // implementation.
- EINVAL, EAGAIN);
+ retval = Stream::analyzeStatus("get_presentation_position",
+ stream->get_presentation_position(stream, frames, &halTimeStamp),
+ ignoredErrors);
if (retval == Result::OK) {
timeStamp->tvSec = halTimeStamp.tv_sec;
timeStamp->tvNSec = halTimeStamp.tv_nsec;
diff --git a/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp b/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
index 8ddbad4..90fec01 100644
--- a/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
+++ b/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
@@ -746,12 +746,12 @@
TEST_IO_STREAM(
GetSampleRate,
"Check that the stream sample rate == the one it was opened with",
- ASSERT_EQ(audioConfig.sampleRateHz, extract(stream->getSampleRate())))
+ stream->getSampleRate())
TEST_IO_STREAM(
GetChannelMask,
"Check that the stream channel mask == the one it was opened with",
- ASSERT_EQ(audioConfig.channelMask, extract(stream->getChannelMask())))
+ stream->getChannelMask())
TEST_IO_STREAM(GetFormat,
"Check that the stream format == the one it was opened with",
@@ -853,25 +853,17 @@
areAudioPatchesSupported() ? doc::partialTest("Audio patches are supported")
: testSetDevice(stream.get(), address))
-static void testGetAudioProperties(IStream* stream,
- AudioConfig expectedConfig) {
+static void testGetAudioProperties(IStream* stream) {
uint32_t sampleRateHz;
AudioChannelMask mask;
AudioFormat format;
-
stream->getAudioProperties(returnIn(sampleRateHz, mask, format));
-
- // FIXME: the qcom hal it does not currently negotiate the sampleRate &
- // channel mask
- EXPECT_EQ(expectedConfig.sampleRateHz, sampleRateHz);
- EXPECT_EQ(expectedConfig.channelMask, mask);
- EXPECT_EQ(expectedConfig.format, format);
}
TEST_IO_STREAM(
GetAudioProperties,
"Check that the stream audio properties == the ones it was opened with",
- testGetAudioProperties(stream.get(), audioConfig))
+ testGetAudioProperties(stream.get()))
static void testConnectedState(IStream* stream) {
DeviceAddress address = {};
diff --git a/audio/effect/2.0/xml/audio_effects_conf_V2_0.xsd b/audio/effect/2.0/xml/audio_effects_conf_V2_0.xsd
new file mode 100644
index 0000000..64647de
--- /dev/null
+++ b/audio/effect/2.0/xml/audio_effects_conf_V2_0.xsd
@@ -0,0 +1,238 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://schemas.android.com/audio/audio_effects_conf/v2_0"
+ xmlns:aec="http://schemas.android.com/audio/audio_effects_conf/v2_0"
+ elementFormDefault="qualified">
+
+ <!-- Simple types -->
+ <xs:simpleType name="versionType">
+ <xs:restriction base="xs:decimal">
+ <xs:enumeration value="2.0"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="uuidType">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="streamInputType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="mic"/>
+ <xs:enumeration value="voice_uplink"/>
+ <xs:enumeration value="voice_downlink"/>
+ <xs:enumeration value="voice_call"/>
+ <xs:enumeration value="camcorder"/>
+ <xs:enumeration value="voice_recognition"/>
+ <xs:enumeration value="voice_communication"/>
+ <xs:enumeration value="unprocessed"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="streamOutputType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="default"/>
+ <xs:enumeration value="voice_call"/>
+ <xs:enumeration value="system"/>
+ <xs:enumeration value="ring"/>
+ <xs:enumeration value="music"/>
+ <xs:enumeration value="alarm"/>
+ <xs:enumeration value="notification"/>
+ <xs:enumeration value="bluetooth_sco"/>
+ <xs:enumeration value="enforced_audible"/>
+ <xs:enumeration value="dtmf"/>
+ <xs:enumeration value="tts"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <!-- Complex types -->
+ <xs:complexType name="libraryType">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">
+ List of effect libraries to load. Each library element must have "name" and
+ "path" attributes. The latter is giving the full path of the library .so file.
+
+ Example:
+
+ <library name="name" path="/vendor/lib/soundfx/lib.so"/>
+
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element name="library" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="path" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="effectImplType">
+ <xs:attribute name="library" type="xs:string" use="required"/>
+ <xs:attribute name="uuid" type="aec:uuidType" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="effectProxyType">
+ <xs:complexContent>
+ <xs:extension base="aec:effectImplType">
+ <xs:sequence>
+ <xs:element name="libsw" type="aec:effectImplType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="libhw" type="aec:effectImplType" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="effectType">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">
+ List of effects to load. Each effect element must contain "name",
+ "library", and "uuid" attrs. The value of the "library" attr must
+ correspond to the name of a "library" element. The name of the effect
+ element is indicative, only the value of the "uuid" element designates
+ the effect for the audio framework. The uuid is the implementation
+ specific UUID as specified by the effect vendor. This is not the generic
+ effect type UUID.
+
+ For effect proxy implementations, SW and HW implemetations of the effect
+ can be specified.
+
+ Example:
+
+ <effect name="name" library="lib" uuid="uuuu"/>
+ <effect name="proxied" library="proxy" uuid="xxxx">
+ <libsw library="sw_bundle" uuid="yyyy"/>
+ <libhw library="offload_bundle" uuid="zzzz"/>
+ </effect>
+
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element name="effect" type="aec:effectProxyType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="streamProcessingType">
+ <xs:sequence>
+ <xs:element name="apply" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="effect" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="streamPreprocessType">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">
+ Audio preprocessing configuration. The processing configuration consists
+ of a list of elements each describing processing settings for a given
+ input stream. Valid input stream types are listed in "streamInputType".
+
+ Each stream element contains a list of "apply" elements. The value of the
+ "effect" attr must correspond to the name of an "effect" element.
+
+ Example:
+
+ <stream type="voice_communication">
+ <apply effect="effect1"/>
+ <apply effect="effect2"/>
+ </stream>
+
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="aec:streamProcessingType">
+ <xs:attribute name="type" type="aec:streamInputType" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:complexType name="streamPostprocessType">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">
+ Audio postprocessing configuration. The processing configuration consists
+ of a list of elements each describing processing settings for a given
+ output stream. Valid output stream types are listed in "streamOutputType".
+
+ Each stream element contains a list of "apply" elements. The value of the
+ "effect" attr must correspond to the name of an "effect" element.
+
+ Example:
+
+ <stream type="music">
+ <apply effect="effect1"/>
+ </stream>
+
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="aec:streamProcessingType">
+ <xs:attribute name="type" type="aec:streamOutputType" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <!-- Root element -->
+ <xs:element name="audio_effects_conf">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="libraries" type="aec:libraryType"/>
+ <xs:element name="effects" type="aec:effectType"/>
+ <xs:element name="postprocess" minOccurs="0" maxOccurs="1">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="stream" type="aec:streamPostprocessType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="preprocess" minOccurs="0" maxOccurs="1">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="stream" type="aec:streamPreprocessType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="version" type="aec:versionType" use="required"/>
+ </xs:complexType>
+
+ <!-- Keys and references -->
+ <xs:key name="libraryName">
+ <xs:selector xpath="aec:libraries/aec:library"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+ <xs:keyref name="libraryNameRef1" refer="aec:libraryName">
+ <xs:selector xpath="aec:effects/aec:effect"/>
+ <xs:field xpath="@library"/>
+ </xs:keyref>
+ <xs:keyref name="libraryNameRef2" refer="aec:libraryName">
+ <xs:selector xpath="aec:effects/aec:effect/aec:libsw"/>
+ <xs:field xpath="@library"/>
+ </xs:keyref>
+ <xs:keyref name="libraryNameRef3" refer="aec:libraryName">
+ <xs:selector xpath="aec:effects/aec:effect/aec:libhw"/>
+ <xs:field xpath="@library"/>
+ </xs:keyref>
+ <xs:key name="effectName">
+ <xs:selector xpath="aec:effects/aec:effect"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+ <xs:keyref name="effectNamePreRef" refer="aec:effectName">
+ <xs:selector xpath="aec:preprocess/aec:stream/aec:apply"/>
+ <xs:field xpath="@effect"/>
+ </xs:keyref>
+ <xs:keyref name="effectNamePostRef" refer="aec:effectName">
+ <xs:selector xpath="aec:postprocess/aec:stream/aec:apply"/>
+ <xs:field xpath="@effect"/>
+ </xs:keyref>
+ </xs:element>
+</xs:schema>
diff --git a/automotive/evs/1.0/IEvsEnumerator.hal b/automotive/evs/1.0/IEvsEnumerator.hal
index 98d117a..e1193d0 100644
--- a/automotive/evs/1.0/IEvsEnumerator.hal
+++ b/automotive/evs/1.0/IEvsEnumerator.hal
@@ -34,11 +34,12 @@
/**
* Get the IEvsCamera associated with a cameraId from a CameraDesc
*
- * Given a camera's unique cameraId from ca CameraDesc, returns
- * the ICamera interface associated with the specified camera.
- * When done using the camera, the caller may release it by calling closeCamera().
- * TODO(b/36122635) Reliance on the sp<> going out of scope is not recommended because the
- * resources may not be released right away due to asynchronos behavior in the hardware binder.
+ * Given a camera's unique cameraId from CameraDesc, returns the
+ * IEvsCamera interface associated with the specified camera. When
+ * done using the camera, the caller may release it by calling closeCamera().
+ * Note: Reliance on the sp<> going out of scope is not recommended
+ * because the resources may not be released right away due to asynchronos
+ * behavior in the hardware binder (ref b/36122635).
*/
openCamera(string cameraId) generates (IEvsCamera carCamera);
diff --git a/bluetooth/1.0/default/Android.bp b/bluetooth/1.0/default/Android.bp
index 46a4987..31a2641 100644
--- a/bluetooth/1.0/default/Android.bp
+++ b/bluetooth/1.0/default/Android.bp
@@ -24,7 +24,6 @@
"vendor_interface.cc",
],
shared_libs: [
- "android.frameworks.schedulerservice@1.0",
"android.hardware.bluetooth@1.0",
"libbase",
"libcutils",
@@ -49,7 +48,6 @@
],
export_include_dirs: ["."],
shared_libs: [
- "android.frameworks.schedulerservice@1.0",
"liblog",
],
}
@@ -86,7 +84,6 @@
"test",
],
shared_libs: [
- "android.frameworks.schedulerservice@1.0",
"libbase",
"libhidlbase",
"liblog",
diff --git a/bluetooth/1.0/default/Android.mk b/bluetooth/1.0/default/Android.mk
index 2dcb067..38294c7 100644
--- a/bluetooth/1.0/default/Android.mk
+++ b/bluetooth/1.0/default/Android.mk
@@ -35,6 +35,5 @@
libhidlbase \
libhidltransport \
android.hardware.bluetooth@1.0 \
- android.frameworks.schedulerservice@1.0\
include $(BUILD_EXECUTABLE)
diff --git a/bluetooth/1.0/default/async_fd_watcher.cc b/bluetooth/1.0/default/async_fd_watcher.cc
index ab8d555..bc0bc92 100644
--- a/bluetooth/1.0/default/async_fd_watcher.cc
+++ b/bluetooth/1.0/default/async_fd_watcher.cc
@@ -30,8 +30,6 @@
#include "sys/select.h"
#include "unistd.h"
-#include <android/frameworks/schedulerservice/1.0/ISchedulingPolicyService.h>
-
static const int INVALID_FD = -1;
static const int BT_RT_PRIORITY = 1;
@@ -119,19 +117,12 @@
}
void AsyncFdWatcher::ThreadRoutine() {
- using ::android::frameworks::schedulerservice::V1_0::ISchedulingPolicyService;
- using ::android::hardware::Return;
- sp<ISchedulingPolicyService> manager = ISchedulingPolicyService::getService();
- if (manager == nullptr) {
- ALOGE("%s: Couldn't get scheduler manager to set SCHED_FIFO.", __func__);
- } else {
- Return<bool> ret = manager->requestPriority(getpid(),
- gettid(),
- BT_RT_PRIORITY);
- if (!ret.isOk() || !ret) {
- ALOGE("%s unable to set SCHED_FIFO for pid %d, tid %d", __func__,
- getpid(), gettid());
- }
+ // Make watching thread RT.
+ struct sched_param rt_params;
+ rt_params.sched_priority = BT_RT_PRIORITY;
+ if (sched_setscheduler(gettid(), SCHED_FIFO, &rt_params)) {
+ ALOGE("%s unable to set SCHED_FIFO for pid %d, tid %d, error %s", __func__,
+ getpid(), gettid(), strerror(errno));
}
while (running_) {
diff --git a/bluetooth/1.0/default/service.cpp b/bluetooth/1.0/default/service.cpp
index a588c37..3a7aad0 100644
--- a/bluetooth/1.0/default/service.cpp
+++ b/bluetooth/1.0/default/service.cpp
@@ -20,8 +20,8 @@
#include <hidl/LegacySupport.h>
-// Add an extra thread for calls to the scheduler service.
-static const size_t kMaxThreads = 2;
+// Extra threads make priority inheritance faster.
+static const size_t kMaxThreads = 5;
// Generated HIDL files
using android::hardware::bluetooth::V1_0::IBluetoothHci;
diff --git a/camera/device/3.2/default/CameraDeviceSession.cpp b/camera/device/3.2/default/CameraDeviceSession.cpp
index 61be82d..06a6bd0 100644
--- a/camera/device/3.2/default/CameraDeviceSession.cpp
+++ b/camera/device/3.2/default/CameraDeviceSession.cpp
@@ -403,12 +403,14 @@
if (result.inputBuffer.releaseFence.getNativeHandle() != nullptr) {
native_handle_t* handle = const_cast<native_handle_t*>(
result.inputBuffer.releaseFence.getNativeHandle());
+ native_handle_close(handle);
native_handle_delete(handle);
}
for (auto& buf : result.outputBuffers) {
if (buf.releaseFence.getNativeHandle() != nullptr) {
native_handle_t* handle = const_cast<native_handle_t*>(
buf.releaseFence.getNativeHandle());
+ native_handle_close(handle);
native_handle_delete(handle);
}
}
@@ -586,8 +588,7 @@
void CameraDeviceSession::ResultBatcher::invokeProcessCaptureResultCallback(
hidl_vec<CaptureResult> &results, bool tryWriteFmq) {
if (mProcessCaptureResultLock.tryLock() != OK) {
- ALOGW("%s: previous call is not finished! waiting 1s...",
- __FUNCTION__);
+ ALOGV("%s: previous call is not finished! waiting 1s...", __FUNCTION__);
if (mProcessCaptureResultLock.timedLock(1000000000 /* 1s */) != OK) {
ALOGE("%s: cannot acquire lock in 1s, cannot proceed",
__FUNCTION__);
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index 7a29d42..02c38a4 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -90,7 +90,7 @@
using ::android::hardware::camera::device::V1_0::FrameCallbackFlag;
using ::android::hardware::camera::device::V1_0::HandleTimestampMessage;
-const char kCameraPassthroughServiceName[] = "legacy/0";
+const char kCameraLegacyServiceName[] = "legacy/0";
const uint32_t kMaxPreviewWidth = 1920;
const uint32_t kMaxPreviewHeight = 1080;
const uint32_t kMaxVideoWidth = 4096;
@@ -185,9 +185,7 @@
};
void CameraHidlEnvironment::SetUp() {
- // TODO: test the binderized mode
- mProvider = ::testing::VtsHalHidlTargetTestBase::getService<ICameraProvider>(kCameraPassthroughServiceName);
- // TODO: handle the device doesn't have any camera case
+ mProvider = ::testing::VtsHalHidlTargetTestBase::getService<ICameraProvider>(kCameraLegacyServiceName);
ALOGI_IF(mProvider, "provider is not nullptr, %p", mProvider.get());
ASSERT_NE(mProvider, nullptr);
}
diff --git a/compatibility_matrix.xml b/compatibility_matrix.xml
index 0f42a02..9603bd6 100644
--- a/compatibility_matrix.xml
+++ b/compatibility_matrix.xml
@@ -18,10 +18,18 @@
<hal format="hidl" optional="true">
<name>android.hardware.automotive.evs</name>
<version>1.0</version>
+ <interface>
+ <name>IEvsEnumerator</name>
+ <instance>default</instance>
+ </interface>
</hal>
<hal format="hidl" optional="true">
<name>android.hardware.automotive.vehicle</name>
- <version>2.1</version>
+ <version>2.0</version>
+ <interface>
+ <name>IVehicle</name>
+ <instance>default</instance>
+ </interface>
</hal>
<hal format="hidl" optional="true">
<name>android.hardware.biometrics.fingerprint</name>
@@ -48,6 +56,14 @@
</interface>
</hal>
<hal format="hidl" optional="true">
+ <name>android.hardware.broadcastradio</name>
+ <version>1.0</version>
+ <interface>
+ <name>IBroadcastRadioFactory</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
+ <hal format="hidl" optional="true">
<name>android.hardware.camera.provider</name>
<version>2.4</version>
<interface>
@@ -132,6 +148,14 @@
</interface>
</hal>
<hal format="hidl" optional="true">
+ <name>android.hardware.health</name>
+ <version>1.0</version>
+ <interface>
+ <name>IHealth</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
+ <hal format="hidl" optional="true">
<name>android.hardware.ir</name>
<version>1.0</version>
</hal>
@@ -158,6 +182,10 @@
<name>IOmx</name>
<instance>default</instance>
</interface>
+ <interface>
+ <name>IOmxStore</name>
+ <instance>default</instance>
+ </interface>
</hal>
<hal format="hidl" optional="true">
<name>android.hardware.memtrack</name>
@@ -240,6 +268,22 @@
</interface>
</hal>
<hal format="hidl" optional="true">
+ <name>android.hardware.tv.cec</name>
+ <version>1.0</version>
+ <interface>
+ <name>IHdmiCec</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
+ <hal format="hidl" optional="true">
+ <name>android.hardware.tv.input</name>
+ <version>1.0</version>
+ <interface>
+ <name>ITvInput</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
+ <hal format="hidl" optional="true">
<name>android.hardware.usb</name>
<version>1.0</version>
<interface>
@@ -275,4 +319,15 @@
<instance>default</instance>
</interface>
</hal>
+ <hal format="hidl" optional="true">
+ <name>android.hardware.wifi.supplicant</name>
+ <version>1.0</version>
+ <interface>
+ <name>ISupplicant</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
+ <kernel version="4.9.0" />
+ <kernel version="4.4.0" />
+ <kernel version="3.18.0" />
</compatibility-matrix>
diff --git a/configstore/utils/include/configstore/Utils.h b/configstore/utils/include/configstore/Utils.h
index c9c830b..b107a20 100644
--- a/configstore/utils/include/configstore/Utils.h
+++ b/configstore/utils/include/configstore/Utils.h
@@ -42,6 +42,15 @@
using ::android::hardware::configstore::V1_0::OptionalUInt64;
using ::android::hardware::configstore::V1_0::OptionalString;
+// a function to retrieve and cache the service handle
+// for a particular interface
+template <typename I>
+sp<I> getService() {
+ // static initializer used for synchronizations
+ static sp<I> configs = I::getService();
+ return configs;
+}
+
// arguments V: type for the value (i.e., OptionalXXX)
// I: interface class name
// func: member function pointer
@@ -49,9 +58,10 @@
(std::function<void(const V&)>)>
decltype(V::value) get(const decltype(V::value) &defValue) {
using namespace android::hardware::details;
+ // static initializer used for synchronizations
auto getHelper = []()->V {
V ret;
- sp<I> configs = I::getService();
+ sp<I> configs = getService<I>();
if (!configs.get()) {
// fallback to the default value
diff --git a/current.txt b/current.txt
index e254ed9..5c9d372 100644
--- a/current.txt
+++ b/current.txt
@@ -30,7 +30,7 @@
f2904a4c108ad1b93eb2fa4e43b82bd01ce1ff26156316e49d1d9fc80dfecaad android.hardware.automotive.evs@1.0::IEvsCamera
94cba6ad04c83aa840de2ed52b74ba2126a26dd960225e61ac36703315279a80 android.hardware.automotive.evs@1.0::IEvsCameraStream
5ea36fb043d9e3b413219de3dfd7b046b48af4fda39f167f3528652e986cb76d android.hardware.automotive.evs@1.0::IEvsDisplay
-4360e4396dee5a36d8543e12b1bbdeb765724dddf0dca0204ea1e9496ed8441d android.hardware.automotive.evs@1.0::IEvsEnumerator
+14ef8e993a4a7c899b19bb5e39b5b0cafd28312ea2b127e35b3be8f08e23fe8e android.hardware.automotive.evs@1.0::IEvsEnumerator
3b17c1fdfc389e0abe626c37054954b07201127d890c2bc05d47613ec1f4de4f android.hardware.automotive.evs@1.0::types
cde0787e4bf4b450a9ceb9011d2698c0061322eb882621e89b70594b0b7c65c5 android.hardware.automotive.vehicle@2.0::IVehicle
80fb4156fa91ce86e49bd2cabe215078f6b69591d416a09e914532eae6712052 android.hardware.automotive.vehicle@2.0::IVehicleCallback
diff --git a/dumpstate/1.0/default/DumpstateDevice.cpp b/dumpstate/1.0/default/DumpstateDevice.cpp
index 213fc62..818a531 100644
--- a/dumpstate/1.0/default/DumpstateDevice.cpp
+++ b/dumpstate/1.0/default/DumpstateDevice.cpp
@@ -37,7 +37,7 @@
// this interface - since HIDL_FETCH_IDumpstateDevice() is not defined, this function will never
// be called by dumpstate.
- if (handle->numFds < 1) {
+ if (handle == nullptr || handle->numFds < 1) {
ALOGE("no FDs\n");
return Void();
}
diff --git a/graphics/allocator/2.0/default/service.cpp b/graphics/allocator/2.0/default/service.cpp
index a43740c..99f462c 100644
--- a/graphics/allocator/2.0/default/service.cpp
+++ b/graphics/allocator/2.0/default/service.cpp
@@ -24,5 +24,5 @@
using android::hardware::defaultPassthroughServiceImplementation;
int main() {
- return defaultPassthroughServiceImplementation<IAllocator>();
+ return defaultPassthroughServiceImplementation<IAllocator>(4);
}
diff --git a/media/Android.bp b/media/Android.bp
index f25a609..53e82bd 100644
--- a/media/Android.bp
+++ b/media/Android.bp
@@ -3,6 +3,7 @@
"1.0",
"omx/1.0",
"omx/1.0/vts/functional/audio",
+ "omx/1.0/vts/functional/common",
"omx/1.0/vts/functional/component",
"omx/1.0/vts/functional/master",
"omx/1.0/vts/functional/video",
diff --git a/media/omx/1.0/vts/functional/audio/Android.bp b/media/omx/1.0/vts/functional/audio/Android.bp
index d6c73ce..66fd20b 100644
--- a/media/omx/1.0/vts/functional/audio/Android.bp
+++ b/media/omx/1.0/vts/functional/audio/Android.bp
@@ -34,7 +34,8 @@
"android.hidl.memory@1.0",
"android.hardware.media.omx@1.0",
],
- static_libs: ["VtsHalHidlTargetTestBase"],
+ static_libs: ["VtsHalHidlTargetTestBase",
+ "VtsHalMediaOmxV1_0CommonUtil"],
cflags: [
"-O0",
"-g",
@@ -65,7 +66,8 @@
"android.hidl.memory@1.0",
"android.hardware.media.omx@1.0",
],
- static_libs: ["VtsHalHidlTargetTestBase"],
+ static_libs: ["VtsHalHidlTargetTestBase",
+ "VtsHalMediaOmxV1_0CommonUtil"],
cflags: [
"-O0",
"-g",
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
index 1cc1817..5ba195e 100644
--- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
+++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
@@ -30,6 +30,7 @@
using ::android::hardware::media::omx::V1_0::IOmxNode;
using ::android::hardware::media::omx::V1_0::Message;
using ::android::hardware::media::omx::V1_0::CodecBuffer;
+using ::android::hardware::media::omx::V1_0::PortMode;
using ::android::hidl::allocator::V1_0::IAllocator;
using ::android::hidl::memory::V1_0::IMemory;
using ::android::hidl::memory::V1_0::IMapper;
@@ -136,7 +137,9 @@
gEnv->getInstance());
ASSERT_NE(omx, nullptr);
observer =
- new CodecObserver([this](Message msg) { handleMessage(msg); });
+ new CodecObserver([this](Message msg, const BufferInfo* buffer) {
+ handleMessage(msg, buffer);
+ });
ASSERT_NE(observer, nullptr);
if (strncmp(gEnv->getComponent().c_str(), "OMX.", 4) != 0)
disableTest = true;
@@ -218,7 +221,8 @@
// callback function to process messages received by onMessages() from IL
// client.
- void handleMessage(Message msg) {
+ void handleMessage(Message msg, const BufferInfo* buffer) {
+ (void)buffer;
if (msg.type == Message::Type::FILL_BUFFER_DONE) {
if (msg.data.extendedBufferData.flags & OMX_BUFFERFLAG_EOS) {
eosFlag = true;
@@ -254,13 +258,26 @@
}
}
}
+#define WRITE_OUTPUT 0
+#if WRITE_OUTPUT
+ static int count = 0;
+ FILE* ofp = nullptr;
+ if (count)
+ ofp = fopen("out.bin", "ab");
+ else
+ ofp = fopen("out.bin", "wb");
+ if (ofp != nullptr) {
+ fwrite(static_cast<void*>(buffer->mMemory->getPointer()),
+ sizeof(char),
+ msg.data.extendedBufferData.rangeLength, ofp);
+ fclose(ofp);
+ count++;
+ }
+#endif
}
}
}
- void testEOS(android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer, bool signalEOS = false);
-
enum standardComp {
mp3,
amrnb,
@@ -294,44 +311,6 @@
}
};
-// end of stream test for audio decoder components
-void AudioDecHidlTest::testEOS(android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer,
- bool signalEOS) {
- android::hardware::media::omx::V1_0::Status status;
- size_t i = 0;
- if (signalEOS) {
- if ((i = getEmptyBufferID(iBuffer)) < iBuffer->size()) {
- // signal an empty buffer with flag set to EOS
- dispatchInputBuffer(omxNode, iBuffer, i, 0, OMX_BUFFERFLAG_EOS, 0);
- } else {
- ASSERT_TRUE(false);
- }
- }
- // Dispatch all client owned output buffers to recover remaining frames
- while (1) {
- if ((i = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
- dispatchOutputBuffer(omxNode, oBuffer, i);
- } else {
- break;
- }
- }
- while (1) {
- Message msg;
- status =
- observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- EXPECT_EQ(status,
- android::hardware::media::omx::V1_0::Status::TIMED_OUT);
- for (; i < iBuffer->size(); i++) {
- if ((*iBuffer)[i].owner != client) break;
- }
- if (i == iBuffer->size()) break;
- }
- // test for flag
- EXPECT_EQ(eosFlag, true);
- eosFlag = false;
-}
-
// Set Default port param.
void setDefaultPortParam(
sp<IOmxNode> omxNode, OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE eEncoding,
@@ -580,8 +559,9 @@
OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput) {
android::hardware::media::omx::V1_0::Status status;
Message msg;
+ int timeOut = TIMEOUT_COUNTER;
- while (1) {
+ while (timeOut--) {
size_t i = 0;
status =
observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
@@ -603,6 +583,7 @@
if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
dispatchOutputBuffer(omxNode, oBuffer, index);
}
+ timeOut--;
}
}
@@ -642,6 +623,8 @@
frameID++;
}
+ int timeOut = TIMEOUT_COUNTER;
+ bool stall = false;
while (1) {
status =
observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
@@ -672,9 +655,21 @@
(*Info)[frameID].bytesCount, flags,
(*Info)[frameID].timestamp);
frameID++;
- }
+ stall = false;
+ } else
+ stall = true;
if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
dispatchOutputBuffer(omxNode, oBuffer, index);
+ stall = false;
+ } else
+ stall = true;
+ if (stall)
+ timeOut--;
+ else
+ timeOut = TIMEOUT_COUNTER;
+ if (timeOut == 0) {
+ EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite";
+ break;
}
}
}
@@ -778,7 +773,7 @@
eleStream.close();
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
kPortIndexInput, kPortIndexOutput);
- testEOS(&iBuffer, &oBuffer);
+ testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag);
EXPECT_EQ(timestampUslist.empty(), true);
// set state to idle
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
@@ -825,7 +820,7 @@
changeStateIdletoExecute(omxNode, observer);
// request EOS at the start
- testEOS(&iBuffer, &oBuffer, true);
+ testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag);
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
kPortIndexOutput);
EXPECT_GE(framesReceived, 0U);
@@ -908,7 +903,7 @@
eleStream.close();
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
kPortIndexInput, kPortIndexOutput);
- testEOS(&iBuffer, &oBuffer);
+ testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag);
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
kPortIndexOutput);
EXPECT_GE(framesReceived, 1U);
@@ -924,7 +919,7 @@
eleStream.close();
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
kPortIndexInput, kPortIndexOutput);
- testEOS(&iBuffer, &oBuffer, true);
+ testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag);
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
kPortIndexOutput);
EXPECT_GE(framesReceived, 1U);
@@ -1004,7 +999,7 @@
eleStream.close();
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
kPortIndexInput, kPortIndexOutput);
- testEOS(&iBuffer, &oBuffer);
+ testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag);
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
kPortIndexOutput);
framesReceived = 0;
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp
index 7d5f968..ecd9ef9 100644
--- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp
+++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp
@@ -30,6 +30,7 @@
using ::android::hardware::media::omx::V1_0::IOmxNode;
using ::android::hardware::media::omx::V1_0::Message;
using ::android::hardware::media::omx::V1_0::CodecBuffer;
+using ::android::hardware::media::omx::V1_0::PortMode;
using ::android::hidl::allocator::V1_0::IAllocator;
using ::android::hidl::memory::V1_0::IMemory;
using ::android::hidl::memory::V1_0::IMapper;
@@ -135,7 +136,10 @@
omx = ::testing::VtsHalHidlTargetTestBase::getService<IOmx>(
gEnv->getInstance());
ASSERT_NE(omx, nullptr);
- observer = new CodecObserver([](Message msg) { (void)msg; });
+ observer =
+ new CodecObserver([this](Message msg, const BufferInfo* buffer) {
+ handleMessage(msg, buffer);
+ });
ASSERT_NE(observer, nullptr);
if (strncmp(gEnv->getComponent().c_str(), "OMX.", 4) != 0)
disableTest = true;
@@ -191,6 +195,7 @@
}
}
if (i == kNumCompToCoding) disableTest = true;
+ eosFlag = false;
if (disableTest) std::cerr << "[ ] Warning ! Test Disabled\n";
}
@@ -201,6 +206,36 @@
}
}
+ // callback function to process messages received by onMessages() from IL
+ // client.
+ void handleMessage(Message msg, const BufferInfo* buffer) {
+ (void)buffer;
+
+ if (msg.type == Message::Type::FILL_BUFFER_DONE) {
+ if (msg.data.extendedBufferData.flags & OMX_BUFFERFLAG_EOS) {
+ eosFlag = true;
+ }
+ if (msg.data.extendedBufferData.rangeLength != 0) {
+#define WRITE_OUTPUT 0
+#if WRITE_OUTPUT
+ static int count = 0;
+ FILE* ofp = nullptr;
+ if (count)
+ ofp = fopen("out.bin", "ab");
+ else
+ ofp = fopen("out.bin", "wb");
+ if (ofp != nullptr) {
+ fwrite(static_cast<void*>(buffer->mMemory->getPointer()),
+ sizeof(char),
+ msg.data.extendedBufferData.rangeLength, ofp);
+ fclose(ofp);
+ count++;
+ }
+#endif
+ }
+ }
+ }
+
enum standardComp {
amrnb,
amrwb,
@@ -215,6 +250,7 @@
standardComp compName;
OMX_AUDIO_CODINGTYPE eEncoding;
bool disableTest;
+ bool eosFlag;
protected:
static void description(const std::string& description) {
@@ -289,12 +325,44 @@
}
}
+// blocking call to ensures application to Wait till all the inputs are consumed
+void waitOnInputConsumption(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
+ android::Vector<BufferInfo>* iBuffer,
+ android::Vector<BufferInfo>* oBuffer) {
+ android::hardware::media::omx::V1_0::Status status;
+ Message msg;
+ int timeOut = TIMEOUT_COUNTER;
+
+ while (timeOut--) {
+ size_t i = 0;
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
+ EXPECT_EQ(status,
+ android::hardware::media::omx::V1_0::Status::TIMED_OUT);
+ // status == TIMED_OUT, it could be due to process time being large
+ // than DEFAULT_TIMEOUT or component needs output buffers to start
+ // processing.
+ for (; i < iBuffer->size(); i++) {
+ if ((*iBuffer)[i].owner != client) break;
+ }
+ if (i == iBuffer->size()) break;
+
+ // Dispatch an output buffer assuming outQueue.empty() is true
+ size_t index;
+ if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
+ dispatchOutputBuffer(omxNode, oBuffer, index);
+ }
+ timeOut--;
+ }
+}
+
// Encode N Frames
void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
android::Vector<BufferInfo>* iBuffer,
android::Vector<BufferInfo>* oBuffer, uint32_t nFrames,
int32_t samplesPerFrame, int32_t nChannels,
- int32_t nSampleRate, std::ifstream& eleStream) {
+ int32_t nSampleRate, std::ifstream& eleStream,
+ bool signalEOS = true) {
android::hardware::media::omx::V1_0::Status status;
Message msg;
@@ -307,6 +375,7 @@
int32_t timestampIncr =
(int)(((float)samplesPerFrame / nSampleRate) * 1000000);
uint64_t timestamp = 0;
+ uint32_t flags = 0;
for (size_t i = 0; i < iBuffer->size() && nFrames != 0; i++) {
char* ipBuffer = static_cast<char*>(
static_cast<void*>((*iBuffer)[i].mMemory->getPointer()));
@@ -314,11 +383,14 @@
static_cast<int>((*iBuffer)[i].mMemory->getSize()));
eleStream.read(ipBuffer, bytesCount);
if (eleStream.gcount() != bytesCount) break;
- dispatchInputBuffer(omxNode, iBuffer, i, bytesCount, 0, timestamp);
+ if (signalEOS && (nFrames == 1)) flags = OMX_BUFFERFLAG_EOS;
+ dispatchInputBuffer(omxNode, iBuffer, i, bytesCount, flags, timestamp);
timestamp += timestampIncr;
nFrames--;
}
+ int timeOut = TIMEOUT_COUNTER;
+ bool stall = false;
while (1) {
status =
observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
@@ -337,14 +409,27 @@
static_cast<int>((*iBuffer)[index].mMemory->getSize()));
eleStream.read(ipBuffer, bytesCount);
if (eleStream.gcount() != bytesCount) break;
- dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, 0,
+ if (signalEOS && (nFrames == 1)) flags = OMX_BUFFERFLAG_EOS;
+ dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, flags,
timestamp);
timestamp += timestampIncr;
nFrames--;
- }
+ stall = false;
+ } else
+ stall = true;
// Dispatch output buffer
if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
dispatchOutputBuffer(omxNode, oBuffer, index);
+ stall = false;
+ } else
+ stall = true;
+ if (stall)
+ timeOut--;
+ else
+ timeOut = TIMEOUT_COUNTER;
+ if (timeOut == 0) {
+ EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite";
+ break;
}
}
}
@@ -380,8 +465,8 @@
}
// test raw stream encode
-TEST_F(AudioEncHidlTest, EncodeTest) {
- description("Tests Encode");
+TEST_F(AudioEncHidlTest, SimpleEncodeTest) {
+ description("Tests Basic encoding and EOS");
if (disableTest) return;
android::hardware::media::omx::V1_0::Status status;
uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
@@ -399,8 +484,6 @@
GetURLForComponent(compName, mURL);
std::ifstream eleStream;
- eleStream.open(mURL, std::ifstream::binary);
- ASSERT_EQ(eleStream.is_open(), true);
// Configure input port
int32_t nChannels = 2;
@@ -449,16 +532,19 @@
// set state to executing
changeStateIdletoExecute(omxNode, observer);
- encodeNFrames(omxNode, observer, &iBuffer, &oBuffer, 1024, samplesPerFrame,
+ eleStream.open(mURL, std::ifstream::binary);
+ ASSERT_EQ(eleStream.is_open(), true);
+ encodeNFrames(omxNode, observer, &iBuffer, &oBuffer, 128, samplesPerFrame,
nChannels, nSampleRate, eleStream);
+ eleStream.close();
+ waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer);
+ testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag);
// set state to idle
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
// set state to executing
changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
kPortIndexInput, kPortIndexOutput);
-
- eleStream.close();
}
int main(int argc, char** argv) {
diff --git a/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.cpp b/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.cpp
index f09d21d..abd044d 100644
--- a/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.cpp
+++ b/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.cpp
@@ -30,6 +30,7 @@
using ::android::hardware::media::omx::V1_0::IOmxNode;
using ::android::hardware::media::omx::V1_0::Message;
using ::android::hardware::media::omx::V1_0::CodecBuffer;
+using ::android::hardware::media::omx::V1_0::PortMode;
using ::android::hidl::allocator::V1_0::IAllocator;
using ::android::hidl::memory::V1_0::IMemory;
using ::android::hidl::memory::V1_0::IMapper;
@@ -45,277 +46,6 @@
#include <media_hidl_test_common.h>
#include <memory>
-// allocate buffers needed on a component port
-void allocatePortBuffers(sp<IOmxNode> omxNode,
- android::Vector<BufferInfo>* buffArray,
- OMX_U32 portIndex) {
- android::hardware::media::omx::V1_0::Status status;
- OMX_PARAM_PORTDEFINITIONTYPE portDef;
-
- buffArray->clear();
-
- sp<IAllocator> allocator = IAllocator::getService("ashmem");
- EXPECT_NE(allocator.get(), nullptr);
-
- status = getPortParam(omxNode, OMX_IndexParamPortDefinition, portIndex,
- &portDef);
- ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
-
- for (size_t i = 0; i < portDef.nBufferCountActual; i++) {
- BufferInfo buffer;
- buffer.owner = client;
- buffer.omxBuffer.type = CodecBuffer::Type::SHARED_MEM;
- buffer.omxBuffer.attr.preset.rangeOffset = 0;
- buffer.omxBuffer.attr.preset.rangeLength = 0;
- bool success = false;
- allocator->allocate(
- portDef.nBufferSize,
- [&success, &buffer](bool _s,
- ::android::hardware::hidl_memory const& mem) {
- success = _s;
- buffer.omxBuffer.sharedMemory = mem;
- });
- ASSERT_EQ(success, true);
- ASSERT_EQ(buffer.omxBuffer.sharedMemory.size(), portDef.nBufferSize);
- buffer.mMemory = mapMemory(buffer.omxBuffer.sharedMemory);
- ASSERT_NE(buffer.mMemory, nullptr);
- omxNode->useBuffer(
- portIndex, buffer.omxBuffer,
- [&status, &buffer](android::hardware::media::omx::V1_0::Status _s,
- uint32_t id) {
- status = _s;
- buffer.id = id;
- });
- buffArray->push(buffer);
- ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
- }
-}
-
-// State Transition : Loaded -> Idle
-// Note: This function does not make any background checks for this transition.
-// The callee holds the reponsibility to ensure the legality of the transition.
-void changeStateLoadedtoIdle(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
- android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer,
- OMX_U32 kPortIndexInput,
- OMX_U32 kPortIndexOutput) {
- android::hardware::media::omx::V1_0::Status status;
- Message msg;
-
- // set state to idle
- status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
- OMX_StateIdle);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
-
- // Dont switch states until the ports are populated
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
-
- // allocate buffers on input port
- allocatePortBuffers(omxNode, iBuffer, kPortIndexInput);
-
- // Dont switch states until the ports are populated
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
-
- // allocate buffers on output port
- allocatePortBuffers(omxNode, oBuffer, kPortIndexOutput);
-
- // As the ports are populated, check if the state transition is complete
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- ASSERT_EQ(msg.type, Message::Type::EVENT);
- ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
- ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
- ASSERT_EQ(msg.data.eventData.data2, OMX_StateIdle);
-
- return;
-}
-
-// State Transition : Idle -> Loaded
-// Note: This function does not make any background checks for this transition.
-// The callee holds the reponsibility to ensure the legality of the transition.
-void changeStateIdletoLoaded(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
- android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer,
- OMX_U32 kPortIndexInput,
- OMX_U32 kPortIndexOutput) {
- android::hardware::media::omx::V1_0::Status status;
- Message msg;
-
- // set state to Loaded
- status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
- OMX_StateLoaded);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
-
- // dont change state until all buffers are freed
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
-
- for (size_t i = 0; i < iBuffer->size(); ++i) {
- status = omxNode->freeBuffer(kPortIndexInput, (*iBuffer)[i].id);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- }
-
- // dont change state until all buffers are freed
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
-
- for (size_t i = 0; i < oBuffer->size(); ++i) {
- status = omxNode->freeBuffer(kPortIndexOutput, (*oBuffer)[i].id);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- }
-
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- ASSERT_EQ(msg.type, Message::Type::EVENT);
- ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
- ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
- ASSERT_EQ(msg.data.eventData.data2, OMX_StateLoaded);
-
- return;
-}
-
-// State Transition : Idle -> Execute
-// Note: This function does not make any background checks for this transition.
-// The callee holds the reponsibility to ensure the legality of the transition.
-void changeStateIdletoExecute(sp<IOmxNode> omxNode,
- sp<CodecObserver> observer) {
- android::hardware::media::omx::V1_0::Status status;
- Message msg;
-
- // set state to execute
- status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
- OMX_StateExecuting);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- ASSERT_EQ(msg.type, Message::Type::EVENT);
- ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
- ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
- ASSERT_EQ(msg.data.eventData.data2, OMX_StateExecuting);
-
- return;
-}
-
-// State Transition : Execute -> Idle
-// Note: This function does not make any background checks for this transition.
-// The callee holds the reponsibility to ensure the legality of the transition.
-void changeStateExecutetoIdle(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
- android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer) {
- android::hardware::media::omx::V1_0::Status status;
- Message msg;
-
- // set state to Idle
- status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
- OMX_StateIdle);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- ASSERT_EQ(msg.type, Message::Type::EVENT);
- ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
- ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
- ASSERT_EQ(msg.data.eventData.data2, OMX_StateIdle);
-
- // test if client got all its buffers back
- for (size_t i = 0; i < oBuffer->size(); ++i) {
- EXPECT_EQ((*oBuffer)[i].owner, client);
- }
- for (size_t i = 0; i < iBuffer->size(); ++i) {
- EXPECT_EQ((*iBuffer)[i].owner, client);
- }
-}
-
-// get empty buffer index
-size_t getEmptyBufferID(android::Vector<BufferInfo>* buffArray) {
- for (size_t i = 0; i < buffArray->size(); i++) {
- if ((*buffArray)[i].owner == client) return i;
- }
- return buffArray->size();
-}
-
-// dispatch buffer to output port
-void dispatchOutputBuffer(sp<IOmxNode> omxNode,
- android::Vector<BufferInfo>* buffArray,
- size_t bufferIndex) {
- android::hardware::media::omx::V1_0::Status status;
- CodecBuffer t;
- t.sharedMemory = android::hardware::hidl_memory();
- t.nativeHandle = android::hardware::hidl_handle();
- t.type = CodecBuffer::Type::PRESET;
- t.attr.preset.rangeOffset = 0;
- t.attr.preset.rangeLength = 0;
- native_handle_t* fenceNh = native_handle_create(0, 0);
- ASSERT_NE(fenceNh, nullptr);
- status = omxNode->fillBuffer((*buffArray)[bufferIndex].id, t, fenceNh);
- native_handle_close(fenceNh);
- native_handle_delete(fenceNh);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- buffArray->editItemAt(bufferIndex).owner = component;
-}
-
-// dispatch buffer to input port
-void dispatchInputBuffer(sp<IOmxNode> omxNode,
- android::Vector<BufferInfo>* buffArray,
- size_t bufferIndex, int bytesCount, uint32_t flags,
- uint64_t timestamp) {
- android::hardware::media::omx::V1_0::Status status;
- CodecBuffer t;
- t.sharedMemory = android::hardware::hidl_memory();
- t.nativeHandle = android::hardware::hidl_handle();
- t.type = CodecBuffer::Type::PRESET;
- t.attr.preset.rangeOffset = 0;
- t.attr.preset.rangeLength = bytesCount;
- native_handle_t* fenceNh = native_handle_create(0, 0);
- ASSERT_NE(fenceNh, nullptr);
- status = omxNode->emptyBuffer((*buffArray)[bufferIndex].id, t, flags,
- timestamp, fenceNh);
- native_handle_close(fenceNh);
- native_handle_delete(fenceNh);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- buffArray->editItemAt(bufferIndex).owner = component;
-}
-
-// Flush input and output ports
-void flushPorts(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
- android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer, OMX_U32 kPortIndexInput,
- OMX_U32 kPortIndexOutput, int64_t timeoutUs) {
- android::hardware::media::omx::V1_0::Status status;
- Message msg;
-
- // Flush input port
- status = omxNode->sendCommand(toRawCommandType(OMX_CommandFlush),
- kPortIndexInput);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- status = observer->dequeueMessage(&msg, timeoutUs, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- ASSERT_EQ(msg.type, Message::Type::EVENT);
- ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
- ASSERT_EQ(msg.data.eventData.data1, OMX_CommandFlush);
- ASSERT_EQ(msg.data.eventData.data2, kPortIndexInput);
- // test if client got all its buffers back
- for (size_t i = 0; i < iBuffer->size(); ++i) {
- EXPECT_EQ((*iBuffer)[i].owner, client);
- }
-
- // Flush output port
- status = omxNode->sendCommand(toRawCommandType(OMX_CommandFlush),
- kPortIndexOutput);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- status = observer->dequeueMessage(&msg, timeoutUs, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- ASSERT_EQ(msg.type, Message::Type::EVENT);
- ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
- ASSERT_EQ(msg.data.eventData.data1, OMX_CommandFlush);
- ASSERT_EQ(msg.data.eventData.data2, kPortIndexOutput);
- // test if client got all its buffers back
- for (size_t i = 0; i < oBuffer->size(); ++i) {
- EXPECT_EQ((*oBuffer)[i].owner, client);
- }
-}
-
Return<android::hardware::media::omx::V1_0::Status> setAudioPortFormat(
sp<IOmxNode> omxNode, OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE eEncoding) {
OMX_U32 index = 0;
diff --git a/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.h b/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.h
index d420ab5..a762436 100644
--- a/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.h
+++ b/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2016, The Android Open Source Project
+ * 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.
@@ -18,6 +18,7 @@
#define MEDIA_AUDIO_HIDL_TEST_COMMON_H
#include <media_hidl_test_common.h>
+
/*
* Random Index used for monkey testing while get/set parameters
*/
@@ -26,42 +27,6 @@
/*
* Common audio utils
*/
-void allocatePortBuffers(sp<IOmxNode> omxNode,
- android::Vector<BufferInfo>* buffArray,
- OMX_U32 portIndex);
-
-void changeStateLoadedtoIdle(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
- android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer,
- OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput);
-
-void changeStateIdletoLoaded(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
- android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer,
- OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput);
-
-void changeStateIdletoExecute(sp<IOmxNode> omxNode, sp<CodecObserver> observer);
-
-void changeStateExecutetoIdle(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
- android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer);
-
-size_t getEmptyBufferID(android::Vector<BufferInfo>* buffArray);
-
-void dispatchOutputBuffer(sp<IOmxNode> omxNode,
- android::Vector<BufferInfo>* buffArray,
- size_t bufferIndex);
-
-void dispatchInputBuffer(sp<IOmxNode> omxNode,
- android::Vector<BufferInfo>* buffArray,
- size_t bufferIndex, int bytesCount, uint32_t flags,
- uint64_t timestamp);
-
-void flushPorts(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
- android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer, OMX_U32 kPortIndexInput,
- OMX_U32 kPortIndexOutput, int64_t timeoutUs = DEFAULT_TIMEOUT);
-
Return<android::hardware::media::omx::V1_0::Status> setAudioPortFormat(
sp<IOmxNode> omxNode, OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE eEncoding);
diff --git a/media/omx/1.0/vts/functional/common/Android.bp b/media/omx/1.0/vts/functional/common/Android.bp
new file mode 100755
index 0000000..93251fe
--- /dev/null
+++ b/media/omx/1.0/vts/functional/common/Android.bp
@@ -0,0 +1,33 @@
+//
+// 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.
+//
+
+cc_library_static {
+ name: "VtsHalMediaOmxV1_0CommonUtil",
+ defaults: ["hidl_defaults"],
+ srcs: ["media_hidl_test_common.cpp"],
+ shared_libs: [
+ "liblog",
+ "libhidlmemory",
+ "android.hidl.allocator@1.0",
+ "android.hidl.memory@1.0",
+ "android.hardware.media.omx@1.0",
+ ],
+ static_libs: ["VtsHalHidlTargetTestBase"],
+ cflags: [ "-O0", "-g", ],
+ include_dirs: [
+ "frameworks/native/include/media/openmax/",
+ ],
+}
diff --git a/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp b/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp
new file mode 100755
index 0000000..30344a1
--- /dev/null
+++ b/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp
@@ -0,0 +1,435 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "media_omx_hidl_video_test_common"
+
+#ifdef __LP64__
+#define OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS
+#endif
+
+#include <android-base/logging.h>
+
+#include <android/hardware/media/omx/1.0/IOmx.h>
+#include <android/hardware/media/omx/1.0/IOmxNode.h>
+#include <android/hardware/media/omx/1.0/IOmxObserver.h>
+#include <android/hardware/media/omx/1.0/types.h>
+#include <android/hidl/allocator/1.0/IAllocator.h>
+#include <android/hidl/memory/1.0/IMapper.h>
+#include <android/hidl/memory/1.0/IMemory.h>
+
+using ::android::hardware::media::omx::V1_0::IOmx;
+using ::android::hardware::media::omx::V1_0::IOmxObserver;
+using ::android::hardware::media::omx::V1_0::IOmxNode;
+using ::android::hardware::media::omx::V1_0::Message;
+using ::android::hardware::media::omx::V1_0::CodecBuffer;
+using ::android::hardware::media::omx::V1_0::PortMode;
+using ::android::hidl::allocator::V1_0::IAllocator;
+using ::android::hidl::memory::V1_0::IMemory;
+using ::android::hidl::memory::V1_0::IMapper;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <hidlmemory/mapping.h>
+#include <media/hardware/HardwareAPI.h>
+#include <media_hidl_test_common.h>
+#include <memory>
+
+// allocate buffers needed on a component port
+void allocatePortBuffers(sp<IOmxNode> omxNode,
+ android::Vector<BufferInfo>* buffArray,
+ OMX_U32 portIndex, PortMode portMode) {
+ android::hardware::media::omx::V1_0::Status status;
+ OMX_PARAM_PORTDEFINITIONTYPE portDef;
+
+ buffArray->clear();
+
+ status = getPortParam(omxNode, OMX_IndexParamPortDefinition, portIndex,
+ &portDef);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+
+ if (portMode == PortMode::PRESET_SECURE_BUFFER) {
+ for (size_t i = 0; i < portDef.nBufferCountActual; i++) {
+ BufferInfo buffer;
+ buffer.owner = client;
+ buffer.omxBuffer.type = CodecBuffer::Type::NATIVE_HANDLE;
+ omxNode->allocateSecureBuffer(
+ portIndex, portDef.nBufferSize,
+ [&status, &buffer](
+ android::hardware::media::omx::V1_0::Status _s, uint32_t id,
+ ::android::hardware::hidl_handle const& nativeHandle) {
+ status = _s;
+ buffer.id = id;
+ buffer.omxBuffer.nativeHandle = nativeHandle;
+ });
+ buffArray->push(buffer);
+ ASSERT_EQ(status,
+ ::android::hardware::media::omx::V1_0::Status::OK);
+ }
+ } else if (portMode == PortMode::PRESET_BYTE_BUFFER ||
+ portMode == PortMode::DYNAMIC_ANW_BUFFER) {
+ sp<IAllocator> allocator = IAllocator::getService("ashmem");
+ EXPECT_NE(allocator.get(), nullptr);
+
+ for (size_t i = 0; i < portDef.nBufferCountActual; i++) {
+ BufferInfo buffer;
+ buffer.owner = client;
+ buffer.omxBuffer.type = CodecBuffer::Type::SHARED_MEM;
+ buffer.omxBuffer.attr.preset.rangeOffset = 0;
+ buffer.omxBuffer.attr.preset.rangeLength = 0;
+ bool success = false;
+ if (portMode != PortMode::PRESET_BYTE_BUFFER) {
+ portDef.nBufferSize = sizeof(android::VideoNativeMetadata);
+ }
+ allocator->allocate(
+ portDef.nBufferSize,
+ [&success, &buffer](
+ bool _s, ::android::hardware::hidl_memory const& mem) {
+ success = _s;
+ buffer.omxBuffer.sharedMemory = mem;
+ });
+ ASSERT_EQ(success, true);
+ ASSERT_EQ(buffer.omxBuffer.sharedMemory.size(),
+ portDef.nBufferSize);
+ buffer.mMemory = mapMemory(buffer.omxBuffer.sharedMemory);
+ ASSERT_NE(buffer.mMemory, nullptr);
+ if (portMode == PortMode::DYNAMIC_ANW_BUFFER) {
+ android::VideoNativeMetadata* metaData =
+ static_cast<android::VideoNativeMetadata*>(
+ static_cast<void*>(buffer.mMemory->getPointer()));
+ metaData->nFenceFd = -1;
+ buffer.slot = -1;
+ }
+ omxNode->useBuffer(
+ portIndex, buffer.omxBuffer,
+ [&status, &buffer](
+ android::hardware::media::omx::V1_0::Status _s,
+ uint32_t id) {
+ status = _s;
+ buffer.id = id;
+ });
+ buffArray->push(buffer);
+ ASSERT_EQ(status,
+ ::android::hardware::media::omx::V1_0::Status::OK);
+ }
+ }
+}
+
+// State Transition : Loaded -> Idle
+// Note: This function does not make any background checks for this transition.
+// The callee holds the reponsibility to ensure the legality of the transition.
+void changeStateLoadedtoIdle(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
+ android::Vector<BufferInfo>* iBuffer,
+ android::Vector<BufferInfo>* oBuffer,
+ OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput,
+ PortMode* portMode) {
+ android::hardware::media::omx::V1_0::Status status;
+ Message msg;
+ PortMode defaultPortMode[2], *pm;
+
+ defaultPortMode[0] = PortMode::PRESET_BYTE_BUFFER;
+ defaultPortMode[1] = PortMode::PRESET_BYTE_BUFFER;
+ pm = portMode ? portMode : defaultPortMode;
+
+ // set state to idle
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateIdle);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+
+ // Dont switch states until the ports are populated
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
+
+ // allocate buffers on input port
+ allocatePortBuffers(omxNode, iBuffer, kPortIndexInput, pm[0]);
+
+ // Dont switch states until the ports are populated
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
+
+ // allocate buffers on output port
+ allocatePortBuffers(omxNode, oBuffer, kPortIndexOutput, pm[1]);
+
+ // As the ports are populated, check if the state transition is complete
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
+ ASSERT_EQ(msg.data.eventData.data2, OMX_StateIdle);
+
+ return;
+}
+
+// State Transition : Idle -> Loaded
+// Note: This function does not make any background checks for this transition.
+// The callee holds the reponsibility to ensure the legality of the transition.
+void changeStateIdletoLoaded(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
+ android::Vector<BufferInfo>* iBuffer,
+ android::Vector<BufferInfo>* oBuffer,
+ OMX_U32 kPortIndexInput,
+ OMX_U32 kPortIndexOutput) {
+ android::hardware::media::omx::V1_0::Status status;
+ Message msg;
+
+ // set state to Loaded
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateLoaded);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+
+ // dont change state until all buffers are freed
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
+
+ for (size_t i = 0; i < iBuffer->size(); ++i) {
+ status = omxNode->freeBuffer(kPortIndexInput, (*iBuffer)[i].id);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ }
+
+ // dont change state until all buffers are freed
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
+
+ for (size_t i = 0; i < oBuffer->size(); ++i) {
+ status = omxNode->freeBuffer(kPortIndexOutput, (*oBuffer)[i].id);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ }
+
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
+ ASSERT_EQ(msg.data.eventData.data2, OMX_StateLoaded);
+
+ return;
+}
+
+// State Transition : Idle -> Execute
+// Note: This function does not make any background checks for this transition.
+// The callee holds the reponsibility to ensure the legality of the transition.
+void changeStateIdletoExecute(sp<IOmxNode> omxNode,
+ sp<CodecObserver> observer) {
+ android::hardware::media::omx::V1_0::Status status;
+ Message msg;
+
+ // set state to execute
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateExecuting);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
+ ASSERT_EQ(msg.data.eventData.data2, OMX_StateExecuting);
+
+ return;
+}
+
+// State Transition : Execute -> Idle
+// Note: This function does not make any background checks for this transition.
+// The callee holds the reponsibility to ensure the legality of the transition.
+void changeStateExecutetoIdle(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
+ android::Vector<BufferInfo>* iBuffer,
+ android::Vector<BufferInfo>* oBuffer) {
+ android::hardware::media::omx::V1_0::Status status;
+ Message msg;
+
+ // set state to Idle
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateIdle);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
+ ASSERT_EQ(msg.data.eventData.data2, OMX_StateIdle);
+
+ // test if client got all its buffers back
+ for (size_t i = 0; i < oBuffer->size(); ++i) {
+ EXPECT_EQ((*oBuffer)[i].owner, client);
+ }
+ for (size_t i = 0; i < iBuffer->size(); ++i) {
+ EXPECT_EQ((*iBuffer)[i].owner, client);
+ }
+}
+
+// get empty buffer index
+size_t getEmptyBufferID(android::Vector<BufferInfo>* buffArray) {
+ android::Vector<BufferInfo>::iterator it = buffArray->begin();
+ while (it != buffArray->end()) {
+ if (it->owner == client) {
+ // This block of code ensures that all buffers allocated at init
+ // time are utilized
+ BufferInfo backup = *it;
+ buffArray->erase(it);
+ buffArray->push_back(backup);
+ return buffArray->size() - 1;
+ }
+ it++;
+ }
+ return buffArray->size();
+}
+
+// dispatch buffer to output port
+void dispatchOutputBuffer(sp<IOmxNode> omxNode,
+ android::Vector<BufferInfo>* buffArray,
+ size_t bufferIndex, PortMode portMode) {
+ if (portMode == PortMode::DYNAMIC_ANW_BUFFER) {
+ android::hardware::media::omx::V1_0::Status status;
+ CodecBuffer t = (*buffArray)[bufferIndex].omxBuffer;
+ t.type = CodecBuffer::Type::ANW_BUFFER;
+ native_handle_t* fenceNh = native_handle_create(0, 0);
+ ASSERT_NE(fenceNh, nullptr);
+ status = omxNode->fillBuffer((*buffArray)[bufferIndex].id, t, fenceNh);
+ native_handle_close(fenceNh);
+ native_handle_delete(fenceNh);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ buffArray->editItemAt(bufferIndex).owner = component;
+ } else {
+ android::hardware::media::omx::V1_0::Status status;
+ CodecBuffer t;
+ t.sharedMemory = android::hardware::hidl_memory();
+ t.nativeHandle = android::hardware::hidl_handle();
+ t.type = CodecBuffer::Type::PRESET;
+ t.attr.preset.rangeOffset = 0;
+ t.attr.preset.rangeLength = 0;
+ native_handle_t* fenceNh = native_handle_create(0, 0);
+ ASSERT_NE(fenceNh, nullptr);
+ status = omxNode->fillBuffer((*buffArray)[bufferIndex].id, t, fenceNh);
+ native_handle_close(fenceNh);
+ native_handle_delete(fenceNh);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ buffArray->editItemAt(bufferIndex).owner = component;
+ }
+}
+
+// dispatch buffer to input port
+void dispatchInputBuffer(sp<IOmxNode> omxNode,
+ android::Vector<BufferInfo>* buffArray,
+ size_t bufferIndex, int bytesCount, uint32_t flags,
+ uint64_t timestamp) {
+ android::hardware::media::omx::V1_0::Status status;
+ CodecBuffer t;
+ t.sharedMemory = android::hardware::hidl_memory();
+ t.nativeHandle = android::hardware::hidl_handle();
+ t.type = CodecBuffer::Type::PRESET;
+ t.attr.preset.rangeOffset = 0;
+ t.attr.preset.rangeLength = bytesCount;
+ native_handle_t* fenceNh = native_handle_create(0, 0);
+ ASSERT_NE(fenceNh, nullptr);
+ status = omxNode->emptyBuffer((*buffArray)[bufferIndex].id, t, flags,
+ timestamp, fenceNh);
+ native_handle_close(fenceNh);
+ native_handle_delete(fenceNh);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ buffArray->editItemAt(bufferIndex).owner = component;
+}
+
+// Flush input and output ports
+void flushPorts(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
+ android::Vector<BufferInfo>* iBuffer,
+ android::Vector<BufferInfo>* oBuffer, OMX_U32 kPortIndexInput,
+ OMX_U32 kPortIndexOutput, int64_t timeoutUs) {
+ android::hardware::media::omx::V1_0::Status status;
+ Message msg;
+
+ // Flush input port
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandFlush),
+ kPortIndexInput);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ status = observer->dequeueMessage(&msg, timeoutUs, iBuffer, oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandFlush);
+ ASSERT_EQ(msg.data.eventData.data2, kPortIndexInput);
+ // test if client got all its buffers back
+ for (size_t i = 0; i < iBuffer->size(); ++i) {
+ EXPECT_EQ((*iBuffer)[i].owner, client);
+ }
+
+ // Flush output port
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandFlush),
+ kPortIndexOutput);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ status = observer->dequeueMessage(&msg, timeoutUs, iBuffer, oBuffer);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(msg.type, Message::Type::EVENT);
+ ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
+ ASSERT_EQ(msg.data.eventData.data1, OMX_CommandFlush);
+ ASSERT_EQ(msg.data.eventData.data2, kPortIndexOutput);
+ // test if client got all its buffers back
+ for (size_t i = 0; i < oBuffer->size(); ++i) {
+ EXPECT_EQ((*oBuffer)[i].owner, client);
+ }
+}
+
+// dispatch an empty input buffer with eos flag set if requested.
+// This call assumes that all input buffers are processed completely.
+// feed output buffers till we receive a buffer with eos flag set
+void testEOS(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
+ android::Vector<BufferInfo>* iBuffer,
+ android::Vector<BufferInfo>* oBuffer, bool signalEOS,
+ bool& eosFlag, PortMode* portMode) {
+ android::hardware::media::omx::V1_0::Status status;
+ PortMode defaultPortMode[2], *pm;
+
+ defaultPortMode[0] = PortMode::PRESET_BYTE_BUFFER;
+ defaultPortMode[1] = PortMode::PRESET_BYTE_BUFFER;
+ pm = portMode ? portMode : defaultPortMode;
+
+ size_t i = 0;
+ if (signalEOS) {
+ if ((i = getEmptyBufferID(iBuffer)) < iBuffer->size()) {
+ // signal an empty buffer with flag set to EOS
+ dispatchInputBuffer(omxNode, iBuffer, i, 0, OMX_BUFFERFLAG_EOS, 0);
+ } else {
+ ASSERT_TRUE(false);
+ }
+ }
+
+ int timeOut = TIMEOUT_COUNTER;
+ while (timeOut--) {
+ // Dispatch all client owned output buffers to recover remaining frames
+ while (1) {
+ if ((i = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
+ dispatchOutputBuffer(omxNode, oBuffer, i, pm[1]);
+ // if dispatch is successful, perhaps there is a latency
+ // in the component. Dont be in a haste to leave. reset timeout
+ // counter
+ timeOut = TIMEOUT_COUNTER;
+ } else {
+ break;
+ }
+ }
+
+ Message msg;
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
+ EXPECT_EQ(status,
+ android::hardware::media::omx::V1_0::Status::TIMED_OUT);
+ if (eosFlag == true) break;
+ }
+ // test for flag
+ EXPECT_EQ(eosFlag, true);
+ eosFlag = false;
+}
diff --git a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
index 52d8ae2..a402532 100644
--- a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
+++ b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
@@ -33,9 +33,19 @@
#include <media/openmax/OMX_AudioExt.h>
#include <media/openmax/OMX_VideoExt.h>
+#define DEFAULT_TIMEOUT 40000
+#define TIMEOUT_COUNTER (10000000 / DEFAULT_TIMEOUT)
+
+enum bufferOwner {
+ client,
+ component,
+ unknown,
+};
+
/*
- * TODO: Borrowed from Conversion.h. This is not the ideal way to do it.
- * Loose these definitions once you include Conversion.h
+ * TODO: below definitions are borrowed from Conversion.h.
+ * This is not the ideal way to do it. Loose these definitions once you
+ * include Conversion.h
*/
inline uint32_t toRawIndexType(OMX_INDEXTYPE l) {
return static_cast<uint32_t>(l);
@@ -57,22 +67,14 @@
}
/*
- * Handle Callback functions EmptythisBuffer(), FillthisBuffer(),
- * EventHandler()
+ * struct definitions
*/
-#define DEFAULT_TIMEOUT 40000
-
-enum bufferOwner {
- client,
- component,
- unknown,
-};
-
struct BufferInfo {
uint32_t id;
bufferOwner owner;
android::hardware::media::omx::V1_0::CodecBuffer omxBuffer;
::android::sp<IMemory> mMemory;
+ int32_t slot;
};
struct FrameData {
@@ -81,9 +83,14 @@
uint32_t timestamp;
};
+/*
+ * Handle Callback functions EmptythisBuffer(), FillthisBuffer(),
+ * EventHandler()
+ */
struct CodecObserver : public IOmxObserver {
public:
- CodecObserver(std::function<void(Message)> fn) : callBack(fn) {}
+ CodecObserver(std::function<void(Message, const BufferInfo*)> fn)
+ : callBack(fn) {}
Return<void> onMessages(const hidl_vec<Message>& messages) override {
android::Mutex::Autolock autoLock(msgLock);
for (hidl_vec<Message>::const_iterator it = messages.begin();
@@ -114,7 +121,7 @@
for (i = 0; i < oBuffers->size(); ++i) {
if ((*oBuffers)[i].id ==
it->data.bufferData.buffer) {
- if (callBack) callBack(*it);
+ if (callBack) callBack(*it, &(*oBuffers)[i]);
oBuffers->editItemAt(i).owner = client;
msgQueue.erase(it);
break;
@@ -129,6 +136,7 @@
for (i = 0; i < iBuffers->size(); ++i) {
if ((*iBuffers)[i].id ==
it->data.bufferData.buffer) {
+ if (callBack) callBack(*it, &(*iBuffers)[i]);
iBuffers->editItemAt(i).owner = client;
msgQueue.erase(it);
break;
@@ -154,7 +162,7 @@
android::List<Message> msgQueue;
android::Mutex msgLock;
android::Condition msgCondition;
- std::function<void(Message)> callBack;
+ std::function<void(Message, const BufferInfo*)> callBack;
};
/*
@@ -245,4 +253,51 @@
inHidlBytes(params, sizeof(*params)));
}
+/*
+ * common functions declarations
+ */
+void allocatePortBuffers(sp<IOmxNode> omxNode,
+ android::Vector<BufferInfo>* buffArray,
+ OMX_U32 portIndex,
+ PortMode portMode = PortMode::PRESET_BYTE_BUFFER);
+
+void changeStateLoadedtoIdle(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
+ android::Vector<BufferInfo>* iBuffer,
+ android::Vector<BufferInfo>* oBuffer,
+ OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput,
+ PortMode* portMode = nullptr);
+
+void changeStateIdletoLoaded(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
+ android::Vector<BufferInfo>* iBuffer,
+ android::Vector<BufferInfo>* oBuffer,
+ OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput);
+
+void changeStateIdletoExecute(sp<IOmxNode> omxNode, sp<CodecObserver> observer);
+
+void changeStateExecutetoIdle(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
+ android::Vector<BufferInfo>* iBuffer,
+ android::Vector<BufferInfo>* oBuffer);
+
+size_t getEmptyBufferID(android::Vector<BufferInfo>* buffArray);
+
+void dispatchOutputBuffer(sp<IOmxNode> omxNode,
+ android::Vector<BufferInfo>* buffArray,
+ size_t bufferIndex,
+ PortMode portMode = PortMode::PRESET_BYTE_BUFFER);
+
+void dispatchInputBuffer(sp<IOmxNode> omxNode,
+ android::Vector<BufferInfo>* buffArray,
+ size_t bufferIndex, int bytesCount, uint32_t flags,
+ uint64_t timestamp);
+
+void flushPorts(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
+ android::Vector<BufferInfo>* iBuffer,
+ android::Vector<BufferInfo>* oBuffer, OMX_U32 kPortIndexInput,
+ OMX_U32 kPortIndexOutput, int64_t timeoutUs = DEFAULT_TIMEOUT);
+
+void testEOS(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
+ android::Vector<BufferInfo>* iBuffer,
+ android::Vector<BufferInfo>* oBuffer, bool signalEOS,
+ bool& eosFlag, PortMode* portMode = nullptr);
+
#endif // MEDIA_HIDL_TEST_COMMON_H
diff --git a/media/omx/1.0/vts/functional/component/Android.bp b/media/omx/1.0/vts/functional/component/Android.bp
index 02fe182..fd3210f 100644
--- a/media/omx/1.0/vts/functional/component/Android.bp
+++ b/media/omx/1.0/vts/functional/component/Android.bp
@@ -23,6 +23,7 @@
"liblog",
"libcutils",
"libhidlbase",
+ "libhidlmemory",
"libhidltransport",
"libhwbinder",
"libnativehelper",
@@ -32,7 +33,8 @@
"android.hidl.memory@1.0",
"android.hardware.media.omx@1.0",
],
- static_libs: ["VtsHalHidlTargetTestBase"],
+ static_libs: ["VtsHalHidlTargetTestBase",
+ "VtsHalMediaOmxV1_0CommonUtil"],
cflags: [
"-O0",
"-g",
diff --git a/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp b/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
index 17c49ca..39e8864 100644
--- a/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
+++ b/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
@@ -30,6 +30,7 @@
using ::android::hardware::media::omx::V1_0::IOmxNode;
using ::android::hardware::media::omx::V1_0::Message;
using ::android::hardware::media::omx::V1_0::CodecBuffer;
+using ::android::hardware::media::omx::V1_0::PortMode;
using ::android::hidl::allocator::V1_0::IAllocator;
using ::android::hidl::memory::V1_0::IMemory;
using ::android::hidl::memory::V1_0::IMapper;
@@ -196,268 +197,6 @@
// Random Index used for monkey testing while get/set parameters
#define RANDOM_INDEX 1729
-// allocate buffers needed on a component port
-void allocatePortBuffers(sp<IOmxNode> omxNode,
- android::Vector<BufferInfo>* buffArray,
- OMX_U32 portIndex) {
- android::hardware::media::omx::V1_0::Status status;
- OMX_PARAM_PORTDEFINITIONTYPE portDef;
-
- buffArray->clear();
-
- sp<IAllocator> allocator = IAllocator::getService("ashmem");
- EXPECT_NE(allocator.get(), nullptr);
-
- status = getPortParam(omxNode, OMX_IndexParamPortDefinition, portIndex,
- &portDef);
- ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
-
- for (size_t i = 0; i < portDef.nBufferCountActual; i++) {
- BufferInfo buffer;
- buffer.owner = client;
- buffer.omxBuffer.type = CodecBuffer::Type::SHARED_MEM;
- buffer.omxBuffer.attr.preset.rangeOffset = 0;
- buffer.omxBuffer.attr.preset.rangeLength = 0;
- bool success = false;
- allocator->allocate(
- portDef.nBufferSize,
- [&success, &buffer](bool _s,
- ::android::hardware::hidl_memory const& mem) {
- success = _s;
- buffer.omxBuffer.sharedMemory = mem;
- });
- ASSERT_EQ(success, true);
- ASSERT_EQ(buffer.omxBuffer.sharedMemory.size(), portDef.nBufferSize);
-
- omxNode->useBuffer(
- portIndex, buffer.omxBuffer,
- [&status, &buffer](android::hardware::media::omx::V1_0::Status _s,
- uint32_t id) {
- status = _s;
- buffer.id = id;
- });
- buffArray->push(buffer);
- ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
- }
-}
-
-// State Transition : Loaded -> Idle
-// Note: This function does not make any background checks for this transition.
-// The callee holds the reponsibility to ensure the legality of the transition.
-void changeStateLoadedtoIdle(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
- android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer,
- OMX_U32 kPortIndexInput,
- OMX_U32 kPortIndexOutput) {
- android::hardware::media::omx::V1_0::Status status;
- Message msg;
-
- // set state to idle
- status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
- OMX_StateIdle);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
-
- // Dont switch states until the ports are populated
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
-
- // allocate buffers on input port
- allocatePortBuffers(omxNode, iBuffer, kPortIndexInput);
-
- // Dont switch states until the ports are populated
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
-
- // allocate buffers on output port
- allocatePortBuffers(omxNode, oBuffer, kPortIndexOutput);
-
- // As the ports are populated, check if the state transition is complete
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- ASSERT_EQ(msg.type, Message::Type::EVENT);
- ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
- ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
- ASSERT_EQ(msg.data.eventData.data2, OMX_StateIdle);
-
- return;
-}
-
-// State Transition : Idle -> Loaded
-// Note: This function does not make any background checks for this transition.
-// The callee holds the reponsibility to ensure the legality of the transition.
-void changeStateIdletoLoaded(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
- android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer,
- OMX_U32 kPortIndexInput,
- OMX_U32 kPortIndexOutput) {
- android::hardware::media::omx::V1_0::Status status;
- Message msg;
-
- // set state to Loaded
- status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
- OMX_StateLoaded);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
-
- // dont change state until all buffers are freed
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
-
- for (size_t i = 0; i < iBuffer->size(); ++i) {
- status = omxNode->freeBuffer(kPortIndexInput, (*iBuffer)[i].id);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- }
-
- // dont change state until all buffers are freed
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
-
- for (size_t i = 0; i < oBuffer->size(); ++i) {
- status = omxNode->freeBuffer(kPortIndexOutput, (*oBuffer)[i].id);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- }
-
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- ASSERT_EQ(msg.type, Message::Type::EVENT);
- ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
- ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
- ASSERT_EQ(msg.data.eventData.data2, OMX_StateLoaded);
-
- return;
-}
-
-// State Transition : Idle -> Execute
-// Note: This function does not make any background checks for this transition.
-// The callee holds the reponsibility to ensure the legality of the transition.
-void changeStateIdletoExecute(sp<IOmxNode> omxNode,
- sp<CodecObserver> observer) {
- android::hardware::media::omx::V1_0::Status status;
- Message msg;
-
- // set state to execute
- status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
- OMX_StateExecuting);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- ASSERT_EQ(msg.type, Message::Type::EVENT);
- ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
- ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
- ASSERT_EQ(msg.data.eventData.data2, OMX_StateExecuting);
-
- return;
-}
-
-// State Transition : Execute -> Idle
-// Note: This function does not make any background checks for this transition.
-// The callee holds the reponsibility to ensure the legality of the transition.
-void changeStateExecutetoIdle(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
- android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer) {
- android::hardware::media::omx::V1_0::Status status;
- Message msg;
-
- // set state to Idle
- status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
- OMX_StateIdle);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- ASSERT_EQ(msg.type, Message::Type::EVENT);
- ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
- ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
- ASSERT_EQ(msg.data.eventData.data2, OMX_StateIdle);
-
- // test if client got all its buffers back
- for (size_t i = 0; i < oBuffer->size(); ++i) {
- EXPECT_EQ((*oBuffer)[i].owner, client);
- }
- for (size_t i = 0; i < iBuffer->size(); ++i) {
- EXPECT_EQ((*iBuffer)[i].owner, client);
- }
-}
-
-// dispatch buffer to output port
-void dispatchOutputBuffer(sp<IOmxNode> omxNode,
- android::Vector<BufferInfo>* buffArray,
- size_t bufferIndex) {
- android::hardware::media::omx::V1_0::Status status;
- CodecBuffer t;
- t.sharedMemory = android::hardware::hidl_memory();
- t.nativeHandle = android::hardware::hidl_handle();
- t.type = CodecBuffer::Type::PRESET;
- t.attr.preset.rangeOffset = 0;
- t.attr.preset.rangeLength = 0;
- native_handle_t* fenceNh = native_handle_create(0, 0);
- ASSERT_NE(fenceNh, nullptr);
- status = omxNode->fillBuffer((*buffArray)[bufferIndex].id, t, fenceNh);
- native_handle_close(fenceNh);
- native_handle_delete(fenceNh);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- buffArray->editItemAt(bufferIndex).owner = component;
-}
-
-// dispatch buffer to input port
-void dispatchInputBuffer(sp<IOmxNode> omxNode,
- android::Vector<BufferInfo>* buffArray,
- size_t bufferIndex, int bytesCount, uint32_t flags,
- uint64_t timestamp) {
- android::hardware::media::omx::V1_0::Status status;
- CodecBuffer t;
- t.sharedMemory = android::hardware::hidl_memory();
- t.nativeHandle = android::hardware::hidl_handle();
- t.type = CodecBuffer::Type::PRESET;
- t.attr.preset.rangeOffset = 0;
- t.attr.preset.rangeLength = bytesCount;
- native_handle_t* fenceNh = native_handle_create(0, 0);
- ASSERT_NE(fenceNh, nullptr);
- status = omxNode->emptyBuffer((*buffArray)[bufferIndex].id, t, flags,
- timestamp, fenceNh);
- native_handle_close(fenceNh);
- native_handle_delete(fenceNh);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- buffArray->editItemAt(bufferIndex).owner = component;
-}
-
-// Flush input and output ports
-void flushPorts(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
- android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer, OMX_U32 kPortIndexInput,
- OMX_U32 kPortIndexOutput) {
- android::hardware::media::omx::V1_0::Status status;
- Message msg;
-
- // Flush input port
- status = omxNode->sendCommand(toRawCommandType(OMX_CommandFlush),
- kPortIndexInput);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- ASSERT_EQ(msg.type, Message::Type::EVENT);
- ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
- ASSERT_EQ(msg.data.eventData.data1, OMX_CommandFlush);
- ASSERT_EQ(msg.data.eventData.data2, kPortIndexInput);
- // test if client got all its buffers back
- for (size_t i = 0; i < iBuffer->size(); ++i) {
- EXPECT_EQ((*iBuffer)[i].owner, client);
- }
-
- // Flush output port
- status = omxNode->sendCommand(toRawCommandType(OMX_CommandFlush),
- kPortIndexOutput);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- ASSERT_EQ(msg.type, Message::Type::EVENT);
- ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
- ASSERT_EQ(msg.data.eventData.data1, OMX_CommandFlush);
- ASSERT_EQ(msg.data.eventData.data2, kPortIndexOutput);
- // test if client got all its buffers back
- for (size_t i = 0; i < oBuffer->size(); ++i) {
- EXPECT_EQ((*oBuffer)[i].owner, client);
- }
-}
-
// get/set video component port format
Return<android::hardware::media::omx::V1_0::Status> setVideoPortFormat(
sp<IOmxNode> omxNode, OMX_U32 portIndex,
diff --git a/media/omx/1.0/vts/functional/video/Android.bp b/media/omx/1.0/vts/functional/video/Android.bp
index a8c8d99..4e94f3b 100644
--- a/media/omx/1.0/vts/functional/video/Android.bp
+++ b/media/omx/1.0/vts/functional/video/Android.bp
@@ -33,8 +33,12 @@
"android.hidl.allocator@1.0",
"android.hidl.memory@1.0",
"android.hardware.media.omx@1.0",
+ "android.hardware.graphics.allocator@2.0",
+ "android.hardware.graphics.mapper@2.0",
+ "android.hardware.graphics.common@1.0",
],
- static_libs: ["VtsHalHidlTargetTestBase"],
+ static_libs: ["VtsHalHidlTargetTestBase",
+ "VtsHalMediaOmxV1_0CommonUtil"],
cflags: [
"-O0",
"-g",
@@ -59,13 +63,17 @@
"libhidltransport",
"libhwbinder",
"libnativehelper",
+ "libnativewindow",
"libutils",
"libstagefright_foundation",
"android.hidl.allocator@1.0",
"android.hidl.memory@1.0",
"android.hardware.media.omx@1.0",
+ "android.hardware.graphics.bufferqueue@1.0",
+ "android.hardware.graphics.mapper@2.0",
],
- static_libs: ["VtsHalHidlTargetTestBase"],
+ static_libs: ["VtsHalHidlTargetTestBase",
+ "VtsHalMediaOmxV1_0CommonUtil"],
cflags: [
"-O0",
"-g",
diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
index 35c2b0c..8caf697 100644
--- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
+++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
@@ -17,6 +17,9 @@
#define LOG_TAG "media_omx_hidl_video_dec_test"
#include <android-base/logging.h>
+#include <android/hardware/graphics/allocator/2.0/IAllocator.h>
+#include <android/hardware/graphics/mapper/2.0/IMapper.h>
+#include <android/hardware/graphics/mapper/2.0/types.h>
#include <android/hardware/media/omx/1.0/IOmx.h>
#include <android/hardware/media/omx/1.0/IOmxNode.h>
#include <android/hardware/media/omx/1.0/IOmxObserver.h>
@@ -25,11 +28,14 @@
#include <android/hidl/memory/1.0/IMapper.h>
#include <android/hidl/memory/1.0/IMemory.h>
+using ::android::hardware::graphics::common::V1_0::BufferUsage;
+using ::android::hardware::graphics::common::V1_0::PixelFormat;
using ::android::hardware::media::omx::V1_0::IOmx;
using ::android::hardware::media::omx::V1_0::IOmxObserver;
using ::android::hardware::media::omx::V1_0::IOmxNode;
using ::android::hardware::media::omx::V1_0::Message;
using ::android::hardware::media::omx::V1_0::CodecBuffer;
+using ::android::hardware::media::omx::V1_0::PortMode;
using ::android::hidl::allocator::V1_0::IAllocator;
using ::android::hidl::memory::V1_0::IMemory;
using ::android::hidl::memory::V1_0::IMapper;
@@ -136,7 +142,9 @@
gEnv->getInstance());
ASSERT_NE(omx, nullptr);
observer =
- new CodecObserver([this](Message msg) { handleMessage(msg); });
+ new CodecObserver([this](Message msg, const BufferInfo* buffer) {
+ handleMessage(msg, buffer);
+ });
ASSERT_NE(observer, nullptr);
if (strncmp(gEnv->getComponent().c_str(), "OMX.", 4) != 0)
disableTest = true;
@@ -193,10 +201,19 @@
}
}
if (i == kNumCompToCompression) disableTest = true;
+ portMode[0] = portMode[1] = PortMode::PRESET_BYTE_BUFFER;
eosFlag = false;
framesReceived = 0;
timestampUs = 0;
timestampDevTest = false;
+ isSecure = false;
+ size_t suffixLen = strlen(".secure");
+ if (strlen(gEnv->getComponent().c_str()) >= suffixLen) {
+ }
+ isSecure = !strcmp(gEnv->getComponent().c_str() +
+ strlen(gEnv->getComponent().c_str()) - suffixLen,
+ ".secure");
+ if (isSecure) disableTest = true;
if (disableTest) std::cerr << "[ ] Warning ! Test Disabled\n";
}
@@ -209,7 +226,8 @@
// callback function to process messages received by onMessages() from IL
// client.
- void handleMessage(Message msg) {
+ void handleMessage(Message msg, const BufferInfo* buffer) {
+ (void)buffer;
if (msg.type == Message::Type::FILL_BUFFER_DONE) {
if (msg.data.extendedBufferData.flags & OMX_BUFFERFLAG_EOS) {
eosFlag = true;
@@ -245,13 +263,27 @@
}
}
}
+#define WRITE_OUTPUT 0
+#if WRITE_OUTPUT
+ static int count = 0;
+ FILE* ofp = nullptr;
+ if (count)
+ ofp = fopen("out.bin", "ab");
+ else
+ ofp = fopen("out.bin", "wb");
+ if (ofp != nullptr &&
+ portMode[1] == PortMode::PRESET_BYTE_BUFFER) {
+ fwrite(static_cast<void*>(buffer->mMemory->getPointer()),
+ sizeof(char),
+ msg.data.extendedBufferData.rangeLength, ofp);
+ fclose(ofp);
+ count++;
+ }
+#endif
}
}
}
- void testEOS(android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer, bool signalEOS = false);
-
enum standardComp {
h263,
avc,
@@ -269,11 +301,13 @@
standardComp compName;
OMX_VIDEO_CODINGTYPE eCompressionFormat;
bool disableTest;
+ PortMode portMode[2];
bool eosFlag;
uint32_t framesReceived;
uint64_t timestampUs;
::android::List<uint64_t> timestampUslist;
bool timestampDevTest;
+ bool isSecure;
protected:
static void description(const std::string& description) {
@@ -281,44 +315,6 @@
}
};
-// end of stream test for video decoder components
-void VideoDecHidlTest::testEOS(android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer,
- bool signalEOS) {
- android::hardware::media::omx::V1_0::Status status;
- size_t i = 0;
- if (signalEOS) {
- if ((i = getEmptyBufferID(iBuffer)) < iBuffer->size()) {
- // signal an empty buffer with flag set to EOS
- dispatchInputBuffer(omxNode, iBuffer, i, 0, OMX_BUFFERFLAG_EOS, 0);
- } else {
- ASSERT_TRUE(false);
- }
- }
- // Dispatch all client owned output buffers to recover remaining frames
- while (1) {
- if ((i = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
- dispatchOutputBuffer(omxNode, oBuffer, i);
- } else {
- break;
- }
- }
- while (1) {
- Message msg;
- status =
- observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- EXPECT_EQ(status,
- android::hardware::media::omx::V1_0::Status::TIMED_OUT);
- for (; i < iBuffer->size(); i++) {
- if ((*iBuffer)[i].owner != client) break;
- }
- if (i == iBuffer->size()) break;
- }
- // test for flag
- EXPECT_EQ(eosFlag, true);
- eosFlag = false;
-}
-
// Set Default port param.
void setDefaultPortParam(sp<IOmxNode> omxNode, OMX_U32 portIndex,
OMX_VIDEO_CODINGTYPE eCompressionFormat,
@@ -399,12 +395,85 @@
}
}
+void allocateGraphicBuffers(sp<IOmxNode> omxNode, OMX_U32 portIndex,
+ android::Vector<BufferInfo>* buffArray,
+ uint32_t nFrameWidth, uint32_t nFrameHeight,
+ int32_t* nStride, uint32_t count) {
+ android::hardware::media::omx::V1_0::Status status;
+ sp<android::hardware::graphics::allocator::V2_0::IAllocator> allocator =
+ android::hardware::graphics::allocator::V2_0::IAllocator::getService();
+ ASSERT_NE(nullptr, allocator.get());
+
+ sp<android::hardware::graphics::mapper::V2_0::IMapper> mapper =
+ android::hardware::graphics::mapper::V2_0::IMapper::getService();
+ ASSERT_NE(mapper.get(), nullptr);
+
+ android::hardware::graphics::mapper::V2_0::IMapper::BufferDescriptorInfo
+ descriptorInfo;
+ uint32_t usage;
+
+ descriptorInfo.width = nFrameWidth;
+ descriptorInfo.height = nFrameHeight;
+ descriptorInfo.layerCount = 1;
+ descriptorInfo.format = PixelFormat::RGBA_8888;
+ descriptorInfo.usage = static_cast<uint64_t>(BufferUsage::CPU_READ_OFTEN);
+ omxNode->getGraphicBufferUsage(
+ portIndex,
+ [&status, &usage](android::hardware::media::omx::V1_0::Status _s,
+ uint32_t _n1) {
+ status = _s;
+ usage = _n1;
+ });
+ if (status == android::hardware::media::omx::V1_0::Status::OK) {
+ descriptorInfo.usage |= usage;
+ }
+
+ ::android::hardware::hidl_vec<uint32_t> descriptor;
+ android::hardware::graphics::mapper::V2_0::Error error;
+ mapper->createDescriptor(
+ descriptorInfo, [&error, &descriptor](
+ android::hardware::graphics::mapper::V2_0::Error _s,
+ ::android::hardware::hidl_vec<uint32_t> _n1) {
+ error = _s;
+ descriptor = _n1;
+ });
+ EXPECT_EQ(error, android::hardware::graphics::mapper::V2_0::Error::NONE);
+
+ EXPECT_EQ(buffArray->size(), count);
+ allocator->allocate(
+ descriptor, count,
+ [&](android::hardware::graphics::mapper::V2_0::Error _s, uint32_t _n1,
+ const ::android::hardware::hidl_vec<
+ ::android::hardware::hidl_handle>& _n2) {
+ ASSERT_EQ(android::hardware::graphics::mapper::V2_0::Error::NONE,
+ _s);
+ *nStride = _n1;
+ ASSERT_EQ(count, _n2.size());
+ for (uint32_t i = 0; i < count; i++) {
+ buffArray->editItemAt(i).omxBuffer.nativeHandle = _n2[i];
+ buffArray->editItemAt(i).omxBuffer.attr.anwBuffer.width =
+ nFrameWidth;
+ buffArray->editItemAt(i).omxBuffer.attr.anwBuffer.height =
+ nFrameHeight;
+ buffArray->editItemAt(i).omxBuffer.attr.anwBuffer.stride = _n1;
+ buffArray->editItemAt(i).omxBuffer.attr.anwBuffer.format =
+ descriptorInfo.format;
+ buffArray->editItemAt(i).omxBuffer.attr.anwBuffer.usage =
+ descriptorInfo.usage;
+ buffArray->editItemAt(i).omxBuffer.attr.anwBuffer.layerCount =
+ descriptorInfo.layerCount;
+ buffArray->editItemAt(i).omxBuffer.attr.anwBuffer.id =
+ (*buffArray)[i].id;
+ }
+ });
+}
+
// port settings reconfiguration during runtime. reconfigures frame dimensions
void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
android::Vector<BufferInfo>* iBuffer,
android::Vector<BufferInfo>* oBuffer,
OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput,
- Message msg) {
+ Message msg, PortMode oPortMode) {
android::hardware::media::omx::V1_0::Status status;
if (msg.data.eventData.event == OMX_EventPortSettingsChanged) {
@@ -461,7 +530,8 @@
status,
android::hardware::media::omx::V1_0::Status::TIMED_OUT);
- allocatePortBuffers(omxNode, oBuffer, kPortIndexOutput);
+ allocatePortBuffers(omxNode, oBuffer, kPortIndexOutput,
+ oPortMode);
status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT,
iBuffer, oBuffer);
ASSERT_EQ(status,
@@ -472,7 +542,7 @@
// dispatch output buffers
for (size_t i = 0; i < oBuffer->size(); i++) {
- dispatchOutputBuffer(omxNode, oBuffer, i);
+ dispatchOutputBuffer(omxNode, oBuffer, i, oPortMode);
}
} else {
ASSERT_TRUE(false);
@@ -499,18 +569,21 @@
void waitOnInputConsumption(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
android::Vector<BufferInfo>* iBuffer,
android::Vector<BufferInfo>* oBuffer,
- OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput) {
+ OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput,
+ PortMode oPortMode) {
android::hardware::media::omx::V1_0::Status status;
Message msg;
+ int timeOut = TIMEOUT_COUNTER;
- while (1) {
+ while (timeOut--) {
size_t i = 0;
status =
observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
if (status == android::hardware::media::omx::V1_0::Status::OK) {
EXPECT_EQ(msg.type, Message::Type::EVENT);
portReconfiguration(omxNode, observer, iBuffer, oBuffer,
- kPortIndexInput, kPortIndexOutput, msg);
+ kPortIndexInput, kPortIndexOutput, msg,
+ oPortMode);
}
// status == TIMED_OUT, it could be due to process time being large
// than DEFAULT_TIMEOUT or component needs output buffers to start
@@ -523,8 +596,9 @@
// Dispatch an output buffer assuming outQueue.empty() is true
size_t index;
if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
- dispatchOutputBuffer(omxNode, oBuffer, index);
+ dispatchOutputBuffer(omxNode, oBuffer, index, oPortMode);
}
+ timeOut--;
}
}
@@ -534,13 +608,14 @@
android::Vector<BufferInfo>* oBuffer,
OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput,
std::ifstream& eleStream, android::Vector<FrameData>* Info,
- int offset, int range, bool signalEOS = true) {
+ int offset, int range, PortMode oPortMode,
+ bool signalEOS = true) {
android::hardware::media::omx::V1_0::Status status;
Message msg;
// dispatch output buffers
for (size_t i = 0; i < oBuffer->size(); i++) {
- dispatchOutputBuffer(omxNode, oBuffer, i);
+ dispatchOutputBuffer(omxNode, oBuffer, i, oPortMode);
}
// dispatch input buffers
uint32_t flags = 0;
@@ -563,6 +638,8 @@
frameID++;
}
+ int timeOut = TIMEOUT_COUNTER;
+ bool stall = false;
while (1) {
status =
observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
@@ -571,7 +648,8 @@
if (status == android::hardware::media::omx::V1_0::Status::OK &&
msg.type == Message::Type::EVENT) {
portReconfiguration(omxNode, observer, iBuffer, oBuffer,
- kPortIndexInput, kPortIndexOutput, msg);
+ kPortIndexInput, kPortIndexOutput, msg,
+ oPortMode);
}
if (frameID == (int)Info->size() || frameID == (offset + range)) break;
@@ -593,9 +671,21 @@
(*Info)[frameID].bytesCount, flags,
(*Info)[frameID].timestamp);
frameID++;
- }
+ stall = false;
+ } else
+ stall = true;
if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
- dispatchOutputBuffer(omxNode, oBuffer, index);
+ dispatchOutputBuffer(omxNode, oBuffer, index, oPortMode);
+ stall = false;
+ } else
+ stall = true;
+ if (stall)
+ timeOut--;
+ else
+ timeOut = TIMEOUT_COUNTER;
+ if (timeOut == 0) {
+ EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite";
+ break;
}
}
}
@@ -675,6 +765,28 @@
}
eleInfo.close();
+ // set port mode
+ if (isSecure) {
+ portMode[0] = PortMode::PRESET_SECURE_BUFFER;
+ portMode[1] = PortMode::DYNAMIC_ANW_BUFFER;
+ status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ } else {
+ portMode[0] = PortMode::PRESET_BYTE_BUFFER;
+ portMode[1] = PortMode::DYNAMIC_ANW_BUFFER;
+ status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
+ if (status != ::android::hardware::media::omx::V1_0::Status::OK) {
+ portMode[1] = PortMode::PRESET_BYTE_BUFFER;
+ status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
+ ASSERT_EQ(status,
+ ::android::hardware::media::omx::V1_0::Status::OK);
+ }
+ }
+
// set Port Params
uint32_t nFrameWidth, nFrameHeight, xFramerate;
OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatYUV420Planar;
@@ -682,23 +794,38 @@
&xFramerate);
setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused,
eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate);
+ omxNode->prepareForAdaptivePlayback(kPortIndexOutput, false, 1920, 1080);
android::Vector<BufferInfo> iBuffer, oBuffer;
// set state to idle
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ kPortIndexInput, kPortIndexOutput, portMode);
// set state to executing
changeStateIdletoExecute(omxNode, observer);
+
+ if (portMode[1] != PortMode::PRESET_BYTE_BUFFER) {
+ OMX_PARAM_PORTDEFINITIONTYPE portDef;
+
+ status = getPortParam(omxNode, OMX_IndexParamPortDefinition,
+ kPortIndexOutput, &portDef);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ allocateGraphicBuffers(
+ omxNode, kPortIndexOutput, &oBuffer,
+ portDef.format.video.nFrameWidth, portDef.format.video.nFrameHeight,
+ &portDef.format.video.nStride, portDef.nBufferCountActual);
+ }
+
// Port Reconfiguration
eleStream.open(mURL, std::ifstream::binary);
ASSERT_EQ(eleStream.is_open(), true);
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput, eleStream, &Info, 0, (int)Info.size());
+ kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(),
+ portMode[1]);
eleStream.close();
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
- testEOS(&iBuffer, &oBuffer);
+ kPortIndexInput, kPortIndexOutput, portMode[1]);
+ testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode);
EXPECT_EQ(timestampUslist.empty(), true);
// set state to idle
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
@@ -730,18 +857,25 @@
&xFramerate);
setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused,
eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate);
- omxNode->prepareForAdaptivePlayback(kPortIndexOutput, false, 1920, 1080);
+
+ // set port mode
+ PortMode portMode[2];
+ portMode[0] = portMode[1] = PortMode::PRESET_BYTE_BUFFER;
+ status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
android::Vector<BufferInfo> iBuffer, oBuffer;
// set state to idle
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ kPortIndexInput, kPortIndexOutput, portMode);
// set state to executing
changeStateIdletoExecute(omxNode, observer);
// request EOS at the start
- testEOS(&iBuffer, &oBuffer, true);
+ testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode);
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
kPortIndexOutput);
EXPECT_GE(framesReceived, 0U);
@@ -798,13 +932,20 @@
&xFramerate);
setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused,
eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate);
- omxNode->prepareForAdaptivePlayback(kPortIndexOutput, false, 1920, 1080);
+
+ // set port mode
+ PortMode portMode[2];
+ portMode[0] = portMode[1] = PortMode::PRESET_BYTE_BUFFER;
+ status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
android::Vector<BufferInfo> iBuffer, oBuffer;
// set state to idle
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ kPortIndexInput, kPortIndexOutput, portMode);
// set state to executing
changeStateIdletoExecute(omxNode, observer);
@@ -814,11 +955,11 @@
eleStream.open(mURL, std::ifstream::binary);
ASSERT_EQ(eleStream.is_open(), true);
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput, eleStream, &Info, 0, i + 1);
+ kPortIndexOutput, eleStream, &Info, 0, i + 1, portMode[1]);
eleStream.close();
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
- testEOS(&iBuffer, &oBuffer);
+ kPortIndexInput, kPortIndexOutput, portMode[1]);
+ testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode);
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
kPortIndexOutput);
EXPECT_GE(framesReceived, 1U);
@@ -828,11 +969,12 @@
eleStream.open(mURL, std::ifstream::binary);
ASSERT_EQ(eleStream.is_open(), true);
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput, eleStream, &Info, 0, i + 1, false);
+ kPortIndexOutput, eleStream, &Info, 0, i + 1, portMode[1],
+ false);
eleStream.close();
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
- testEOS(&iBuffer, &oBuffer, true);
+ kPortIndexInput, kPortIndexOutput, portMode[1]);
+ testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode);
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
kPortIndexOutput);
EXPECT_GE(framesReceived, 1U);
@@ -889,13 +1031,20 @@
&xFramerate);
setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused,
eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate);
- omxNode->prepareForAdaptivePlayback(kPortIndexOutput, false, 1920, 1080);
+
+ // set port mode
+ PortMode portMode[2];
+ portMode[0] = portMode[1] = PortMode::PRESET_BYTE_BUFFER;
+ status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
android::Vector<BufferInfo> iBuffer, oBuffer;
// set state to idle
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ kPortIndexInput, kPortIndexOutput, portMode);
// set state to executing
changeStateIdletoExecute(omxNode, observer);
@@ -903,11 +1052,12 @@
eleStream.open(mURL, std::ifstream::binary);
ASSERT_EQ(eleStream.is_open(), true);
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput, eleStream, &Info, 0, (int)Info.size());
+ kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(),
+ portMode[1]);
eleStream.close();
waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
- testEOS(&iBuffer, &oBuffer);
+ kPortIndexInput, kPortIndexOutput, portMode[1]);
+ testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode);
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
kPortIndexOutput);
framesReceived = 0;
@@ -964,11 +1114,19 @@
setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused,
eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate);
+ // set port mode
+ PortMode portMode[2];
+ portMode[0] = portMode[1] = PortMode::PRESET_BYTE_BUFFER;
+ status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+
android::Vector<BufferInfo> iBuffer, oBuffer;
// set state to idle
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ kPortIndexInput, kPortIndexOutput, portMode);
// set state to executing
changeStateIdletoExecute(omxNode, observer);
@@ -979,7 +1137,8 @@
eleStream.open(mURL, std::ifstream::binary);
ASSERT_EQ(eleStream.is_open(), true);
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
- kPortIndexOutput, eleStream, &Info, 0, nFrames, false);
+ kPortIndexOutput, eleStream, &Info, 0, nFrames, portMode[1],
+ false);
// Note: Assumes 200 ms is enough to end any decode call that started
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
kPortIndexOutput, 200000);
@@ -1001,7 +1160,7 @@
if (keyFrame) {
decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
kPortIndexOutput, eleStream, &Info, index,
- Info.size() - index, false);
+ Info.size() - index, portMode[1], false);
}
// Note: Assumes 200 ms is enough to end any decode call that started
flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
index 72ab937..6bc95ca 100644
--- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
+++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
@@ -21,6 +21,11 @@
#include <android-base/logging.h>
+#include <android/hardware/graphics/bufferqueue/1.0/IGraphicBufferProducer.h>
+#include <android/hardware/graphics/bufferqueue/1.0/IProducerListener.h>
+#include <android/hardware/graphics/mapper/2.0/IMapper.h>
+#include <android/hardware/graphics/mapper/2.0/types.h>
+#include <android/hardware/media/omx/1.0/IGraphicBufferSource.h>
#include <android/hardware/media/omx/1.0/IOmx.h>
#include <android/hardware/media/omx/1.0/IOmxNode.h>
#include <android/hardware/media/omx/1.0/IOmxObserver.h>
@@ -29,11 +34,17 @@
#include <android/hidl/memory/1.0/IMapper.h>
#include <android/hidl/memory/1.0/IMemory.h>
+using ::android::hardware::graphics::bufferqueue::V1_0::IGraphicBufferProducer;
+using ::android::hardware::graphics::bufferqueue::V1_0::IProducerListener;
+using ::android::hardware::graphics::common::V1_0::BufferUsage;
+using ::android::hardware::graphics::common::V1_0::PixelFormat;
+using ::android::hardware::media::omx::V1_0::IGraphicBufferSource;
using ::android::hardware::media::omx::V1_0::IOmx;
using ::android::hardware::media::omx::V1_0::IOmxObserver;
using ::android::hardware::media::omx::V1_0::IOmxNode;
using ::android::hardware::media::omx::V1_0::Message;
using ::android::hardware::media::omx::V1_0::CodecBuffer;
+using ::android::hardware::media::omx::V1_0::PortMode;
using ::android::hidl::allocator::V1_0::IAllocator;
using ::android::hidl::memory::V1_0::IMemory;
using ::android::hidl::memory::V1_0::IMapper;
@@ -48,6 +59,7 @@
#include <media/hardware/HardwareAPI.h>
#include <media_hidl_test_common.h>
#include <media_video_hidl_test_common.h>
+#include <system/window.h>
#include <fstream>
// A class for test environment setup
@@ -140,7 +152,10 @@
omx = ::testing::VtsHalHidlTargetTestBase::getService<IOmx>(
gEnv->getInstance());
ASSERT_NE(omx, nullptr);
- observer = new CodecObserver([](Message msg) { (void)msg; });
+ observer =
+ new CodecObserver([this](Message msg, const BufferInfo* buffer) {
+ handleMessage(msg, buffer);
+ });
ASSERT_NE(observer, nullptr);
if (strncmp(gEnv->getComponent().c_str(), "OMX.", 4) != 0)
disableTest = true;
@@ -196,6 +211,19 @@
}
}
if (i == kNumCompToCompression) disableTest = true;
+ eosFlag = false;
+ prependSPSPPS = false;
+ timestampDevTest = false;
+ producer = nullptr;
+ source = nullptr;
+ isSecure = false;
+ size_t suffixLen = strlen(".secure");
+ if (strlen(gEnv->getComponent().c_str()) >= suffixLen) {
+ }
+ isSecure = !strcmp(gEnv->getComponent().c_str() +
+ strlen(gEnv->getComponent().c_str()) - suffixLen,
+ ".secure");
+ if (isSecure) disableTest = true;
if (disableTest) std::cerr << "[ ] Warning ! Test Disabled\n";
}
@@ -206,6 +234,63 @@
}
}
+ // callback function to process messages received by onMessages() from IL
+ // client.
+ void handleMessage(Message msg, const BufferInfo* buffer) {
+ (void)buffer;
+
+ if (msg.type == Message::Type::FILL_BUFFER_DONE) {
+ if (msg.data.extendedBufferData.flags & OMX_BUFFERFLAG_EOS) {
+ eosFlag = true;
+ }
+ if (msg.data.extendedBufferData.rangeLength != 0) {
+ // Test if current timestamp is among the list of queued
+ // timestamps
+ if (timestampDevTest && (prependSPSPPS ||
+ (msg.data.extendedBufferData.flags &
+ OMX_BUFFERFLAG_CODECCONFIG) == 0)) {
+ bool tsHit = false;
+ android::List<uint64_t>::iterator it =
+ timestampUslist.begin();
+ while (it != timestampUslist.end()) {
+ if (*it == msg.data.extendedBufferData.timestampUs) {
+ timestampUslist.erase(it);
+ tsHit = true;
+ break;
+ }
+ it++;
+ }
+ if (tsHit == false) {
+ if (timestampUslist.empty() == false) {
+ EXPECT_EQ(tsHit, true)
+ << "TimeStamp not recognized";
+ } else {
+ std::cerr
+ << "[ ] Warning ! Received non-zero "
+ "output / TimeStamp not recognized \n";
+ }
+ }
+ }
+#define WRITE_OUTPUT 0
+#if WRITE_OUTPUT
+ static int count = 0;
+ FILE* ofp = nullptr;
+ if (count)
+ ofp = fopen("out.bin", "ab");
+ else
+ ofp = fopen("out.bin", "wb");
+ if (ofp != nullptr) {
+ fwrite(static_cast<void*>(buffer->mMemory->getPointer()),
+ sizeof(char),
+ msg.data.extendedBufferData.rangeLength, ofp);
+ fclose(ofp);
+ count++;
+ }
+#endif
+ }
+ }
+ }
+
enum standardComp {
h263,
avc,
@@ -222,6 +307,13 @@
standardComp compName;
OMX_VIDEO_CODINGTYPE eCompressionFormat;
bool disableTest;
+ bool eosFlag;
+ bool prependSPSPPS;
+ ::android::List<uint64_t> timestampUslist;
+ bool timestampDevTest;
+ bool isSecure;
+ sp<IGraphicBufferProducer> producer;
+ sp<IGraphicBufferSource> source;
protected:
static void description(const std::string& description) {
@@ -229,6 +321,30 @@
}
};
+// CodecProducerListener class
+struct CodecProducerListener : public IProducerListener {
+ public:
+ CodecProducerListener(int a, int b)
+ : freeBuffers(a), minUnDequeuedCount(b) {}
+ virtual ::android::hardware::Return<void> onBufferReleased() override {
+ android::Mutex::Autolock autoLock(bufferLock);
+ freeBuffers += 1;
+ return Void();
+ }
+ virtual ::android::hardware::Return<bool> needsReleaseNotify() override {
+ return true;
+ }
+ void reduceCount() {
+ android::Mutex::Autolock autoLock(bufferLock);
+ freeBuffers -= 1;
+ EXPECT_GE(freeBuffers, minUnDequeuedCount);
+ }
+
+ size_t freeBuffers;
+ size_t minUnDequeuedCount;
+ android::Mutex bufferLock;
+};
+
// request VOP refresh
void requestIDR(sp<IOmxNode> omxNode, OMX_U32 portIndex) {
android::hardware::media::omx::V1_0::Status status;
@@ -375,13 +491,313 @@
strcat(URL, "bbb_352x288_420p_30fps_32frames.yuv");
}
+// blocking call to ensures application to Wait till all the inputs are consumed
+void waitOnInputConsumption(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
+ android::Vector<BufferInfo>* iBuffer,
+ android::Vector<BufferInfo>* oBuffer,
+ bool inputDataIsMeta = false,
+ sp<CodecProducerListener> listener = nullptr) {
+ android::hardware::media::omx::V1_0::Status status;
+ Message msg;
+ int timeOut = TIMEOUT_COUNTER;
+
+ while (timeOut--) {
+ size_t i = 0;
+ status =
+ observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
+ EXPECT_EQ(status,
+ android::hardware::media::omx::V1_0::Status::TIMED_OUT);
+ // status == TIMED_OUT, it could be due to process time being large
+ // than DEFAULT_TIMEOUT or component needs output buffers to start
+ // processing.
+ if (inputDataIsMeta) {
+ if (listener->freeBuffers == iBuffer->size()) break;
+ } else {
+ for (; i < iBuffer->size(); i++) {
+ if ((*iBuffer)[i].owner != client) break;
+ }
+ if (i == iBuffer->size()) break;
+ }
+
+ // Dispatch an output buffer assuming outQueue.empty() is true
+ size_t index;
+ if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
+ dispatchOutputBuffer(omxNode, oBuffer, index);
+ }
+ }
+}
+
+int colorFormatConversion(BufferInfo* buffer, void* buff, PixelFormat format,
+ std::ifstream& eleStream) {
+ sp<android::hardware::graphics::mapper::V2_0::IMapper> mapper =
+ android::hardware::graphics::mapper::V2_0::IMapper::getService();
+ EXPECT_NE(mapper.get(), nullptr);
+ if (mapper.get() == nullptr) return 1;
+
+ android::hardware::hidl_handle fence;
+ android::hardware::graphics::mapper::V2_0::IMapper::Rect rect;
+ android::hardware::graphics::mapper::V2_0::YCbCrLayout ycbcrLayout;
+ android::hardware::graphics::mapper::V2_0::Error error;
+ rect.left = 0;
+ rect.top = 0;
+ rect.width = buffer->omxBuffer.attr.anwBuffer.width;
+ rect.height = buffer->omxBuffer.attr.anwBuffer.height;
+
+ if (format == PixelFormat::YV12) {
+ mapper->lockYCbCr(
+ buff, buffer->omxBuffer.attr.anwBuffer.usage, rect, fence,
+ [&](android::hardware::graphics::mapper::V2_0::Error _e,
+ android::hardware::graphics::mapper::V2_0::YCbCrLayout _n1) {
+ error = _e;
+ ycbcrLayout = _n1;
+ });
+ EXPECT_EQ(error,
+ android::hardware::graphics::mapper::V2_0::Error::NONE);
+ if (error != android::hardware::graphics::mapper::V2_0::Error::NONE)
+ return 1;
+
+ EXPECT_EQ(ycbcrLayout.chromaStep, 1U);
+ char* ipBuffer = static_cast<char*>(ycbcrLayout.y);
+ for (size_t y = rect.height; y > 0; --y) {
+ eleStream.read(ipBuffer, rect.width);
+ if (eleStream.gcount() != rect.width) return 1;
+ ipBuffer += ycbcrLayout.yStride;
+ }
+ ipBuffer = static_cast<char*>(ycbcrLayout.cb);
+ for (size_t y = rect.height >> 1; y > 0; --y) {
+ eleStream.read(ipBuffer, rect.width >> 1);
+ if (eleStream.gcount() != rect.width >> 1) return 1;
+ ipBuffer += ycbcrLayout.cStride;
+ }
+ ipBuffer = static_cast<char*>(ycbcrLayout.cr);
+ for (size_t y = rect.height >> 1; y > 0; --y) {
+ eleStream.read(ipBuffer, rect.width >> 1);
+ if (eleStream.gcount() != rect.width >> 1) return 1;
+ ipBuffer += ycbcrLayout.cStride;
+ }
+
+ mapper->unlock(buff,
+ [&](android::hardware::graphics::mapper::V2_0::Error _e,
+ android::hardware::hidl_handle _n1) {
+ error = _e;
+ fence = _n1;
+ });
+ EXPECT_EQ(error,
+ android::hardware::graphics::mapper::V2_0::Error::NONE);
+ if (error != android::hardware::graphics::mapper::V2_0::Error::NONE)
+ return 1;
+ } else if (format == PixelFormat::YCBCR_420_888) {
+ void* data;
+ mapper->lock(buff, buffer->omxBuffer.attr.anwBuffer.usage, rect, fence,
+ [&](android::hardware::graphics::mapper::V2_0::Error _e,
+ void* _n1) {
+ error = _e;
+ data = _n1;
+ });
+ EXPECT_EQ(error,
+ android::hardware::graphics::mapper::V2_0::Error::NONE);
+ if (error != android::hardware::graphics::mapper::V2_0::Error::NONE)
+ return 1;
+
+ ycbcrLayout.chromaStep = 1;
+ ycbcrLayout.yStride = buffer->omxBuffer.attr.anwBuffer.stride;
+ ycbcrLayout.cStride = ycbcrLayout.yStride >> 1;
+ ycbcrLayout.y = data;
+ ycbcrLayout.cb = static_cast<char*>(ycbcrLayout.y) +
+ (ycbcrLayout.yStride * rect.height);
+ ycbcrLayout.cr = static_cast<char*>(ycbcrLayout.cb) +
+ ((ycbcrLayout.yStride * rect.height) >> 2);
+
+ char* ipBuffer = static_cast<char*>(ycbcrLayout.y);
+ for (size_t y = rect.height; y > 0; --y) {
+ eleStream.read(ipBuffer, rect.width);
+ if (eleStream.gcount() != rect.width) return 1;
+ ipBuffer += ycbcrLayout.yStride;
+ }
+ ipBuffer = static_cast<char*>(ycbcrLayout.cb);
+ for (size_t y = rect.height >> 1; y > 0; --y) {
+ eleStream.read(ipBuffer, rect.width >> 1);
+ if (eleStream.gcount() != rect.width >> 1) return 1;
+ ipBuffer += ycbcrLayout.cStride;
+ }
+ ipBuffer = static_cast<char*>(ycbcrLayout.cr);
+ for (size_t y = rect.height >> 1; y > 0; --y) {
+ eleStream.read(ipBuffer, rect.width >> 1);
+ if (eleStream.gcount() != rect.width >> 1) return 1;
+ ipBuffer += ycbcrLayout.cStride;
+ }
+
+ mapper->unlock(buff,
+ [&](android::hardware::graphics::mapper::V2_0::Error _e,
+ android::hardware::hidl_handle _n1) {
+ error = _e;
+ fence = _n1;
+ });
+ EXPECT_EQ(error,
+ android::hardware::graphics::mapper::V2_0::Error::NONE);
+ if (error != android::hardware::graphics::mapper::V2_0::Error::NONE)
+ return 1;
+ } else {
+ EXPECT_TRUE(false) << "un expected pixel format";
+ return 1;
+ }
+
+ return 0;
+}
+
+int fillGraphicBuffer(BufferInfo* buffer, PixelFormat format,
+ std::ifstream& eleStream) {
+ sp<android::hardware::graphics::mapper::V2_0::IMapper> mapper =
+ android::hardware::graphics::mapper::V2_0::IMapper::getService();
+ EXPECT_NE(mapper.get(), nullptr);
+ if (mapper.get() == nullptr) return 1;
+
+ void* buff = nullptr;
+ android::hardware::graphics::mapper::V2_0::Error error;
+ mapper->importBuffer(
+ buffer->omxBuffer.nativeHandle,
+ [&](android::hardware::graphics::mapper::V2_0::Error _e, void* _n1) {
+ error = _e;
+ buff = _n1;
+ });
+ EXPECT_EQ(error, android::hardware::graphics::mapper::V2_0::Error::NONE);
+ if (error != android::hardware::graphics::mapper::V2_0::Error::NONE)
+ return 1;
+
+ if (colorFormatConversion(buffer, buff, format, eleStream)) return 1;
+
+ error = mapper->freeBuffer(buff);
+ EXPECT_EQ(error, android::hardware::graphics::mapper::V2_0::Error::NONE);
+ if (error != android::hardware::graphics::mapper::V2_0::Error::NONE)
+ return 1;
+
+ return 0;
+}
+
+int dispatchGraphicBuffer(sp<IOmxNode> omxNode,
+ sp<IGraphicBufferProducer> producer,
+ sp<CodecProducerListener> listener,
+ android::Vector<BufferInfo>* buffArray,
+ OMX_U32 portIndex, std::ifstream& eleStream,
+ uint64_t timestamp) {
+ android::hardware::media::omx::V1_0::Status status;
+ OMX_PARAM_PORTDEFINITIONTYPE portDef;
+
+ status = getPortParam(omxNode, OMX_IndexParamPortDefinition, portIndex,
+ &portDef);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ if (status != ::android::hardware::media::omx::V1_0::Status::OK) return 1;
+
+ enum {
+ // A flag returned by dequeueBuffer when the client needs to call
+ // requestBuffer immediately thereafter.
+ BUFFER_NEEDS_REALLOCATION = 0x1,
+ // A flag returned by dequeueBuffer when all mirrored slots should be
+ // released by the client. This flag should always be processed first.
+ RELEASE_ALL_BUFFERS = 0x2,
+ };
+
+ int32_t slot;
+ int32_t result;
+ ::android::hardware::hidl_handle fence;
+ IGraphicBufferProducer::FrameEventHistoryDelta outTimestamps;
+ ::android::hardware::media::V1_0::AnwBuffer AnwBuffer;
+ PixelFormat format = PixelFormat::YV12;
+ producer->dequeueBuffer(
+ portDef.format.video.nFrameWidth, portDef.format.video.nFrameHeight,
+ format, BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN,
+ true, [&](int32_t _s, int32_t const& _n1,
+ ::android::hardware::hidl_handle const& _n2,
+ IGraphicBufferProducer::FrameEventHistoryDelta const& _n3) {
+ result = _s;
+ slot = _n1;
+ fence = _n2;
+ outTimestamps = _n3;
+ });
+ if (result & BUFFER_NEEDS_REALLOCATION) {
+ producer->requestBuffer(
+ slot, [&](int32_t _s,
+ ::android::hardware::media::V1_0::AnwBuffer const& _n1) {
+ result = _s;
+ AnwBuffer = _n1;
+ });
+ EXPECT_EQ(result, 0);
+ if (result != 0) return 1;
+ size_t i;
+ for (i = 0; i < buffArray->size(); i++) {
+ if ((*buffArray)[i].slot == -1) {
+ buffArray->editItemAt(i).slot = slot;
+ buffArray->editItemAt(i).omxBuffer.nativeHandle =
+ AnwBuffer.nativeHandle;
+ buffArray->editItemAt(i).omxBuffer.attr.anwBuffer =
+ AnwBuffer.attr;
+ break;
+ }
+ }
+ EXPECT_NE(i, buffArray->size());
+ if (i == buffArray->size()) return 1;
+ }
+ EXPECT_EQ(result, 0);
+ if (result != 0) return 1;
+
+ // fill Buffer
+ BufferInfo buffer;
+ size_t i;
+ for (i = 0; i < buffArray->size(); i++) {
+ if ((*buffArray)[i].slot == slot) {
+ buffer = (*buffArray)[i];
+ break;
+ }
+ }
+ EXPECT_NE(i, buffArray->size());
+ if (i == buffArray->size()) return 1;
+ if (fillGraphicBuffer(&buffer, format, eleStream)) return 1;
+
+ // queue Buffer
+ IGraphicBufferProducer::QueueBufferOutput output;
+ IGraphicBufferProducer::QueueBufferInput input;
+ android::hardware::media::V1_0::Rect rect;
+ rect.left = 0;
+ rect.top = 0;
+ rect.right = buffer.omxBuffer.attr.anwBuffer.width;
+ rect.bottom = buffer.omxBuffer.attr.anwBuffer.height;
+ input.timestamp = timestamp;
+ input.isAutoTimestamp = false;
+ input.dataSpace =
+ android::hardware::graphics::common::V1_0::Dataspace::UNKNOWN;
+ input.crop = rect;
+ input.scalingMode = 0;
+ input.transform = 0;
+ input.stickyTransform = 0;
+ input.fence = android::hardware::hidl_handle();
+ input.surfaceDamage =
+ android::hardware::hidl_vec<android::hardware::media::V1_0::Rect>{rect};
+ input.getFrameTimestamps = false;
+ producer->queueBuffer(
+ buffer.slot, input,
+ [&](int32_t _s, const IGraphicBufferProducer::QueueBufferOutput& _n1) {
+ result = _s;
+ output = _n1;
+ });
+ EXPECT_EQ(result, 0);
+ if (result != 0) return 1;
+
+ listener->reduceCount();
+
+ return 0;
+}
+
// Encode N Frames
void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
- OMX_U32 portIndexOutput,
+ OMX_U32 portIndexInput, OMX_U32 portIndexOutput,
android::Vector<BufferInfo>* iBuffer,
android::Vector<BufferInfo>* oBuffer, uint32_t nFrames,
uint32_t xFramerate, int bytesCount,
- std::ifstream& eleStream) {
+ std::ifstream& eleStream,
+ ::android::List<uint64_t>* timestampUslist = nullptr,
+ bool signalEOS = true, bool inputDataIsMeta = false,
+ sp<IGraphicBufferProducer> producer = nullptr,
+ sp<CodecProducerListener> listener = nullptr) {
android::hardware::media::omx::V1_0::Status status;
Message msg;
uint32_t ipCount = 0;
@@ -398,20 +814,39 @@
}
// dispatch input buffers
int32_t timestampIncr = (int)((float)1000000 / (xFramerate >> 16));
+ // timestamp scale = Nano sec
+ if (inputDataIsMeta) timestampIncr *= 1000;
uint64_t timestamp = 0;
+ uint32_t flags = 0;
for (size_t i = 0; i < iBuffer->size() && nFrames != 0; i++) {
- char* ipBuffer = static_cast<char*>(
- static_cast<void*>((*iBuffer)[i].mMemory->getPointer()));
- ASSERT_LE(bytesCount,
- static_cast<int>((*iBuffer)[i].mMemory->getSize()));
- eleStream.read(ipBuffer, bytesCount);
- if (eleStream.gcount() != bytesCount) break;
- dispatchInputBuffer(omxNode, iBuffer, i, bytesCount, 0, timestamp);
- timestamp += timestampIncr;
- nFrames--;
- ipCount++;
+ if (inputDataIsMeta) {
+ if (listener->freeBuffers > listener->minUnDequeuedCount) {
+ if (dispatchGraphicBuffer(omxNode, producer, listener, iBuffer,
+ portIndexInput, eleStream, timestamp))
+ break;
+ timestamp += timestampIncr;
+ nFrames--;
+ ipCount++;
+ }
+ } else {
+ char* ipBuffer = static_cast<char*>(
+ static_cast<void*>((*iBuffer)[i].mMemory->getPointer()));
+ ASSERT_LE(bytesCount,
+ static_cast<int>((*iBuffer)[i].mMemory->getSize()));
+ eleStream.read(ipBuffer, bytesCount);
+ if (eleStream.gcount() != bytesCount) break;
+ if (signalEOS && (nFrames == 1)) flags = OMX_BUFFERFLAG_EOS;
+ dispatchInputBuffer(omxNode, iBuffer, i, bytesCount, flags,
+ timestamp);
+ if (timestampUslist) timestampUslist->push_back(timestamp);
+ timestamp += timestampIncr;
+ nFrames--;
+ ipCount++;
+ }
}
+ int timeOut = TIMEOUT_COUNTER;
+ bool stall = false;
while (1) {
status =
observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
@@ -422,6 +857,9 @@
ASSERT_EQ(msg.data.eventData.data1, portIndexOutput);
ASSERT_EQ(msg.data.eventData.data2,
OMX_IndexConfigAndroidIntraRefresh);
+ } else if (msg.data.eventData.event == OMX_EventError) {
+ EXPECT_TRUE(false) << "Received OMX_EventError, not sure why";
+ break;
} else {
ASSERT_TRUE(false);
}
@@ -431,21 +869,51 @@
// Dispatch input buffer
size_t index = 0;
- if ((index = getEmptyBufferID(iBuffer)) < iBuffer->size()) {
- char* ipBuffer = static_cast<char*>(
- static_cast<void*>((*iBuffer)[index].mMemory->getPointer()));
- ASSERT_LE(bytesCount,
- static_cast<int>((*iBuffer)[index].mMemory->getSize()));
- eleStream.read(ipBuffer, bytesCount);
- if (eleStream.gcount() != bytesCount) break;
- dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, 0,
- timestamp);
- timestamp += timestampIncr;
- nFrames--;
- ipCount++;
+ if (inputDataIsMeta) {
+ if (listener->freeBuffers > listener->minUnDequeuedCount) {
+ if (dispatchGraphicBuffer(omxNode, producer, listener, iBuffer,
+ portIndexInput, eleStream, timestamp))
+ break;
+ timestamp += timestampIncr;
+ nFrames--;
+ ipCount++;
+ stall = false;
+ } else {
+ stall = true;
+ }
+ } else {
+ if ((index = getEmptyBufferID(iBuffer)) < iBuffer->size()) {
+ char* ipBuffer = static_cast<char*>(static_cast<void*>(
+ (*iBuffer)[index].mMemory->getPointer()));
+ ASSERT_LE(
+ bytesCount,
+ static_cast<int>((*iBuffer)[index].mMemory->getSize()));
+ eleStream.read(ipBuffer, bytesCount);
+ if (eleStream.gcount() != bytesCount) break;
+ if (signalEOS && (nFrames == 1)) flags = OMX_BUFFERFLAG_EOS;
+ dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, flags,
+ timestamp);
+ if (timestampUslist) timestampUslist->push_back(timestamp);
+ timestamp += timestampIncr;
+ nFrames--;
+ ipCount++;
+ stall = false;
+ } else {
+ stall = true;
+ }
}
if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
dispatchOutputBuffer(omxNode, oBuffer, index);
+ stall = false;
+ } else
+ stall = true;
+ if (stall)
+ timeOut--;
+ else
+ timeOut = TIMEOUT_COUNTER;
+ if (timeOut == 0) {
+ EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite";
+ break;
}
if (ipCount == 15) {
changeBitrate(omxNode, portIndexOutput, 768000);
@@ -491,7 +959,7 @@
EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
}
-// test raw stream encode
+// test raw stream encode (input is byte buffers)
TEST_F(VideoEncHidlTest, EncodeTest) {
description("Test Encode");
if (disableTest) return;
@@ -511,8 +979,8 @@
GetURLForComponent(mURL);
std::ifstream eleStream;
- eleStream.open(mURL, std::ifstream::binary);
- ASSERT_EQ(eleStream.is_open(), true);
+
+ timestampDevTest = true;
// Configure input port
uint32_t nFrameWidth = 352;
@@ -526,6 +994,7 @@
setDefaultPortParam(omxNode, kPortIndexOutput, eCompressionFormat, nBitRate,
xFramerate);
setRefreshPeriod(omxNode, kPortIndexOutput, 0);
+
unsigned int index;
omxNode->getExtensionIndex(
"OMX.google.android.index.prependSPSPPSToIDRFrames",
@@ -542,24 +1011,299 @@
if (status != ::android::hardware::media::omx::V1_0::Status::OK)
std::cerr
<< "[ ] Warning ! unable to prependSPSPPSToIDRFrames\n";
+ else
+ prependSPSPPS = true;
+
+ // set port mode
+ PortMode portMode[2];
+ portMode[0] = portMode[1] = PortMode::PRESET_BYTE_BUFFER;
+ if (isSecure && prependSPSPPS) portMode[1] = PortMode::PRESET_SECURE_BUFFER;
+ status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
android::Vector<BufferInfo> iBuffer, oBuffer;
// set state to idle
changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
- kPortIndexInput, kPortIndexOutput);
+ kPortIndexInput, kPortIndexOutput, portMode);
// set state to executing
changeStateIdletoExecute(omxNode, observer);
- encodeNFrames(omxNode, observer, kPortIndexOutput, &iBuffer, &oBuffer, 1024,
- xFramerate, (nFrameWidth * nFrameHeight * 3) >> 1, eleStream);
+ eleStream.open(mURL, std::ifstream::binary);
+ ASSERT_EQ(eleStream.is_open(), true);
+ encodeNFrames(omxNode, observer, kPortIndexInput, kPortIndexOutput,
+ &iBuffer, &oBuffer, 32, xFramerate,
+ (nFrameWidth * nFrameHeight * 3) >> 1, eleStream,
+ ×tampUslist);
+ eleStream.close();
+ waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer);
+ testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag);
+ EXPECT_EQ(timestampUslist.empty(), true);
+
// set state to idle
changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
// set state to executing
changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
kPortIndexInput, kPortIndexOutput);
+}
+// test raw stream encode (input is ANW buffers)
+TEST_F(VideoEncHidlTest, EncodeTestBufferMetaModes) {
+ description("Test Encode Input buffer metamodes");
+ if (disableTest) return;
+ android::hardware::media::omx::V1_0::Status status;
+ uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
+ status = setRole(omxNode, gEnv->getRole().c_str());
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ OMX_PORT_PARAM_TYPE params;
+ status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
+ if (status == ::android::hardware::media::omx::V1_0::Status::OK) {
+ ASSERT_EQ(params.nPorts, 2U);
+ kPortIndexInput = params.nStartPortNumber;
+ kPortIndexOutput = kPortIndexInput + 1;
+ }
+
+ // Configure input port
+ uint32_t nFrameWidth = 352;
+ uint32_t nFrameHeight = 288;
+ uint32_t xFramerate = (30U << 16);
+ OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatAndroidOpaque;
+ setupRAWPort(omxNode, kPortIndexInput, nFrameWidth, nFrameHeight, 0,
+ xFramerate, eColorFormat);
+
+ // CreateInputSurface
+ EXPECT_TRUE(omx->createInputSurface(
+ [&](android::hardware::media::omx::V1_0::Status _s,
+ sp<IGraphicBufferProducer> const& _nl,
+ sp<IGraphicBufferSource> const& _n2) {
+ status = _s;
+ producer = _nl;
+ source = _n2;
+ })
+ .isOk());
+ ASSERT_NE(producer, nullptr);
+ ASSERT_NE(source, nullptr);
+
+ // Do setInputSurface()
+ // enable MetaMode on input port
+ status = source->configure(
+ omxNode, android::hardware::graphics::common::V1_0::Dataspace::UNKNOWN);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+
+ // setMaxDequeuedBufferCount
+ int32_t returnval;
+ int32_t value;
+ producer->query(NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS,
+ [&returnval, &value](int32_t _s, int32_t _n1) {
+ returnval = _s;
+ value = _n1;
+ });
+ ASSERT_EQ(returnval, 0);
+ OMX_PARAM_PORTDEFINITIONTYPE portDef;
+ status = getPortParam(omxNode, OMX_IndexParamPortDefinition,
+ kPortIndexInput, &portDef);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(::android::OK,
+ producer->setMaxDequeuedBufferCount(portDef.nBufferCountActual));
+
+ // Connect :: Mock Producer Listener
+ IGraphicBufferProducer::QueueBufferOutput qbo;
+ sp<CodecProducerListener> listener =
+ new CodecProducerListener(portDef.nBufferCountActual + value, value);
+ producer->connect(
+ listener, NATIVE_WINDOW_API_CPU, false,
+ [&](int32_t _s, IGraphicBufferProducer::QueueBufferOutput const& _n1) {
+ returnval = _s;
+ qbo = _n1;
+ });
+ ASSERT_EQ(returnval, 0);
+
+ portDef.nBufferCountActual = portDef.nBufferCountActual + value;
+ status = setPortParam(omxNode, OMX_IndexParamPortDefinition,
+ kPortIndexInput, &portDef);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+
+ // set port mode
+ PortMode portMode[2];
+ portMode[0] = PortMode::DYNAMIC_ANW_BUFFER;
+ portMode[1] = PortMode::PRESET_BYTE_BUFFER;
+ status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+
+ char mURL[512];
+ strcpy(mURL, gEnv->getRes().c_str());
+ GetURLForComponent(mURL);
+
+ std::ifstream eleStream;
+
+ status = source->setSuspend(false, 0);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = source->setRepeatPreviousFrameDelayUs(100000);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = source->setMaxFps(24.0f);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = source->setTimeLapseConfig(24.0, 24.0);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = source->setTimeOffsetUs(-100);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = source->setStartTimeUs(10);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = source->setStopTimeUs(1000000);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ ::android::hardware::media::omx::V1_0::ColorAspects aspects;
+ aspects.range =
+ ::android::hardware::media::omx::V1_0::ColorAspects::Range::UNSPECIFIED;
+ aspects.primaries = ::android::hardware::media::omx::V1_0::ColorAspects::
+ Primaries::UNSPECIFIED;
+ aspects.transfer = ::android::hardware::media::omx::V1_0::ColorAspects::
+ Transfer::UNSPECIFIED;
+ aspects.matrixCoeffs = ::android::hardware::media::omx::V1_0::ColorAspects::
+ MatrixCoeffs::UNSPECIFIED;
+ status = source->setColorAspects(aspects);
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ int64_t stopTimeOffsetUs;
+ source->getStopTimeOffsetUs(
+ [&](android::hardware::media::omx::V1_0::Status _s, int64_t _n1) {
+ status = _s;
+ stopTimeOffsetUs = _n1;
+ });
+ EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+
+ android::Vector<BufferInfo> iBuffer, oBuffer;
+ // set state to idle
+ changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput, portMode);
+ // set state to executing
+ changeStateIdletoExecute(omxNode, observer);
+
+ eleStream.open(mURL, std::ifstream::binary);
+ ASSERT_EQ(eleStream.is_open(), true);
+ encodeNFrames(omxNode, observer, kPortIndexInput, kPortIndexOutput,
+ &iBuffer, &oBuffer, 1024, xFramerate,
+ (nFrameWidth * nFrameHeight * 3) >> 1, eleStream, nullptr,
+ false, true, producer, listener);
eleStream.close();
+ waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, true,
+ listener);
+ testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag);
+
+ // set state to idle
+ changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
+ EXPECT_EQ(portDef.nBufferCountActual, listener->freeBuffers);
+ // set state to executing
+ changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput);
+
+ returnval = producer->disconnect(
+ NATIVE_WINDOW_API_CPU, IGraphicBufferProducer::DisconnectMode::API);
+ ASSERT_EQ(returnval, 0);
+}
+
+// Test end of stream
+TEST_F(VideoEncHidlTest, EncodeTestEOS) {
+ description("Test EOS");
+ if (disableTest) return;
+ android::hardware::media::omx::V1_0::Status status;
+ uint32_t kPortIndexInput = 0, kPortIndexOutput = 1;
+ status = setRole(omxNode, gEnv->getRole().c_str());
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ OMX_PORT_PARAM_TYPE params;
+ status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms);
+ if (status == ::android::hardware::media::omx::V1_0::Status::OK) {
+ ASSERT_EQ(params.nPorts, 2U);
+ kPortIndexInput = params.nStartPortNumber;
+ kPortIndexOutput = kPortIndexInput + 1;
+ }
+
+ // CreateInputSurface
+ EXPECT_TRUE(omx->createInputSurface(
+ [&](android::hardware::media::omx::V1_0::Status _s,
+ sp<IGraphicBufferProducer> const& _nl,
+ sp<IGraphicBufferSource> const& _n2) {
+ status = _s;
+ producer = _nl;
+ source = _n2;
+ })
+ .isOk());
+ ASSERT_NE(producer, nullptr);
+ ASSERT_NE(source, nullptr);
+
+ // Do setInputSurface()
+ // enable MetaMode on input port
+ status = source->configure(
+ omxNode, android::hardware::graphics::common::V1_0::Dataspace::UNKNOWN);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+
+ // setMaxDequeuedBufferCount
+ int32_t returnval;
+ int32_t value;
+ producer->query(NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS,
+ [&returnval, &value](int32_t _s, int32_t _n1) {
+ returnval = _s;
+ value = _n1;
+ });
+ ASSERT_EQ(returnval, 0);
+ OMX_PARAM_PORTDEFINITIONTYPE portDef;
+ status = getPortParam(omxNode, OMX_IndexParamPortDefinition,
+ kPortIndexInput, &portDef);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ ASSERT_EQ(::android::OK,
+ producer->setMaxDequeuedBufferCount(portDef.nBufferCountActual));
+
+ // Connect :: Mock Producer Listener
+ IGraphicBufferProducer::QueueBufferOutput qbo;
+ sp<CodecProducerListener> listener =
+ new CodecProducerListener(portDef.nBufferCountActual + value, value);
+ producer->connect(
+ listener, NATIVE_WINDOW_API_CPU, false,
+ [&](int32_t _s, IGraphicBufferProducer::QueueBufferOutput const& _n1) {
+ returnval = _s;
+ qbo = _n1;
+ });
+ ASSERT_EQ(returnval, 0);
+
+ portDef.nBufferCountActual = portDef.nBufferCountActual + value;
+ status = setPortParam(omxNode, OMX_IndexParamPortDefinition,
+ kPortIndexInput, &portDef);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+
+ // set port mode
+ PortMode portMode[2];
+ portMode[0] = PortMode::DYNAMIC_ANW_BUFFER;
+ portMode[1] = PortMode::PRESET_BYTE_BUFFER;
+ status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+
+ android::Vector<BufferInfo> iBuffer, oBuffer;
+ // set state to idle
+ changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput, portMode);
+ // set state to executing
+ changeStateIdletoExecute(omxNode, observer);
+
+ // send EOS
+ status = source->signalEndOfInputStream();
+ ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+ waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, true,
+ listener);
+ testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag);
+
+ // set state to idle
+ changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
+ EXPECT_EQ(portDef.nBufferCountActual, listener->freeBuffers);
+ // set state to executing
+ changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer,
+ kPortIndexInput, kPortIndexOutput);
+
+ returnval = producer->disconnect(
+ NATIVE_WINDOW_API_CPU, IGraphicBufferProducer::DisconnectMode::API);
+ ASSERT_EQ(returnval, 0);
}
int main(int argc, char** argv) {
diff --git a/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.cpp b/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.cpp
index 7035048..271b4d4 100644
--- a/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.cpp
+++ b/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.cpp
@@ -15,6 +15,11 @@
*/
#define LOG_TAG "media_omx_hidl_video_test_common"
+
+#ifdef __LP64__
+#define OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS
+#endif
+
#include <android-base/logging.h>
#include <android/hardware/media/omx/1.0/IOmx.h>
@@ -30,6 +35,7 @@
using ::android::hardware::media::omx::V1_0::IOmxNode;
using ::android::hardware::media::omx::V1_0::Message;
using ::android::hardware::media::omx::V1_0::CodecBuffer;
+using ::android::hardware::media::omx::V1_0::PortMode;
using ::android::hidl::allocator::V1_0::IAllocator;
using ::android::hidl::memory::V1_0::IMemory;
using ::android::hidl::memory::V1_0::IMapper;
@@ -41,281 +47,11 @@
#include <VtsHalHidlTargetTestBase.h>
#include <hidlmemory/mapping.h>
+#include <media/hardware/HardwareAPI.h>
#include <media_hidl_test_common.h>
#include <media_video_hidl_test_common.h>
#include <memory>
-// allocate buffers needed on a component port
-void allocatePortBuffers(sp<IOmxNode> omxNode,
- android::Vector<BufferInfo>* buffArray,
- OMX_U32 portIndex) {
- android::hardware::media::omx::V1_0::Status status;
- OMX_PARAM_PORTDEFINITIONTYPE portDef;
-
- buffArray->clear();
-
- sp<IAllocator> allocator = IAllocator::getService("ashmem");
- EXPECT_NE(allocator.get(), nullptr);
-
- status = getPortParam(omxNode, OMX_IndexParamPortDefinition, portIndex,
- &portDef);
- ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
-
- for (size_t i = 0; i < portDef.nBufferCountActual; i++) {
- BufferInfo buffer;
- buffer.owner = client;
- buffer.omxBuffer.type = CodecBuffer::Type::SHARED_MEM;
- buffer.omxBuffer.attr.preset.rangeOffset = 0;
- buffer.omxBuffer.attr.preset.rangeLength = 0;
- bool success = false;
- allocator->allocate(
- portDef.nBufferSize,
- [&success, &buffer](bool _s,
- ::android::hardware::hidl_memory const& mem) {
- success = _s;
- buffer.omxBuffer.sharedMemory = mem;
- });
- ASSERT_EQ(success, true);
- ASSERT_EQ(buffer.omxBuffer.sharedMemory.size(), portDef.nBufferSize);
- buffer.mMemory = mapMemory(buffer.omxBuffer.sharedMemory);
- ASSERT_NE(buffer.mMemory, nullptr);
- omxNode->useBuffer(
- portIndex, buffer.omxBuffer,
- [&status, &buffer](android::hardware::media::omx::V1_0::Status _s,
- uint32_t id) {
- status = _s;
- buffer.id = id;
- });
- buffArray->push(buffer);
- ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
- }
-}
-
-// State Transition : Loaded -> Idle
-// Note: This function does not make any background checks for this transition.
-// The callee holds the reponsibility to ensure the legality of the transition.
-void changeStateLoadedtoIdle(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
- android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer,
- OMX_U32 kPortIndexInput,
- OMX_U32 kPortIndexOutput) {
- android::hardware::media::omx::V1_0::Status status;
- Message msg;
-
- // set state to idle
- status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
- OMX_StateIdle);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
-
- // Dont switch states until the ports are populated
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
-
- // allocate buffers on input port
- allocatePortBuffers(omxNode, iBuffer, kPortIndexInput);
-
- // Dont switch states until the ports are populated
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
-
- // allocate buffers on output port
- allocatePortBuffers(omxNode, oBuffer, kPortIndexOutput);
-
- // As the ports are populated, check if the state transition is complete
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- ASSERT_EQ(msg.type, Message::Type::EVENT);
- ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
- ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
- ASSERT_EQ(msg.data.eventData.data2, OMX_StateIdle);
-
- return;
-}
-
-// State Transition : Idle -> Loaded
-// Note: This function does not make any background checks for this transition.
-// The callee holds the reponsibility to ensure the legality of the transition.
-void changeStateIdletoLoaded(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
- android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer,
- OMX_U32 kPortIndexInput,
- OMX_U32 kPortIndexOutput) {
- android::hardware::media::omx::V1_0::Status status;
- Message msg;
-
- // set state to Loaded
- status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
- OMX_StateLoaded);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
-
- // dont change state until all buffers are freed
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
-
- for (size_t i = 0; i < iBuffer->size(); ++i) {
- status = omxNode->freeBuffer(kPortIndexInput, (*iBuffer)[i].id);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- }
-
- // dont change state until all buffers are freed
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
-
- for (size_t i = 0; i < oBuffer->size(); ++i) {
- status = omxNode->freeBuffer(kPortIndexOutput, (*oBuffer)[i].id);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- }
-
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- ASSERT_EQ(msg.type, Message::Type::EVENT);
- ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
- ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
- ASSERT_EQ(msg.data.eventData.data2, OMX_StateLoaded);
-
- return;
-}
-
-// State Transition : Idle -> Execute
-// Note: This function does not make any background checks for this transition.
-// The callee holds the reponsibility to ensure the legality of the transition.
-void changeStateIdletoExecute(sp<IOmxNode> omxNode,
- sp<CodecObserver> observer) {
- android::hardware::media::omx::V1_0::Status status;
- Message msg;
-
- // set state to execute
- status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
- OMX_StateExecuting);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- ASSERT_EQ(msg.type, Message::Type::EVENT);
- ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
- ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
- ASSERT_EQ(msg.data.eventData.data2, OMX_StateExecuting);
-
- return;
-}
-
-// State Transition : Execute -> Idle
-// Note: This function does not make any background checks for this transition.
-// The callee holds the reponsibility to ensure the legality of the transition.
-void changeStateExecutetoIdle(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
- android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer) {
- android::hardware::media::omx::V1_0::Status status;
- Message msg;
-
- // set state to Idle
- status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
- OMX_StateIdle);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- ASSERT_EQ(msg.type, Message::Type::EVENT);
- ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
- ASSERT_EQ(msg.data.eventData.data1, OMX_CommandStateSet);
- ASSERT_EQ(msg.data.eventData.data2, OMX_StateIdle);
-
- // test if client got all its buffers back
- for (size_t i = 0; i < oBuffer->size(); ++i) {
- EXPECT_EQ((*oBuffer)[i].owner, client);
- }
- for (size_t i = 0; i < iBuffer->size(); ++i) {
- EXPECT_EQ((*iBuffer)[i].owner, client);
- }
-}
-
-// get empty buffer index
-size_t getEmptyBufferID(android::Vector<BufferInfo>* buffArray) {
- for (size_t i = 0; i < buffArray->size(); i++) {
- if ((*buffArray)[i].owner == client) return i;
- }
- return buffArray->size();
-}
-
-// dispatch buffer to output port
-void dispatchOutputBuffer(sp<IOmxNode> omxNode,
- android::Vector<BufferInfo>* buffArray,
- size_t bufferIndex) {
- android::hardware::media::omx::V1_0::Status status;
- CodecBuffer t;
- t.sharedMemory = android::hardware::hidl_memory();
- t.nativeHandle = android::hardware::hidl_handle();
- t.type = CodecBuffer::Type::PRESET;
- t.attr.preset.rangeOffset = 0;
- t.attr.preset.rangeLength = 0;
- native_handle_t* fenceNh = native_handle_create(0, 0);
- ASSERT_NE(fenceNh, nullptr);
- status = omxNode->fillBuffer((*buffArray)[bufferIndex].id, t, fenceNh);
- native_handle_close(fenceNh);
- native_handle_delete(fenceNh);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- buffArray->editItemAt(bufferIndex).owner = component;
-}
-
-// dispatch buffer to input port
-void dispatchInputBuffer(sp<IOmxNode> omxNode,
- android::Vector<BufferInfo>* buffArray,
- size_t bufferIndex, int bytesCount, uint32_t flags,
- uint64_t timestamp) {
- android::hardware::media::omx::V1_0::Status status;
- CodecBuffer t;
- t.sharedMemory = android::hardware::hidl_memory();
- t.nativeHandle = android::hardware::hidl_handle();
- t.type = CodecBuffer::Type::PRESET;
- t.attr.preset.rangeOffset = 0;
- t.attr.preset.rangeLength = bytesCount;
- native_handle_t* fenceNh = native_handle_create(0, 0);
- ASSERT_NE(fenceNh, nullptr);
- status = omxNode->emptyBuffer((*buffArray)[bufferIndex].id, t, flags,
- timestamp, fenceNh);
- native_handle_close(fenceNh);
- native_handle_delete(fenceNh);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- buffArray->editItemAt(bufferIndex).owner = component;
-}
-
-// Flush input and output ports
-void flushPorts(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
- android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer, OMX_U32 kPortIndexInput,
- OMX_U32 kPortIndexOutput, int64_t timeoutUs) {
- android::hardware::media::omx::V1_0::Status status;
- Message msg;
-
- // Flush input port
- status = omxNode->sendCommand(toRawCommandType(OMX_CommandFlush),
- kPortIndexInput);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- status = observer->dequeueMessage(&msg, timeoutUs, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- ASSERT_EQ(msg.type, Message::Type::EVENT);
- ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
- ASSERT_EQ(msg.data.eventData.data1, OMX_CommandFlush);
- ASSERT_EQ(msg.data.eventData.data2, kPortIndexInput);
- // test if client got all its buffers back
- for (size_t i = 0; i < iBuffer->size(); ++i) {
- EXPECT_EQ((*iBuffer)[i].owner, client);
- }
-
- // Flush output port
- status = omxNode->sendCommand(toRawCommandType(OMX_CommandFlush),
- kPortIndexOutput);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- status = observer->dequeueMessage(&msg, timeoutUs, iBuffer, oBuffer);
- ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
- ASSERT_EQ(msg.type, Message::Type::EVENT);
- ASSERT_EQ(msg.data.eventData.event, OMX_EventCmdComplete);
- ASSERT_EQ(msg.data.eventData.data1, OMX_CommandFlush);
- ASSERT_EQ(msg.data.eventData.data2, kPortIndexOutput);
- // test if client got all its buffers back
- for (size_t i = 0; i < oBuffer->size(); ++i) {
- EXPECT_EQ((*oBuffer)[i].owner, client);
- }
-}
-
Return<android::hardware::media::omx::V1_0::Status> setVideoPortFormat(
sp<IOmxNode> omxNode, OMX_U32 portIndex,
OMX_VIDEO_CODINGTYPE eCompressionFormat, OMX_COLOR_FORMATTYPE eColorFormat,
diff --git a/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.h b/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.h
index 00f9afe..ce4272c 100644
--- a/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.h
+++ b/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.h
@@ -25,41 +25,6 @@
/*
* Common video utils
*/
-void allocatePortBuffers(sp<IOmxNode> omxNode,
- android::Vector<BufferInfo>* buffArray,
- OMX_U32 portIndex);
-
-void changeStateLoadedtoIdle(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
- android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer,
- OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput);
-
-void changeStateIdletoLoaded(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
- android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer,
- OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput);
-
-void changeStateIdletoExecute(sp<IOmxNode> omxNode, sp<CodecObserver> observer);
-
-void changeStateExecutetoIdle(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
- android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer);
-
-size_t getEmptyBufferID(android::Vector<BufferInfo>* buffArray);
-
-void dispatchOutputBuffer(sp<IOmxNode> omxNode,
- android::Vector<BufferInfo>* buffArray,
- size_t bufferIndex);
-
-void dispatchInputBuffer(sp<IOmxNode> omxNode,
- android::Vector<BufferInfo>* buffArray,
- size_t bufferIndex, int bytesCount, uint32_t flags,
- uint64_t timestamp);
-
-void flushPorts(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
- android::Vector<BufferInfo>* iBuffer,
- android::Vector<BufferInfo>* oBuffer, OMX_U32 kPortIndexInput,
- OMX_U32 kPortIndexOutput, int64_t timeoutUs = DEFAULT_TIMEOUT);
Return<android::hardware::media::omx::V1_0::Status> setVideoPortFormat(
sp<IOmxNode> omxNode, OMX_U32 portIndex,
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
index 65b055c..eac35f7 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
@@ -143,15 +143,17 @@
radio->getAvailableNetworks(++serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+ ASSERT_TRUE(radioRsp->rspInfo.type == RadioResponseType::SOLICITED ||
+ radioRsp->rspInfo.type == RadioResponseType::SOLICITED_ACK_EXP);
if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(CheckGeneralError() ||
- radioRsp->rspInfo.error == RadioError::NONE ||
- radioRsp->rspInfo.error == RadioError::DEVICE_IN_USE ||
- radioRsp->rspInfo.error == RadioError::CANCELLED ||
- radioRsp->rspInfo.error == RadioError::OPERATION_NOT_ALLOWED);
+ ASSERT_TRUE(
+ CheckGeneralError() || radioRsp->rspInfo.error == RadioError::NONE ||
+ radioRsp->rspInfo.error == RadioError::DEVICE_IN_USE ||
+ radioRsp->rspInfo.error == RadioError::CANCELLED ||
+ radioRsp->rspInfo.error == RadioError::OPERATION_NOT_ALLOWED ||
+ radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_utils.h b/radio/1.0/vts/functional/radio_hidl_hal_utils.h
index 735e575..923e1e3 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_utils.h
+++ b/radio/1.0/vts/functional/radio_hidl_hal_utils.h
@@ -80,7 +80,7 @@
using ::android::hardware::Void;
using ::android::sp;
-#define TIMEOUT_PERIOD 40
+#define TIMEOUT_PERIOD 65
#define RADIO_SERVICE_NAME "slot1"
class RadioHidlTest;
diff --git a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp
index f505d01..2670b8d 100644
--- a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp
+++ b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp
@@ -28,6 +28,7 @@
}
void RenderscriptHidlTest::TearDown() {
+ context->contextFinish();
context->contextDestroy();
}
diff --git a/tests/Android.bp b/tests/Android.bp
index 6f99a36..ddf300b 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -15,6 +15,7 @@
"inheritance/1.0/default",
"libhwbinder/1.0",
"libhwbinder/1.0/default",
+ "libhwbinder/aidl",
"memory/1.0",
"memory/1.0/default",
"msgq/1.0",
@@ -22,8 +23,4 @@
"pointer/1.0",
"pointer/1.0/default",
"pointer/1.0/default/lib",
- "versioning/1.0",
- "versioning/2.2",
- "versioning/2.3",
- "versioning/2.4",
]
diff --git a/tests/libhwbinder/aidl/Android.bp b/tests/libhwbinder/aidl/Android.bp
new file mode 100644
index 0000000..a662085
--- /dev/null
+++ b/tests/libhwbinder/aidl/Android.bp
@@ -0,0 +1,15 @@
+cc_library_shared {
+ name: "android.hardware.tests.libbinder",
+
+ srcs: ["android/tests/binder/IBenchmark.aidl"],
+
+ aidl: {
+ export_aidl_headers: true,
+ },
+
+ shared_libs: [
+ "libbinder",
+ "libutils",
+ ],
+
+}
diff --git a/tests/libhwbinder/aidl/Android.mk b/tests/libhwbinder/aidl/Android.mk
deleted file mode 100644
index 1c175d8..0000000
--- a/tests/libhwbinder/aidl/Android.mk
+++ /dev/null
@@ -1,13 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.libbinder
-LOCAL_MODULE_CLASS := SHARED_LIBRARIES
-
-LOCAL_SRC_FILES := android/tests/binder/IBenchmark.aidl
-
-LOCAL_SHARED_LIBRARIES := \
- libbinder \
- libutils \
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/versioning/1.0/Android.bp b/tests/versioning/1.0/Android.bp
deleted file mode 100644
index 647e043..0000000
--- a/tests/versioning/1.0/Android.bp
+++ /dev/null
@@ -1,59 +0,0 @@
-// This file is autogenerated by hidl-gen. Do not edit manually.
-
-filegroup {
- name: "android.hardware.tests.versioning@1.0_hal",
- srcs: [
- "IFoo.hal",
- ],
-}
-
-genrule {
- name: "android.hardware.tests.versioning@1.0_genc++",
- tools: ["hidl-gen"],
- cmd: "$(location hidl-gen) -o $(genDir) -Lc++-sources -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tests.versioning@1.0",
- srcs: [
- ":android.hardware.tests.versioning@1.0_hal",
- ],
- out: [
- "android/hardware/tests/versioning/1.0/FooAll.cpp",
- ],
-}
-
-genrule {
- name: "android.hardware.tests.versioning@1.0_genc++_headers",
- tools: ["hidl-gen"],
- cmd: "$(location hidl-gen) -o $(genDir) -Lc++-headers -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tests.versioning@1.0",
- srcs: [
- ":android.hardware.tests.versioning@1.0_hal",
- ],
- out: [
- "android/hardware/tests/versioning/1.0/IFoo.h",
- "android/hardware/tests/versioning/1.0/IHwFoo.h",
- "android/hardware/tests/versioning/1.0/BnHwFoo.h",
- "android/hardware/tests/versioning/1.0/BpHwFoo.h",
- "android/hardware/tests/versioning/1.0/BsFoo.h",
- ],
-}
-
-cc_library_shared {
- name: "android.hardware.tests.versioning@1.0",
- defaults: ["hidl-module-defaults"],
- generated_sources: ["android.hardware.tests.versioning@1.0_genc++"],
- generated_headers: ["android.hardware.tests.versioning@1.0_genc++_headers"],
- export_generated_headers: ["android.hardware.tests.versioning@1.0_genc++_headers"],
- vendor_available: true,
- shared_libs: [
- "libhidlbase",
- "libhidltransport",
- "libhwbinder",
- "liblog",
- "libutils",
- "libcutils",
- ],
- export_shared_lib_headers: [
- "libhidlbase",
- "libhidltransport",
- "libhwbinder",
- "libutils",
- ],
-}
diff --git a/tests/versioning/1.0/Android.mk b/tests/versioning/1.0/Android.mk
deleted file mode 100644
index 81ffd08..0000000
--- a/tests/versioning/1.0/Android.mk
+++ /dev/null
@@ -1,76 +0,0 @@
-# This file is autogenerated by hidl-gen. Do not edit manually.
-
-LOCAL_PATH := $(call my-dir)
-
-################################################################################
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.versioning-V1.0-java
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-
-intermediates := $(call local-generated-sources-dir, COMMON)
-
-HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
-
-LOCAL_JAVA_LIBRARIES := \
- android.hidl.base-V1.0-java \
-
-
-#
-# Build IFoo.hal
-#
-GEN := $(intermediates)/android/hardware/tests/versioning/V1_0/IFoo.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IFoo.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
- $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
- -Ljava \
- -randroid.hardware:hardware/interfaces \
- -randroid.hidl:system/libhidl/transport \
- android.hardware.tests.versioning@1.0::IFoo
-
-$(GEN): $(LOCAL_PATH)/IFoo.hal
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-include $(BUILD_JAVA_LIBRARY)
-
-
-################################################################################
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.versioning-V1.0-java-static
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-
-intermediates := $(call local-generated-sources-dir, COMMON)
-
-HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base-V1.0-java-static \
-
-
-#
-# Build IFoo.hal
-#
-GEN := $(intermediates)/android/hardware/tests/versioning/V1_0/IFoo.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IFoo.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
- $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
- -Ljava \
- -randroid.hardware:hardware/interfaces \
- -randroid.hidl:system/libhidl/transport \
- android.hardware.tests.versioning@1.0::IFoo
-
-$(GEN): $(LOCAL_PATH)/IFoo.hal
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/versioning/1.0/IFoo.hal b/tests/versioning/1.0/IFoo.hal
deleted file mode 100644
index 0571eff..0000000
--- a/tests/versioning/1.0/IFoo.hal
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-package android.hardware.tests.versioning@1.0;
-
-interface IFoo {
-};
diff --git a/tests/versioning/2.2/Android.bp b/tests/versioning/2.2/Android.bp
deleted file mode 100644
index 3a4a003..0000000
--- a/tests/versioning/2.2/Android.bp
+++ /dev/null
@@ -1,66 +0,0 @@
-// This file is autogenerated by hidl-gen. Do not edit manually.
-
-filegroup {
- name: "android.hardware.tests.versioning@2.2_hal",
- srcs: [
- "IBar.hal",
- "IFoo.hal",
- ],
-}
-
-genrule {
- name: "android.hardware.tests.versioning@2.2_genc++",
- tools: ["hidl-gen"],
- cmd: "$(location hidl-gen) -o $(genDir) -Lc++-sources -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tests.versioning@2.2",
- srcs: [
- ":android.hardware.tests.versioning@2.2_hal",
- ],
- out: [
- "android/hardware/tests/versioning/2.2/BarAll.cpp",
- "android/hardware/tests/versioning/2.2/FooAll.cpp",
- ],
-}
-
-genrule {
- name: "android.hardware.tests.versioning@2.2_genc++_headers",
- tools: ["hidl-gen"],
- cmd: "$(location hidl-gen) -o $(genDir) -Lc++-headers -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tests.versioning@2.2",
- srcs: [
- ":android.hardware.tests.versioning@2.2_hal",
- ],
- out: [
- "android/hardware/tests/versioning/2.2/IBar.h",
- "android/hardware/tests/versioning/2.2/IHwBar.h",
- "android/hardware/tests/versioning/2.2/BnHwBar.h",
- "android/hardware/tests/versioning/2.2/BpHwBar.h",
- "android/hardware/tests/versioning/2.2/BsBar.h",
- "android/hardware/tests/versioning/2.2/IFoo.h",
- "android/hardware/tests/versioning/2.2/IHwFoo.h",
- "android/hardware/tests/versioning/2.2/BnHwFoo.h",
- "android/hardware/tests/versioning/2.2/BpHwFoo.h",
- "android/hardware/tests/versioning/2.2/BsFoo.h",
- ],
-}
-
-cc_library_shared {
- name: "android.hardware.tests.versioning@2.2",
- defaults: ["hidl-module-defaults"],
- generated_sources: ["android.hardware.tests.versioning@2.2_genc++"],
- generated_headers: ["android.hardware.tests.versioning@2.2_genc++_headers"],
- export_generated_headers: ["android.hardware.tests.versioning@2.2_genc++_headers"],
- vendor_available: true,
- shared_libs: [
- "libhidlbase",
- "libhidltransport",
- "libhwbinder",
- "liblog",
- "libutils",
- "libcutils",
- ],
- export_shared_lib_headers: [
- "libhidlbase",
- "libhidltransport",
- "libhwbinder",
- "libutils",
- ],
-}
diff --git a/tests/versioning/2.2/Android.mk b/tests/versioning/2.2/Android.mk
deleted file mode 100644
index 4fccce6..0000000
--- a/tests/versioning/2.2/Android.mk
+++ /dev/null
@@ -1,114 +0,0 @@
-# This file is autogenerated by hidl-gen. Do not edit manually.
-
-LOCAL_PATH := $(call my-dir)
-
-################################################################################
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.versioning-V2.2-java
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-
-intermediates := $(call local-generated-sources-dir, COMMON)
-
-HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
-
-LOCAL_JAVA_LIBRARIES := \
- android.hidl.base-V1.0-java \
-
-
-#
-# Build IBar.hal
-#
-GEN := $(intermediates)/android/hardware/tests/versioning/V2_2/IBar.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IBar.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
- $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
- -Ljava \
- -randroid.hardware:hardware/interfaces \
- -randroid.hidl:system/libhidl/transport \
- android.hardware.tests.versioning@2.2::IBar
-
-$(GEN): $(LOCAL_PATH)/IBar.hal
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build IFoo.hal
-#
-GEN := $(intermediates)/android/hardware/tests/versioning/V2_2/IFoo.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IFoo.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
- $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
- -Ljava \
- -randroid.hardware:hardware/interfaces \
- -randroid.hidl:system/libhidl/transport \
- android.hardware.tests.versioning@2.2::IFoo
-
-$(GEN): $(LOCAL_PATH)/IFoo.hal
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-include $(BUILD_JAVA_LIBRARY)
-
-
-################################################################################
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.versioning-V2.2-java-static
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-
-intermediates := $(call local-generated-sources-dir, COMMON)
-
-HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hidl.base-V1.0-java-static \
-
-
-#
-# Build IBar.hal
-#
-GEN := $(intermediates)/android/hardware/tests/versioning/V2_2/IBar.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IBar.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
- $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
- -Ljava \
- -randroid.hardware:hardware/interfaces \
- -randroid.hidl:system/libhidl/transport \
- android.hardware.tests.versioning@2.2::IBar
-
-$(GEN): $(LOCAL_PATH)/IBar.hal
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build IFoo.hal
-#
-GEN := $(intermediates)/android/hardware/tests/versioning/V2_2/IFoo.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IFoo.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
- $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
- -Ljava \
- -randroid.hardware:hardware/interfaces \
- -randroid.hidl:system/libhidl/transport \
- android.hardware.tests.versioning@2.2::IFoo
-
-$(GEN): $(LOCAL_PATH)/IFoo.hal
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/versioning/2.2/IBar.hal b/tests/versioning/2.2/IBar.hal
deleted file mode 100644
index e28ce19..0000000
--- a/tests/versioning/2.2/IBar.hal
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.
- */
-
-package android.hardware.tests.versioning@2.2;
-
-interface IBar {
-
-};
diff --git a/tests/versioning/2.2/IFoo.hal b/tests/versioning/2.2/IFoo.hal
deleted file mode 100644
index d6b8782..0000000
--- a/tests/versioning/2.2/IFoo.hal
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.
- */
-
-package android.hardware.tests.versioning@2.2;
-
-interface IFoo {
-
-};
diff --git a/tests/versioning/2.3/Android.bp b/tests/versioning/2.3/Android.bp
deleted file mode 100644
index 65e1193..0000000
--- a/tests/versioning/2.3/Android.bp
+++ /dev/null
@@ -1,77 +0,0 @@
-// This file is autogenerated by hidl-gen. Do not edit manually.
-
-filegroup {
- name: "android.hardware.tests.versioning@2.3_hal",
- srcs: [
- "IBar.hal",
- "IBaz.hal",
- "IFoo.hal",
- ],
-}
-
-genrule {
- name: "android.hardware.tests.versioning@2.3_genc++",
- tools: ["hidl-gen"],
- cmd: "$(location hidl-gen) -o $(genDir) -Lc++-sources -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tests.versioning@2.3",
- srcs: [
- ":android.hardware.tests.versioning@2.3_hal",
- ],
- out: [
- "android/hardware/tests/versioning/2.3/BarAll.cpp",
- "android/hardware/tests/versioning/2.3/BazAll.cpp",
- "android/hardware/tests/versioning/2.3/FooAll.cpp",
- ],
-}
-
-genrule {
- name: "android.hardware.tests.versioning@2.3_genc++_headers",
- tools: ["hidl-gen"],
- cmd: "$(location hidl-gen) -o $(genDir) -Lc++-headers -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tests.versioning@2.3",
- srcs: [
- ":android.hardware.tests.versioning@2.3_hal",
- ],
- out: [
- "android/hardware/tests/versioning/2.3/IBar.h",
- "android/hardware/tests/versioning/2.3/IHwBar.h",
- "android/hardware/tests/versioning/2.3/BnHwBar.h",
- "android/hardware/tests/versioning/2.3/BpHwBar.h",
- "android/hardware/tests/versioning/2.3/BsBar.h",
- "android/hardware/tests/versioning/2.3/IBaz.h",
- "android/hardware/tests/versioning/2.3/IHwBaz.h",
- "android/hardware/tests/versioning/2.3/BnHwBaz.h",
- "android/hardware/tests/versioning/2.3/BpHwBaz.h",
- "android/hardware/tests/versioning/2.3/BsBaz.h",
- "android/hardware/tests/versioning/2.3/IFoo.h",
- "android/hardware/tests/versioning/2.3/IHwFoo.h",
- "android/hardware/tests/versioning/2.3/BnHwFoo.h",
- "android/hardware/tests/versioning/2.3/BpHwFoo.h",
- "android/hardware/tests/versioning/2.3/BsFoo.h",
- ],
-}
-
-cc_library_shared {
- name: "android.hardware.tests.versioning@2.3",
- defaults: ["hidl-module-defaults"],
- generated_sources: ["android.hardware.tests.versioning@2.3_genc++"],
- generated_headers: ["android.hardware.tests.versioning@2.3_genc++_headers"],
- export_generated_headers: ["android.hardware.tests.versioning@2.3_genc++_headers"],
- vendor_available: true,
- shared_libs: [
- "libhidlbase",
- "libhidltransport",
- "libhwbinder",
- "liblog",
- "libutils",
- "libcutils",
- "android.hardware.tests.versioning@1.0",
- "android.hardware.tests.versioning@2.2",
- ],
- export_shared_lib_headers: [
- "libhidlbase",
- "libhidltransport",
- "libhwbinder",
- "libutils",
- "android.hardware.tests.versioning@1.0",
- "android.hardware.tests.versioning@2.2",
- ],
-}
diff --git a/tests/versioning/2.3/Android.mk b/tests/versioning/2.3/Android.mk
deleted file mode 100644
index 36326d6..0000000
--- a/tests/versioning/2.3/Android.mk
+++ /dev/null
@@ -1,156 +0,0 @@
-# This file is autogenerated by hidl-gen. Do not edit manually.
-
-LOCAL_PATH := $(call my-dir)
-
-################################################################################
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.versioning-V2.3-java
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-
-intermediates := $(call local-generated-sources-dir, COMMON)
-
-HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
-
-LOCAL_JAVA_LIBRARIES := \
- android.hardware.tests.versioning-V1.0-java \
- android.hardware.tests.versioning-V2.2-java \
- android.hidl.base-V1.0-java \
-
-
-#
-# Build IBar.hal
-#
-GEN := $(intermediates)/android/hardware/tests/versioning/V2_3/IBar.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IBar.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
- $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
- -Ljava \
- -randroid.hardware:hardware/interfaces \
- -randroid.hidl:system/libhidl/transport \
- android.hardware.tests.versioning@2.3::IBar
-
-$(GEN): $(LOCAL_PATH)/IBar.hal
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build IBaz.hal
-#
-GEN := $(intermediates)/android/hardware/tests/versioning/V2_3/IBaz.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IBaz.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
- $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
- -Ljava \
- -randroid.hardware:hardware/interfaces \
- -randroid.hidl:system/libhidl/transport \
- android.hardware.tests.versioning@2.3::IBaz
-
-$(GEN): $(LOCAL_PATH)/IBaz.hal
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build IFoo.hal
-#
-GEN := $(intermediates)/android/hardware/tests/versioning/V2_3/IFoo.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IFoo.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
- $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
- -Ljava \
- -randroid.hardware:hardware/interfaces \
- -randroid.hidl:system/libhidl/transport \
- android.hardware.tests.versioning@2.3::IFoo
-
-$(GEN): $(LOCAL_PATH)/IFoo.hal
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-include $(BUILD_JAVA_LIBRARY)
-
-
-################################################################################
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.versioning-V2.3-java-static
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-
-intermediates := $(call local-generated-sources-dir, COMMON)
-
-HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hardware.tests.versioning-V1.0-java-static \
- android.hardware.tests.versioning-V2.2-java-static \
- android.hidl.base-V1.0-java-static \
-
-
-#
-# Build IBar.hal
-#
-GEN := $(intermediates)/android/hardware/tests/versioning/V2_3/IBar.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IBar.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
- $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
- -Ljava \
- -randroid.hardware:hardware/interfaces \
- -randroid.hidl:system/libhidl/transport \
- android.hardware.tests.versioning@2.3::IBar
-
-$(GEN): $(LOCAL_PATH)/IBar.hal
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build IBaz.hal
-#
-GEN := $(intermediates)/android/hardware/tests/versioning/V2_3/IBaz.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IBaz.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
- $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
- -Ljava \
- -randroid.hardware:hardware/interfaces \
- -randroid.hidl:system/libhidl/transport \
- android.hardware.tests.versioning@2.3::IBaz
-
-$(GEN): $(LOCAL_PATH)/IBaz.hal
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build IFoo.hal
-#
-GEN := $(intermediates)/android/hardware/tests/versioning/V2_3/IFoo.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IFoo.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
- $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
- -Ljava \
- -randroid.hardware:hardware/interfaces \
- -randroid.hidl:system/libhidl/transport \
- android.hardware.tests.versioning@2.3::IFoo
-
-$(GEN): $(LOCAL_PATH)/IFoo.hal
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/versioning/2.3/IBar.hal b/tests/versioning/2.3/IBar.hal
deleted file mode 100644
index fe38e76..0000000
--- a/tests/versioning/2.3/IBar.hal
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-
-package android.hardware.tests.versioning@2.3;
-
-import @2.2::IBar;
-
-// Must extend @2.2::IBar.
-interface IBar extends @2.2::IBar {
-
-};
diff --git a/tests/versioning/2.3/IBaz.hal b/tests/versioning/2.3/IBaz.hal
deleted file mode 100644
index e28792c..0000000
--- a/tests/versioning/2.3/IBaz.hal
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.
- */
-
-package android.hardware.tests.versioning@2.3;
-
-import @1.0::IFoo;
-
-interface IBaz extends @1.0::IFoo {
-
-};
diff --git a/tests/versioning/2.3/IFoo.hal b/tests/versioning/2.3/IFoo.hal
deleted file mode 100644
index 2c76500..0000000
--- a/tests/versioning/2.3/IFoo.hal
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-
-package android.hardware.tests.versioning@2.3;
-
-import @2.2::IFoo;
-
-// Must extend @2.2::IFoo.
-interface IFoo extends @2.2::IFoo {
-
-};
diff --git a/tests/versioning/2.4/Android.bp b/tests/versioning/2.4/Android.bp
deleted file mode 100644
index d236a18..0000000
--- a/tests/versioning/2.4/Android.bp
+++ /dev/null
@@ -1,63 +0,0 @@
-// This file is autogenerated by hidl-gen. Do not edit manually.
-
-filegroup {
- name: "android.hardware.tests.versioning@2.4_hal",
- srcs: [
- "IFoo.hal",
- ],
-}
-
-genrule {
- name: "android.hardware.tests.versioning@2.4_genc++",
- tools: ["hidl-gen"],
- cmd: "$(location hidl-gen) -o $(genDir) -Lc++-sources -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tests.versioning@2.4",
- srcs: [
- ":android.hardware.tests.versioning@2.4_hal",
- ],
- out: [
- "android/hardware/tests/versioning/2.4/FooAll.cpp",
- ],
-}
-
-genrule {
- name: "android.hardware.tests.versioning@2.4_genc++_headers",
- tools: ["hidl-gen"],
- cmd: "$(location hidl-gen) -o $(genDir) -Lc++-headers -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tests.versioning@2.4",
- srcs: [
- ":android.hardware.tests.versioning@2.4_hal",
- ],
- out: [
- "android/hardware/tests/versioning/2.4/IFoo.h",
- "android/hardware/tests/versioning/2.4/IHwFoo.h",
- "android/hardware/tests/versioning/2.4/BnHwFoo.h",
- "android/hardware/tests/versioning/2.4/BpHwFoo.h",
- "android/hardware/tests/versioning/2.4/BsFoo.h",
- ],
-}
-
-cc_library_shared {
- name: "android.hardware.tests.versioning@2.4",
- defaults: ["hidl-module-defaults"],
- generated_sources: ["android.hardware.tests.versioning@2.4_genc++"],
- generated_headers: ["android.hardware.tests.versioning@2.4_genc++_headers"],
- export_generated_headers: ["android.hardware.tests.versioning@2.4_genc++_headers"],
- vendor_available: true,
- shared_libs: [
- "libhidlbase",
- "libhidltransport",
- "libhwbinder",
- "liblog",
- "libutils",
- "libcutils",
- "android.hardware.tests.versioning@2.2",
- "android.hardware.tests.versioning@2.3",
- ],
- export_shared_lib_headers: [
- "libhidlbase",
- "libhidltransport",
- "libhwbinder",
- "libutils",
- "android.hardware.tests.versioning@2.2",
- "android.hardware.tests.versioning@2.3",
- ],
-}
diff --git a/tests/versioning/2.4/Android.mk b/tests/versioning/2.4/Android.mk
deleted file mode 100644
index c716172..0000000
--- a/tests/versioning/2.4/Android.mk
+++ /dev/null
@@ -1,80 +0,0 @@
-# This file is autogenerated by hidl-gen. Do not edit manually.
-
-LOCAL_PATH := $(call my-dir)
-
-################################################################################
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.versioning-V2.4-java
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-
-intermediates := $(call local-generated-sources-dir, COMMON)
-
-HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
-
-LOCAL_JAVA_LIBRARIES := \
- android.hardware.tests.versioning-V2.2-java \
- android.hardware.tests.versioning-V2.3-java \
- android.hidl.base-V1.0-java \
-
-
-#
-# Build IFoo.hal
-#
-GEN := $(intermediates)/android/hardware/tests/versioning/V2_4/IFoo.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IFoo.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
- $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
- -Ljava \
- -randroid.hardware:hardware/interfaces \
- -randroid.hidl:system/libhidl/transport \
- android.hardware.tests.versioning@2.4::IFoo
-
-$(GEN): $(LOCAL_PATH)/IFoo.hal
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-include $(BUILD_JAVA_LIBRARY)
-
-
-################################################################################
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.versioning-V2.4-java-static
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-
-intermediates := $(call local-generated-sources-dir, COMMON)
-
-HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- android.hardware.tests.versioning-V2.2-java-static \
- android.hardware.tests.versioning-V2.3-java-static \
- android.hidl.base-V1.0-java-static \
-
-
-#
-# Build IFoo.hal
-#
-GEN := $(intermediates)/android/hardware/tests/versioning/V2_4/IFoo.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IFoo.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
- $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
- -Ljava \
- -randroid.hardware:hardware/interfaces \
- -randroid.hidl:system/libhidl/transport \
- android.hardware.tests.versioning@2.4::IFoo
-
-$(GEN): $(LOCAL_PATH)/IFoo.hal
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/versioning/2.4/IFoo.hal b/tests/versioning/2.4/IFoo.hal
deleted file mode 100644
index 358b56f..0000000
--- a/tests/versioning/2.4/IFoo.hal
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-
-package android.hardware.tests.versioning@2.4;
-
-import @2.3::IFoo;
-
-// Must extend @2.3::IFoo.
-interface IFoo extends @2.3::IFoo {
-
-};