Merge "Add filter linkage test to the Tuner VTS" into rvc-dev am: 738334a656 am: 3b4b7ad573 am: e5e3d7db39 am: 12f6c6e4bc

Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/11732805

Change-Id: I92824dbc3b3d681b83e7c18e374ed4e910bea39d
This commit is contained in:
TreeHugger Robot 2020-06-05 22:18:30 +00:00 committed by Automerger Merge Worker
commit c8b45850ba
7 changed files with 104 additions and 2 deletions

View file

@ -139,6 +139,8 @@ Return<void> Tuner::getDemuxCaps(getDemuxCaps_cb _hidl_cb) {
DemuxCapabilities caps;
// IP filter can be an MMTP filter's data source.
caps.linkCaps = {0x00, 0x00, 0x02, 0x00, 0x00};
_hidl_cb(Result::SUCCESS, caps);
return Void();
}

View file

@ -33,6 +33,19 @@ AssertionResult DemuxTests::setDemuxFrontendDataSource(uint32_t frontendId) {
return AssertionResult(status.isOk());
}
AssertionResult DemuxTests::getDemuxCaps(DemuxCapabilities& demuxCaps) {
if (!mDemux) {
ALOGW("[vts] Test with openDemux first.");
return failure();
}
Result status;
mService->getDemuxCaps([&](Result result, DemuxCapabilities caps) {
status = result;
demuxCaps = caps;
});
return AssertionResult(status == Result::SUCCESS);
}
AssertionResult DemuxTests::closeDemux() {
EXPECT_TRUE(mDemux) << "Test with openDemux first.";
auto status = mDemux->close();

View file

@ -30,6 +30,7 @@
using android::sp;
using android::hardware::Return;
using android::hardware::Void;
using android::hardware::tv::tuner::V1_0::DemuxCapabilities;
using android::hardware::tv::tuner::V1_0::IDemux;
using android::hardware::tv::tuner::V1_0::IFilter;
using android::hardware::tv::tuner::V1_0::ITuner;
@ -45,6 +46,7 @@ class DemuxTests {
AssertionResult setDemuxFrontendDataSource(uint32_t frontendId);
void getAvSyncId(sp<IFilter> filter, uint32_t& avSyncHwId);
void getAvSyncTime(uint32_t avSyncId);
AssertionResult getDemuxCaps(DemuxCapabilities& demuxCaps);
AssertionResult closeDemux();
protected:

View file

@ -197,6 +197,26 @@ AssertionResult FilterTests::getFilterMQDescriptor(uint32_t filterId) {
return AssertionResult(status == Result::SUCCESS);
}
AssertionResult FilterTests::setFilterDataSource(uint32_t sourceFilterId, uint32_t sinkFilterId) {
if (!mFilters[sourceFilterId] || !mFilters[sinkFilterId]) {
ALOGE("[vts] setFilterDataSource filter not opened.");
return failure();
}
auto status = mFilters[sinkFilterId]->setDataSource(mFilters[sourceFilterId]);
return AssertionResult(status == Result::SUCCESS);
}
AssertionResult FilterTests::setFilterDataSourceToDemux(uint32_t filterId) {
if (!mFilters[filterId]) {
ALOGE("[vts] setFilterDataSourceToDemux filter not opened.");
return failure();
}
auto status = mFilters[filterId]->setDataSource(NULL);
return AssertionResult(status == Result::SUCCESS);
}
AssertionResult FilterTests::startFilter(uint32_t filterId) {
EXPECT_TRUE(mFilters[filterId]) << "Test with getNewlyOpenedFilterId first.";
Result status = mFilters[filterId]->start();

View file

@ -154,6 +154,8 @@ class FilterTests {
AssertionResult getNewlyOpenedFilterId(uint32_t& filterId);
AssertionResult configFilter(DemuxFilterSettings setting, uint32_t filterId);
AssertionResult getFilterMQDescriptor(uint32_t filterId);
AssertionResult setFilterDataSource(uint32_t sourceFilterId, uint32_t sinkFilterId);
AssertionResult setFilterDataSourceToDemux(uint32_t filterId);
AssertionResult startFilter(uint32_t filterId);
AssertionResult stopFilter(uint32_t filterId);
AssertionResult closeFilter(uint32_t filterId);

View file

@ -331,6 +331,36 @@ TEST_P(TunerFilterHidlTest, StartFilterInDemux) {
configSingleFilterInDemuxTest(filterArray[TS_VIDEO0], frontendArray[DVBT]);
}
TEST_P(TunerFilterHidlTest, SetFilterLinkage) {
description("Pick up all the possible linkages from the demux caps and set them up.");
DemuxCapabilities caps;
uint32_t demuxId;
sp<IDemux> demux;
ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId));
ASSERT_TRUE(mDemuxTests.getDemuxCaps(caps));
mFilterTests.setDemux(demux);
for (int i = 0; i < caps.linkCaps.size(); i++) {
uint32_t bitMask = 1;
for (int j = 0; j < FILTER_MAIN_TYPE_BIT_COUNT; j++) {
if (caps.linkCaps[i] & (bitMask << j)) {
uint32_t sourceFilterId;
uint32_t sinkFilterId;
ASSERT_TRUE(mFilterTests.openFilterInDemux(filterLinkageTypes[SOURCE][i],
FMQ_SIZE_16M));
ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(sourceFilterId));
ASSERT_TRUE(
mFilterTests.openFilterInDemux(filterLinkageTypes[SINK][j], FMQ_SIZE_16M));
ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(sinkFilterId));
ASSERT_TRUE(mFilterTests.setFilterDataSource(sourceFilterId, sinkFilterId));
ASSERT_TRUE(mFilterTests.setFilterDataSourceToDemux(sinkFilterId));
ASSERT_TRUE(mFilterTests.closeFilter(sinkFilterId));
ASSERT_TRUE(mFilterTests.closeFilter(sourceFilterId));
}
}
}
ASSERT_TRUE(mDemuxTests.closeDemux());
}
TEST_P(TunerBroadcastHidlTest, BroadcastDataFlowVideoFilterTest) {
description("Test Video Filter functionality in Broadcast use case.");
broadcastSingleFilterTest(filterArray[TS_VIDEO1], frontendArray[DVBS]);
@ -393,7 +423,7 @@ TEST_P(TunerDescramblerHidlTest, ScrambledBroadcastDataFlowMediaFiltersTest) {
scrambledBroadcastTest(filterConfs, frontendArray[DVBT], descramblerArray[DESC_0]);
}
/*INSTANTIATE_TEST_SUITE_P(
INSTANTIATE_TEST_SUITE_P(
PerInstance, TunerFrontendHidlTest,
testing::ValuesIn(android::hardware::getAllHalInstanceNames(ITuner::descriptor)),
android::hardware::PrintInstanceNameToString);
@ -421,7 +451,7 @@ INSTANTIATE_TEST_SUITE_P(
INSTANTIATE_TEST_SUITE_P(
PerInstance, TunerRecordHidlTest,
testing::ValuesIn(android::hardware::getAllHalInstanceNames(ITuner::descriptor)),
android::hardware::PrintInstanceNameToString);*/
android::hardware::PrintInstanceNameToString);
INSTANTIATE_TEST_SUITE_P(
PerInstance, TunerDescramblerHidlTest,

View file

@ -22,11 +22,15 @@
#include <hidlmemory/FrameworkUtils.h>
using android::hardware::tv::tuner::V1_0::DataFormat;
using android::hardware::tv::tuner::V1_0::DemuxAlpFilterType;
using android::hardware::tv::tuner::V1_0::DemuxFilterEvent;
using android::hardware::tv::tuner::V1_0::DemuxFilterMainType;
using android::hardware::tv::tuner::V1_0::DemuxFilterSettings;
using android::hardware::tv::tuner::V1_0::DemuxFilterType;
using android::hardware::tv::tuner::V1_0::DemuxIpFilterType;
using android::hardware::tv::tuner::V1_0::DemuxMmtpFilterType;
using android::hardware::tv::tuner::V1_0::DemuxRecordScIndexType;
using android::hardware::tv::tuner::V1_0::DemuxTlvFilterType;
using android::hardware::tv::tuner::V1_0::DemuxTpid;
using android::hardware::tv::tuner::V1_0::DemuxTsFilterType;
using android::hardware::tv::tuner::V1_0::DvrSettings;
@ -53,6 +57,7 @@ const uint32_t FMQ_SIZE_4M = 0x400000;
const uint32_t FMQ_SIZE_16M = 0x1000000;
#define CLEAR_KEY_SYSTEM_ID 0xF6D8
#define FILTER_MAIN_TYPE_BIT_COUNT 32
#define PROVISION_STR \
"{ " \
" \"id\": 21140844, " \
@ -77,6 +82,12 @@ typedef enum {
FILTER_MAX,
} Filter;
typedef enum {
SOURCE,
SINK,
LINKAGE_DIR,
} Linkage;
typedef enum {
DVBT,
DVBS,
@ -139,6 +150,7 @@ static FrontendConfig frontendArray[FILTER_MAX];
static FrontendConfig frontendScanArray[SCAN_MAX];
static ChannelConfig channelArray[FRONTEND_MAX];
static FilterConfig filterArray[FILTER_MAX];
static DemuxFilterType filterLinkageTypes[LINKAGE_DIR][FILTER_MAIN_TYPE_BIT_COUNT];
static DvrConfig dvrArray[DVR_MAX];
static DescramblerConfig descramblerArray[DESC_MAX];
static vector<string> goldenOutputFiles;
@ -241,6 +253,27 @@ inline void initFilterConfig() {
filterArray[TS_RECORD0].settings.ts().filterSettings.record({
.scIndexType = DemuxRecordScIndexType::NONE,
});
// TS Linkage filter setting
filterLinkageTypes[SOURCE][0].mainType = DemuxFilterMainType::TS;
filterLinkageTypes[SOURCE][0].subType.tsFilterType(DemuxTsFilterType::TS);
filterLinkageTypes[SINK][0] = filterLinkageTypes[SOURCE][0];
// MMTP Linkage filter setting
filterLinkageTypes[SOURCE][1].mainType = DemuxFilterMainType::MMTP;
filterLinkageTypes[SOURCE][1].subType.mmtpFilterType(DemuxMmtpFilterType::AUDIO);
filterLinkageTypes[SINK][1] = filterLinkageTypes[SOURCE][1];
// IP Linkage filter setting
filterLinkageTypes[SOURCE][2].mainType = DemuxFilterMainType::IP;
filterLinkageTypes[SOURCE][2].subType.ipFilterType(DemuxIpFilterType::IP);
filterLinkageTypes[SINK][2] = filterLinkageTypes[SOURCE][2];
// TLV Linkage filter setting
filterLinkageTypes[SOURCE][3].mainType = DemuxFilterMainType::TLV;
filterLinkageTypes[SOURCE][3].subType.tlvFilterType(DemuxTlvFilterType::TLV);
filterLinkageTypes[SINK][3] = filterLinkageTypes[SOURCE][3];
// ALP Linkage PTP filter setting
filterLinkageTypes[SOURCE][4].mainType = DemuxFilterMainType::ALP;
filterLinkageTypes[SOURCE][4].subType.alpFilterType(DemuxAlpFilterType::PTP);
filterLinkageTypes[SINK][4] = filterLinkageTypes[SOURCE][4];
};
/** Configuration array for the dvr test */