summaryrefslogtreecommitdiffstats
path: root/tv
diff options
context:
space:
mode:
authorAmy Zhang <amyjojo@google.com>2020-06-03 17:00:17 -0700
committerAmy Zhang <amyjojo@google.com>2020-06-04 18:48:50 -0700
commitf4c09fbbd0eb8203f5ee8892333b8fdf0507c04d (patch)
tree6221640cb7ba367a5ad8cc0e71be156c6fc220fa /tv
parentac4ee9626849c00ac58da0c3f4be59a778e61de5 (diff)
downloadplatform_hardware_interfaces-f4c09fbbd0eb8203f5ee8892333b8fdf0507c04d.tar.gz
platform_hardware_interfaces-f4c09fbbd0eb8203f5ee8892333b8fdf0507c04d.tar.bz2
platform_hardware_interfaces-f4c09fbbd0eb8203f5ee8892333b8fdf0507c04d.zip
Add filter linkage test to the Tuner VTS
Test: atest VtsHalTvTunerV1_0TargetTest Bug: 150953857 Change-Id: Ic98cf1655551623fdc4e4f7e6784faf814adfda5
Diffstat (limited to 'tv')
-rw-r--r--tv/tuner/1.0/default/Tuner.cpp2
-rw-r--r--tv/tuner/1.0/vts/functional/DemuxTests.cpp13
-rw-r--r--tv/tuner/1.0/vts/functional/DemuxTests.h2
-rw-r--r--tv/tuner/1.0/vts/functional/FilterTests.cpp20
-rw-r--r--tv/tuner/1.0/vts/functional/FilterTests.h2
-rw-r--r--tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp34
-rw-r--r--tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h33
7 files changed, 104 insertions, 2 deletions
diff --git a/tv/tuner/1.0/default/Tuner.cpp b/tv/tuner/1.0/default/Tuner.cpp
index 821d83f87b..ae8070c5f7 100644
--- a/tv/tuner/1.0/default/Tuner.cpp
+++ b/tv/tuner/1.0/default/Tuner.cpp
@@ -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();
}
diff --git a/tv/tuner/1.0/vts/functional/DemuxTests.cpp b/tv/tuner/1.0/vts/functional/DemuxTests.cpp
index 6c32534d73..393bab50b6 100644
--- a/tv/tuner/1.0/vts/functional/DemuxTests.cpp
+++ b/tv/tuner/1.0/vts/functional/DemuxTests.cpp
@@ -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();
diff --git a/tv/tuner/1.0/vts/functional/DemuxTests.h b/tv/tuner/1.0/vts/functional/DemuxTests.h
index 0443c6714c..4211ca7e6b 100644
--- a/tv/tuner/1.0/vts/functional/DemuxTests.h
+++ b/tv/tuner/1.0/vts/functional/DemuxTests.h
@@ -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:
diff --git a/tv/tuner/1.0/vts/functional/FilterTests.cpp b/tv/tuner/1.0/vts/functional/FilterTests.cpp
index 4639e59c62..ca8bd1974d 100644
--- a/tv/tuner/1.0/vts/functional/FilterTests.cpp
+++ b/tv/tuner/1.0/vts/functional/FilterTests.cpp
@@ -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();
diff --git a/tv/tuner/1.0/vts/functional/FilterTests.h b/tv/tuner/1.0/vts/functional/FilterTests.h
index 71efce4e21..2aa1b90af3 100644
--- a/tv/tuner/1.0/vts/functional/FilterTests.h
+++ b/tv/tuner/1.0/vts/functional/FilterTests.h
@@ -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);
diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp
index a3652824d8..882a5119ad 100644
--- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp
+++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp
@@ -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,
diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h
index f2dd1970fa..9f24eef4e9 100644
--- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h
+++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h
@@ -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, " \
@@ -78,6 +83,12 @@ typedef enum {
} Filter;
typedef enum {
+ SOURCE,
+ SINK,
+ LINKAGE_DIR,
+} Linkage;
+
+typedef enum {
DVBT,
DVBS,
FRONTEND_MAX,
@@ -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 */