Snap for 6617762 from 5f86b51408
to rvc-release
Change-Id: I112e61495f9f9e947c5f58945f8e5091f5204ef7
This commit is contained in:
commit
b766ffa525
5 changed files with 8 additions and 69 deletions
|
@ -2262,6 +2262,7 @@ TEST_P(EvsHidlTest, CameraStreamExternalBuffering) {
|
|||
|
||||
// Allocate buffers to use
|
||||
hidl_vec<BufferDesc> buffers;
|
||||
buffers.resize(kBuffersToHold);
|
||||
for (auto i = 0; i < kBuffersToHold; ++i) {
|
||||
unsigned pixelsPerLine;
|
||||
buffer_handle_t memHandle = nullptr;
|
||||
|
|
|
@ -38,7 +38,7 @@ bool convertFromHidl(const CameraMetadata &src, const camera_metadata_t** dst) {
|
|||
}
|
||||
|
||||
const uint8_t* data = src.data();
|
||||
// sanity check the size of CameraMetadata match underlying camera_metadata_t
|
||||
// check that the size of CameraMetadata match underlying camera_metadata_t
|
||||
if (get_camera_metadata_size((camera_metadata_t*)data) != src.size()) {
|
||||
ALOGE("%s: input CameraMetadata is corrupt!", __FUNCTION__);
|
||||
return false;
|
||||
|
|
|
@ -1894,7 +1894,7 @@ TEST_P(CameraHidlTest, getCameraDeviceInterface) {
|
|||
}
|
||||
|
||||
// Verify that the device resource cost can be retrieved and the values are
|
||||
// sane.
|
||||
// correct.
|
||||
TEST_P(CameraHidlTest, getResourceCost) {
|
||||
hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
|
||||
|
||||
|
@ -2544,7 +2544,7 @@ TEST_P(CameraHidlTest, sendCommandSmoothZoom) {
|
|||
}
|
||||
}
|
||||
|
||||
// Basic sanity tests related to camera parameters.
|
||||
// Basic correctness tests related to camera parameters.
|
||||
TEST_P(CameraHidlTest, getSetParameters) {
|
||||
hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
|
||||
|
||||
|
|
|
@ -74,5 +74,6 @@ cc_defaults {
|
|||
// TODO(b/64437680): Assume these libs are always available on the device.
|
||||
shared_libs: [
|
||||
"libstagefright_foundation",
|
||||
"libstagefright_omx_utils",
|
||||
],
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
#include <media/stagefright/omx/OMXUtils.h>
|
||||
|
||||
using ::android::sp;
|
||||
using ::android::base::Join;
|
||||
|
@ -87,71 +88,6 @@ void displayComponentInfo(hidl_vec<IOmx::ComponentInfo>& nodeList) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the role based on is_encoder and mime.
|
||||
*
|
||||
* The mapping from a pair (is_encoder, mime) to a role string is
|
||||
* defined in frameworks/av/media/libmedia/MediaDefs.cpp and
|
||||
* frameworks/av/media/libstagefright/omx/OMXUtils.cpp. This function
|
||||
* does essentially the same work as GetComponentRole() in
|
||||
* OMXUtils.cpp.
|
||||
*
|
||||
* Args:
|
||||
* is_encoder: A boolean indicating whether the role is for an
|
||||
* encoder or a decoder.
|
||||
* mime: A string of the desired mime type.
|
||||
*
|
||||
* Returns:
|
||||
* A const string for the requested role name, empty if mime is not
|
||||
* recognized.
|
||||
*/
|
||||
const std::string getComponentRole(bool isEncoder, const std::string mime) {
|
||||
// Mapping from mime types to roles.
|
||||
// These values come from MediaDefs.cpp and OMXUtils.cpp
|
||||
const std::map<const std::string, const std::string> audioMimeToRole = {
|
||||
{"3gpp", "amrnb"}, {"ac3", "ac3"}, {"amr-wb", "amrwb"},
|
||||
{"eac3", "eac3"}, {"flac", "flac"}, {"g711-alaw", "g711alaw"},
|
||||
{"g711-mlaw", "g711mlaw"}, {"gsm", "gsm"}, {"mp4a-latm", "aac"},
|
||||
{"mpeg", "mp3"}, {"mpeg-L1", "mp1"}, {"mpeg-L2", "mp2"},
|
||||
{"opus", "opus"}, {"raw", "raw"}, {"vorbis", "vorbis"},
|
||||
};
|
||||
const std::map<const std::string, const std::string> videoMimeToRole = {
|
||||
{"3gpp", "h263"}, {"avc", "avc"}, {"dolby-vision", "dolby-vision"},
|
||||
{"hevc", "hevc"}, {"mp4v-es", "mpeg4"}, {"mpeg2", "mpeg2"},
|
||||
{"x-vnd.on2.vp8", "vp8"}, {"x-vnd.on2.vp9", "vp9"},
|
||||
};
|
||||
const std::map<const std::string, const std::string> imageMimeToRole = {
|
||||
{"vnd.android.heic", "heic"},
|
||||
};
|
||||
|
||||
// Suffix begins after the mime prefix.
|
||||
const size_t prefixEnd = mime.find("/");
|
||||
if (prefixEnd == std::string::npos || prefixEnd == mime.size()) return "";
|
||||
const std::string mime_suffix = mime.substr(prefixEnd + 1, mime.size() - 1);
|
||||
const std::string middle = isEncoder ? "encoder." : "decoder.";
|
||||
std::string prefix;
|
||||
std::string suffix;
|
||||
if (mime.rfind("audio/", 0) != std::string::npos) {
|
||||
const auto it = audioMimeToRole.find(mime_suffix);
|
||||
if (it == audioMimeToRole.end()) return "";
|
||||
prefix = "audio_";
|
||||
suffix = it->second;
|
||||
} else if (mime.rfind("video/", 0) != std::string::npos) {
|
||||
const auto it = videoMimeToRole.find(mime_suffix);
|
||||
if (it == videoMimeToRole.end()) return "";
|
||||
prefix = "video_";
|
||||
suffix = it->second;
|
||||
} else if (mime.rfind("image/", 0) != std::string::npos) {
|
||||
const auto it = imageMimeToRole.find(mime_suffix);
|
||||
if (it == imageMimeToRole.end()) return "";
|
||||
prefix = "image_";
|
||||
suffix = it->second;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
return prefix + middle + suffix;
|
||||
}
|
||||
|
||||
void validateAttributes(
|
||||
const std::map<const std::string, const testing::internal::RE>& knownPatterns,
|
||||
const std::vector<const struct AttributePattern>& unknownPatterns,
|
||||
|
@ -328,7 +264,8 @@ TEST_P(MasterHidlTest, ListRoles) {
|
|||
|
||||
// Make sure role name follows expected format based on type and
|
||||
// isEncoder
|
||||
const std::string role_name = getComponentRole(role.isEncoder, role.type);
|
||||
const std::string role_name(
|
||||
::android::GetComponentRole(role.isEncoder, role.type.c_str()));
|
||||
EXPECT_EQ(role_name, role.role) << "Role \"" << role.role << "\" does not match "
|
||||
<< (role.isEncoder ? "an encoder " : "a decoder ")
|
||||
<< "for mime type \"" << role.type << ".";
|
||||
|
|
Loading…
Reference in a new issue