Loading tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp +17 −74 Original line number Diff line number Diff line Loading @@ -86,17 +86,14 @@ void TunerBroadcastHidlTest::broadcastSingleFilterTest(FilterConfig filterConf, uint32_t filterId; mFrontendTests.getFrontendIdByType(frontendConf.type, feId); if (feId == INVALID_ID) { // TODO broadcast test on Cuttlefish needs licensed ts input, // these tests are runnable on vendor device with real frontend module // or with manual ts installing and use DVBT frontend. return; } ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); ASSERT_TRUE(mFrontendTests.setFrontendCallback()); if (mLnbId) { ASSERT_TRUE(mFrontendTests.setLnb(*mLnbId)); } if (frontendConf.isSoftwareFe) { mFrontendTests.setSoftwareFrontendDvrConfig(dvrMap[live.dvrSoftwareFeId]); } ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); mFrontendTests.setDemux(demux); Loading Loading @@ -178,6 +175,9 @@ void TunerRecordHidlTest::recordSingleFilterTest(FilterConfig filterConf, if (mLnbId) { ASSERT_TRUE(mFrontendTests.setLnb(*mLnbId)); } if (frontendConf.isSoftwareFe) { mFrontendTests.setSoftwareFrontendDvrConfig(dvrMap[record.dvrSoftwareFeId]); } ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); mFilterTests.setDemux(demux); Loading Loading @@ -279,14 +279,11 @@ void TunerDescramblerHidlTest::scrambledBroadcastTest(set<struct FilterConfig> m set<uint32_t>::iterator id; mFrontendTests.getFrontendIdByType(frontendConf.type, feId); if (feId == INVALID_ID) { // TODO broadcast test on Cuttlefish needs licensed ts input, // these tests are runnable on vendor device with real frontend module // or with manual ts installing and use DVBT frontend. return; } ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); ASSERT_TRUE(mFrontendTests.setFrontendCallback()); if (frontendConf.isSoftwareFe) { mFrontendTests.setSoftwareFrontendDvrConfig(dvrMap[descrambling.dvrSoftwareFeId]); } ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); mFilterTests.setDemux(demux); Loading @@ -301,7 +298,7 @@ void TunerDescramblerHidlTest::scrambledBroadcastTest(set<struct FilterConfig> m TunerKeyToken token; ASSERT_TRUE(mDescramblerTests.getKeyToken(descConfig.casSystemId, descConfig.provisionStr, descConfig.hidlPvtData, token)); ASSERT_TRUE(mDescramblerTests.setKeyToken(token)); mDescramblerTests.setKeyToken(token); vector<DemuxPid> pids; DemuxPid pid; for (config = mediaFilterConfs.begin(); config != mediaFilterConfs.end(); config++) { Loading Loading @@ -497,66 +494,12 @@ TEST_P(TunerBroadcastHidlTest, LnbBroadcastDataFlowVideoFilterTest) { broadcastSingleFilterTest(filterArray[TS_VIDEO0], frontendMap[live.frontendId]); } TEST_P(TunerBroadcastHidlTest, BroadcastEsDataFlowMediaFiltersTest) { description("Test Meida Filters functionality in Broadcast use case with ES input."); uint32_t feId; uint32_t demuxId; sp<IDemux> demux; uint32_t filterId; mFrontendTests.getFrontendIdByType(frontendMap[live.frontendId].type, feId); if (feId == INVALID_ID) { // TODO broadcast test on Cuttlefish needs licensed ts input, // these tests are runnable on vendor device with real frontend module // or with manual ts installing and use defaultFrontend frontend. return; } ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); ASSERT_TRUE(mFrontendTests.setFrontendCallback()); ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); mFrontendTests.setDemux(demux); mFilterTests.setDemux(demux); ASSERT_TRUE(mFilterTests.openFilterInDemux(filterArray[TS_AUDIO1].type, filterArray[TS_AUDIO1].bufferSize)); ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(filterId)); ASSERT_TRUE(mFilterTests.configFilter(filterArray[TS_AUDIO1].settings, filterId)); ASSERT_TRUE(mFilterTests.getFilterMQDescriptor(filterId, filterArray[TS_AUDIO1].getMqDesc)); ASSERT_TRUE(mFilterTests.startFilter(filterId)); ASSERT_TRUE(mFilterTests.openFilterInDemux(filterArray[TS_VIDEO1].type, filterArray[TS_VIDEO1].bufferSize)); ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(filterId)); ASSERT_TRUE(mFilterTests.configFilter(filterArray[TS_VIDEO1].settings, filterId)); ASSERT_TRUE(mFilterTests.getFilterMQDescriptor(filterId, filterArray[TS_VIDEO1].getMqDesc)); ASSERT_TRUE(mFilterTests.startFilter(filterId)); // tune test // TODO: replace with customized dvr input PlaybackSettings playbackSettings{ .statusMask = 0xf, .lowThreshold = 0x1000, .highThreshold = 0x07fff, .dataFormat = DataFormat::ES, .packetSize = 188, }; DvrConfig dvrConfig{ .type = DvrType::PLAYBACK, .playbackInputFile = "/data/local/tmp/test.es", .bufferSize = FMQ_SIZE_4M, }; dvrConfig.settings.playback(playbackSettings); mFrontendTests.setSoftwareFrontendDvrConfig(dvrConfig); ASSERT_TRUE(mFrontendTests.tuneFrontend(frontendMap[live.frontendId], true /*testWithDemux*/)); ASSERT_TRUE(filterDataOutputTest()); ASSERT_TRUE(mFrontendTests.stopTuneFrontend(true /*testWithDemux*/)); ASSERT_TRUE(mFilterTests.stopFilter(filterId)); ASSERT_TRUE(mFilterTests.closeFilter(filterId)); ASSERT_TRUE(mDemuxTests.closeDemux()); ASSERT_TRUE(mFrontendTests.closeFrontend()); } TEST_P(TunerPlaybackHidlTest, PlaybackDataFlowWithTsSectionFilterTest) { description("Feed ts data from playback and configure Ts section filter to get output"); playbackSingleFilterTest(filterArray[TS_SECTION0], dvrArray[DVR_PLAYBACK0]); if (!playback.support) { return; } playbackSingleFilterTest(filterArray[TS_SECTION0], dvrMap[playback.dvrId]); } TEST_P(TunerRecordHidlTest, AttachFiltersToRecordTest) { Loading @@ -566,7 +509,7 @@ TEST_P(TunerRecordHidlTest, AttachFiltersToRecordTest) { return; } attachSingleFilterToRecordDvrTest(filterArray[TS_RECORD0], frontendMap[record.frontendId], dvrArray[DVR_RECORD0]); dvrMap[record.dvrRecordId]); } TEST_P(TunerRecordHidlTest, RecordDataFlowWithTsRecordFilterTest) { Loading @@ -575,7 +518,7 @@ TEST_P(TunerRecordHidlTest, RecordDataFlowWithTsRecordFilterTest) { return; } recordSingleFilterTest(filterArray[TS_RECORD0], frontendMap[record.frontendId], dvrArray[DVR_RECORD0]); dvrMap[record.dvrRecordId]); } TEST_P(TunerRecordHidlTest, LnbRecordDataFlowWithTsRecordFilterTest) { Loading @@ -584,7 +527,7 @@ TEST_P(TunerRecordHidlTest, LnbRecordDataFlowWithTsRecordFilterTest) { return; } recordSingleFilterTestWithLnb(filterArray[TS_RECORD0], frontendMap[lnbRecord.frontendId], dvrArray[DVR_RECORD0], lnbArray[LNB0]); dvrMap[record.dvrRecordId], lnbArray[LNB0]); } TEST_P(TunerDescramblerHidlTest, CreateDescrambler) { Loading tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.h +1 −1 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ bool initConfiguration() { return false; } initFrontendConfig(); initDvrConfig(); connectHardwaresToTestCases(); if (!validateConnections()) { ALOGW("[vts] failed to validate connections."); Loading @@ -42,7 +43,6 @@ bool initConfiguration() { initLnbConfig(); initFilterConfig(); initTimeFilterConfig(); initDvrConfig(); initDescramblerConfig(); return true; Loading tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h +40 −43 Original line number Diff line number Diff line Loading @@ -114,12 +114,6 @@ typedef enum { DISEQC_MAX, } Diseqc; typedef enum { DVR_RECORD0, DVR_PLAYBACK0, DVR_MAX, } Dvr; typedef enum { DESC_0, DESC_MAX, Loading Loading @@ -147,13 +141,6 @@ struct LnbConfig { LnbPosition position; }; struct DvrConfig { DvrType type; uint32_t bufferSize; DvrSettings settings; string playbackInputFile; }; struct DescramblerConfig { uint32_t casSystemId; string provisionStr; Loading @@ -166,24 +153,25 @@ static vector<uint8_t> diseqcMsgArray[DISEQC_MAX]; static FilterConfig filterArray[FILTER_MAX]; static TimeFilterConfig timeFilterArray[TIMER_MAX]; static DemuxFilterType filterLinkageTypes[LINKAGE_DIR][FILTER_MAIN_TYPE_BIT_COUNT]; static DvrConfig dvrArray[DVR_MAX]; static DescramblerConfig descramblerArray[DESC_MAX]; // Hardware configs static map<string, FrontendConfig> frontendMap; static map<string, DvrConfig> dvrMap; // Hardware and test cases connections static LiveBroadcastHardwareConnections live; static ScanHardwareConnections scan; static DvrPlaybackHardwareConnections playback; static DvrRecordHardwareConnections record; static DescramblingHardwareConnections descrambling; static LnbLiveHardwareConnections lnbLive; static LnbRecordHardwareConnections lnbRecord; /** Configuration array for the frontend tune test */ /** Config all the frontends that would be used in the tests */ inline void initFrontendConfig() { // The test will use the internal default fe is default fe is connected to any data flow without // overriding in the xml config. // The test will use the internal default fe when default fe is connected to any data flow // without overriding in the xml config. string defaultFeId = "FE_DEFAULT"; FrontendDvbtSettings dvbtSettings{ .frequency = 578000, Loading @@ -208,10 +196,17 @@ inline void initFrontendConfig() { TunerTestingConfigReader::readFrontendConfig1_0(frontendMap); }; /** Config all the dvrs that would be used in the tests */ inline void initDvrConfig() { // Read customized config TunerTestingConfigReader::readDvrConfig1_0(dvrMap); }; /** Read the vendor configurations of which hardware to use for each test cases/data flows */ inline void connectHardwaresToTestCases() { TunerTestingConfigReader::connectLiveBroadcast(live); TunerTestingConfigReader::connectScan(scan); TunerTestingConfigReader::connectDvrPlayback(playback); TunerTestingConfigReader::connectDvrRecord(record); TunerTestingConfigReader::connectDescrambling(descrambling); TunerTestingConfigReader::connectLnbLive(lnbLive); Loading @@ -228,7 +223,34 @@ inline bool validateConnections() { feIsValid &= lnbLive.support ? frontendMap.find(lnbLive.frontendId) != frontendMap.end() : true; feIsValid &= lnbRecord.support ? frontendMap.find(lnbRecord.frontendId) != frontendMap.end() : true; return feIsValid; if (!feIsValid) { ALOGW("[vts config] dynamic config fe connection is invalid."); return false; } bool dvrIsValid = frontendMap[live.frontendId].isSoftwareFe ? dvrMap.find(live.dvrSoftwareFeId) != dvrMap.end() : true; dvrIsValid &= playback.support ? dvrMap.find(playback.dvrId) != dvrMap.end() : true; if (record.support) { if (frontendMap[record.frontendId].isSoftwareFe) { dvrIsValid &= dvrMap.find(record.dvrSoftwareFeId) != dvrMap.end(); } dvrIsValid &= dvrMap.find(record.dvrRecordId) != dvrMap.end(); } if (descrambling.support && frontendMap[descrambling.frontendId].isSoftwareFe) { dvrIsValid &= dvrMap.find(descrambling.dvrSoftwareFeId) != dvrMap.end(); } if (!dvrIsValid) { ALOGW("[vts config] dynamic config dvr connection is invalid."); return false; } return true; } // TODO: remove all the manual configs after the dynamic config refactoring is done. Loading Loading @@ -341,31 +363,6 @@ inline void initTimeFilterConfig() { timeFilterArray[TIMER0].timeStamp = 1; } /** Configuration array for the dvr test */ inline void initDvrConfig() { RecordSettings recordSettings{ .statusMask = 0xf, .lowThreshold = 0x1000, .highThreshold = 0x07fff, .dataFormat = DataFormat::TS, .packetSize = 188, }; dvrArray[DVR_RECORD0].type = DvrType::RECORD; dvrArray[DVR_RECORD0].bufferSize = FMQ_SIZE_4M; dvrArray[DVR_RECORD0].settings.record(recordSettings); PlaybackSettings playbackSettings{ .statusMask = 0xf, .lowThreshold = 0x1000, .highThreshold = 0x07fff, .dataFormat = DataFormat::TS, .packetSize = 188, }; dvrArray[DVR_PLAYBACK0].type = DvrType::PLAYBACK; dvrArray[DVR_PLAYBACK0].playbackInputFile = "/data/local/tmp/segment000000.ts"; dvrArray[DVR_PLAYBACK0].bufferSize = FMQ_SIZE_4M; dvrArray[DVR_PLAYBACK0].settings.playback(playbackSettings); }; /** Configuration array for the descrambler test */ inline void initDescramblerConfig() { descramblerArray[DESC_0].casSystemId = CLEAR_KEY_SYSTEM_ID; Loading tv/tuner/config/OWNERS 0 → 100644 +4 −0 Original line number Diff line number Diff line nchalko@google.com amyjojo@google.com shubang@google.com quxiangfang@google.com tv/tuner/config/TunerTestingConfigReader.h +95 −2 Original line number Diff line number Diff line Loading @@ -70,8 +70,16 @@ struct FrontendConfig { vector<FrontendStatus> expectTuneStatuses; }; struct DvrConfig { DvrType type; uint32_t bufferSize; DvrSettings settings; string playbackInputFile; }; struct LiveBroadcastHardwareConnections { string frontendId; string dvrSoftwareFeId; /* string audioFilterId; string videoFilterId; list string of extra filters; */ Loading @@ -81,9 +89,20 @@ struct ScanHardwareConnections { string frontendId; }; struct DvrPlaybackHardwareConnections { bool support; string frontendId; string dvrId; /* string audioFilterId; string videoFilterId; list string of extra filters; */ }; struct DvrRecordHardwareConnections { bool support; string frontendId; string dvrRecordId; string dvrSoftwareFeId; /* string recordFilterId; string dvrId; */ }; Loading @@ -91,6 +110,7 @@ struct DvrRecordHardwareConnections { struct DescramblingHardwareConnections { bool support; string frontendId; string dvrSoftwareFeId; /* string descramblerId; string audioFilterId; string videoFilterId; Loading Loading @@ -196,9 +216,41 @@ struct TunerTestingConfigReader { } } static void readDvrConfig1_0(map<string, DvrConfig>& dvrMap) { auto hardwareConfig = getHardwareConfig(); if (hardwareConfig.hasDvrs()) { auto dvrs = *hardwareConfig.getFirstDvrs(); for (auto dvrConfig : dvrs.getDvr()) { string id = dvrConfig.getId(); DvrType type; switch (dvrConfig.getType()) { case DvrTypeEnum::PLAYBACK: type = DvrType::PLAYBACK; dvrMap[id].settings.playback(readPlaybackSettings(dvrConfig)); break; case DvrTypeEnum::RECORD: type = DvrType::RECORD; dvrMap[id].settings.record(readRecordSettings(dvrConfig)); break; case DvrTypeEnum::UNKNOWN: ALOGW("[ConfigReader] invalid DVR type"); return; } dvrMap[id].type = type; dvrMap[id].bufferSize = static_cast<uint32_t>(dvrConfig.getBufferSize()); if (dvrConfig.hasInputFilePath()) { dvrMap[id].playbackInputFile = dvrConfig.getInputFilePath(); } } } } static void connectLiveBroadcast(LiveBroadcastHardwareConnections& live) { auto liveConfig = getDataFlowConfiguration().getFirstClearLiveBroadcast(); live.frontendId = liveConfig->getFrontendConnection(); if (liveConfig->hasDvrSoftwareFeConnection()) { live.dvrSoftwareFeId = liveConfig->getDvrSoftwareFeConnection(); } } static void connectScan(ScanHardwareConnections& scan) { Loading @@ -206,6 +258,16 @@ struct TunerTestingConfigReader { scan.frontendId = scanConfig->getFrontendConnection(); } static void connectDvrPlayback(DvrPlaybackHardwareConnections& playback) { auto dataFlow = getDataFlowConfiguration(); if (!dataFlow.hasDvrPlayback()) { playback.support = false; return; } auto playbackConfig = dataFlow.getFirstDvrPlayback(); playback.dvrId = playbackConfig->getDvrConnection(); } static void connectDvrRecord(DvrRecordHardwareConnections& record) { auto dataFlow = getDataFlowConfiguration(); if (!dataFlow.hasDvrRecord()) { Loading @@ -214,6 +276,10 @@ struct TunerTestingConfigReader { } auto recordConfig = dataFlow.getFirstDvrRecord(); record.frontendId = recordConfig->getFrontendConnection(); record.dvrRecordId = recordConfig->getDvrRecordConnection(); if (recordConfig->hasDvrSoftwareFeConnection()) { record.dvrSoftwareFeId = recordConfig->getDvrSoftwareFeConnection(); } } static void connectDescrambling(DescramblingHardwareConnections& descrambling) { Loading @@ -224,6 +290,9 @@ struct TunerTestingConfigReader { } auto descConfig = dataFlow.getFirstDescrambling(); descrambling.frontendId = descConfig->getFrontendConnection(); if (descConfig->hasDvrSoftwareFeConnection()) { descrambling.dvrSoftwareFeId = descConfig->getDvrSoftwareFeConnection(); } } static void connectLnbLive(LnbLiveHardwareConnections& lnbLive) { Loading @@ -248,7 +317,7 @@ struct TunerTestingConfigReader { private: static FrontendDvbtSettings readDvbtFrontendSettings(Frontend feConfig) { ALOGW("[ConfigReader] type is dvbt"); ALOGW("[ConfigReader] fe type is dvbt"); FrontendDvbtSettings dvbtSettings{ .frequency = (uint32_t)feConfig.getFrequency(), }; Loading @@ -266,7 +335,7 @@ struct TunerTestingConfigReader { } static FrontendDvbsSettings readDvbsFrontendSettings(Frontend feConfig) { ALOGW("[ConfigReader] type is dvbs"); ALOGW("[ConfigReader] fe type is dvbs"); FrontendDvbsSettings dvbsSettings{ .frequency = (uint32_t)feConfig.getFrequency(), }; Loading @@ -281,6 +350,30 @@ struct TunerTestingConfigReader { return dvbsSettings; } static PlaybackSettings readPlaybackSettings(Dvr dvrConfig) { ALOGW("[ConfigReader] dvr type is playback"); PlaybackSettings playbackSettings{ .statusMask = static_cast<uint8_t>(dvrConfig.getStatusMask()), .lowThreshold = static_cast<uint32_t>(dvrConfig.getLowThreshold()), .highThreshold = static_cast<uint32_t>(dvrConfig.getHighThreshold()), .dataFormat = static_cast<DataFormat>(dvrConfig.getDataFormat()), .packetSize = static_cast<uint8_t>(dvrConfig.getPacketSize()), }; return playbackSettings; } static RecordSettings readRecordSettings(Dvr dvrConfig) { ALOGW("[ConfigReader] dvr type is record"); RecordSettings recordSettings{ .statusMask = static_cast<uint8_t>(dvrConfig.getStatusMask()), .lowThreshold = static_cast<uint32_t>(dvrConfig.getLowThreshold()), .highThreshold = static_cast<uint32_t>(dvrConfig.getHighThreshold()), .dataFormat = static_cast<DataFormat>(dvrConfig.getDataFormat()), .packetSize = static_cast<uint8_t>(dvrConfig.getPacketSize()), }; return recordSettings; } static TunerConfiguration getTunerConfig() { return *read(configFilePath.c_str()); } static HardwareConfiguration getHardwareConfig() { Loading Loading
tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp +17 −74 Original line number Diff line number Diff line Loading @@ -86,17 +86,14 @@ void TunerBroadcastHidlTest::broadcastSingleFilterTest(FilterConfig filterConf, uint32_t filterId; mFrontendTests.getFrontendIdByType(frontendConf.type, feId); if (feId == INVALID_ID) { // TODO broadcast test on Cuttlefish needs licensed ts input, // these tests are runnable on vendor device with real frontend module // or with manual ts installing and use DVBT frontend. return; } ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); ASSERT_TRUE(mFrontendTests.setFrontendCallback()); if (mLnbId) { ASSERT_TRUE(mFrontendTests.setLnb(*mLnbId)); } if (frontendConf.isSoftwareFe) { mFrontendTests.setSoftwareFrontendDvrConfig(dvrMap[live.dvrSoftwareFeId]); } ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); mFrontendTests.setDemux(demux); Loading Loading @@ -178,6 +175,9 @@ void TunerRecordHidlTest::recordSingleFilterTest(FilterConfig filterConf, if (mLnbId) { ASSERT_TRUE(mFrontendTests.setLnb(*mLnbId)); } if (frontendConf.isSoftwareFe) { mFrontendTests.setSoftwareFrontendDvrConfig(dvrMap[record.dvrSoftwareFeId]); } ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); mFilterTests.setDemux(demux); Loading Loading @@ -279,14 +279,11 @@ void TunerDescramblerHidlTest::scrambledBroadcastTest(set<struct FilterConfig> m set<uint32_t>::iterator id; mFrontendTests.getFrontendIdByType(frontendConf.type, feId); if (feId == INVALID_ID) { // TODO broadcast test on Cuttlefish needs licensed ts input, // these tests are runnable on vendor device with real frontend module // or with manual ts installing and use DVBT frontend. return; } ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); ASSERT_TRUE(mFrontendTests.setFrontendCallback()); if (frontendConf.isSoftwareFe) { mFrontendTests.setSoftwareFrontendDvrConfig(dvrMap[descrambling.dvrSoftwareFeId]); } ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); mFilterTests.setDemux(demux); Loading @@ -301,7 +298,7 @@ void TunerDescramblerHidlTest::scrambledBroadcastTest(set<struct FilterConfig> m TunerKeyToken token; ASSERT_TRUE(mDescramblerTests.getKeyToken(descConfig.casSystemId, descConfig.provisionStr, descConfig.hidlPvtData, token)); ASSERT_TRUE(mDescramblerTests.setKeyToken(token)); mDescramblerTests.setKeyToken(token); vector<DemuxPid> pids; DemuxPid pid; for (config = mediaFilterConfs.begin(); config != mediaFilterConfs.end(); config++) { Loading Loading @@ -497,66 +494,12 @@ TEST_P(TunerBroadcastHidlTest, LnbBroadcastDataFlowVideoFilterTest) { broadcastSingleFilterTest(filterArray[TS_VIDEO0], frontendMap[live.frontendId]); } TEST_P(TunerBroadcastHidlTest, BroadcastEsDataFlowMediaFiltersTest) { description("Test Meida Filters functionality in Broadcast use case with ES input."); uint32_t feId; uint32_t demuxId; sp<IDemux> demux; uint32_t filterId; mFrontendTests.getFrontendIdByType(frontendMap[live.frontendId].type, feId); if (feId == INVALID_ID) { // TODO broadcast test on Cuttlefish needs licensed ts input, // these tests are runnable on vendor device with real frontend module // or with manual ts installing and use defaultFrontend frontend. return; } ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); ASSERT_TRUE(mFrontendTests.setFrontendCallback()); ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); mFrontendTests.setDemux(demux); mFilterTests.setDemux(demux); ASSERT_TRUE(mFilterTests.openFilterInDemux(filterArray[TS_AUDIO1].type, filterArray[TS_AUDIO1].bufferSize)); ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(filterId)); ASSERT_TRUE(mFilterTests.configFilter(filterArray[TS_AUDIO1].settings, filterId)); ASSERT_TRUE(mFilterTests.getFilterMQDescriptor(filterId, filterArray[TS_AUDIO1].getMqDesc)); ASSERT_TRUE(mFilterTests.startFilter(filterId)); ASSERT_TRUE(mFilterTests.openFilterInDemux(filterArray[TS_VIDEO1].type, filterArray[TS_VIDEO1].bufferSize)); ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(filterId)); ASSERT_TRUE(mFilterTests.configFilter(filterArray[TS_VIDEO1].settings, filterId)); ASSERT_TRUE(mFilterTests.getFilterMQDescriptor(filterId, filterArray[TS_VIDEO1].getMqDesc)); ASSERT_TRUE(mFilterTests.startFilter(filterId)); // tune test // TODO: replace with customized dvr input PlaybackSettings playbackSettings{ .statusMask = 0xf, .lowThreshold = 0x1000, .highThreshold = 0x07fff, .dataFormat = DataFormat::ES, .packetSize = 188, }; DvrConfig dvrConfig{ .type = DvrType::PLAYBACK, .playbackInputFile = "/data/local/tmp/test.es", .bufferSize = FMQ_SIZE_4M, }; dvrConfig.settings.playback(playbackSettings); mFrontendTests.setSoftwareFrontendDvrConfig(dvrConfig); ASSERT_TRUE(mFrontendTests.tuneFrontend(frontendMap[live.frontendId], true /*testWithDemux*/)); ASSERT_TRUE(filterDataOutputTest()); ASSERT_TRUE(mFrontendTests.stopTuneFrontend(true /*testWithDemux*/)); ASSERT_TRUE(mFilterTests.stopFilter(filterId)); ASSERT_TRUE(mFilterTests.closeFilter(filterId)); ASSERT_TRUE(mDemuxTests.closeDemux()); ASSERT_TRUE(mFrontendTests.closeFrontend()); } TEST_P(TunerPlaybackHidlTest, PlaybackDataFlowWithTsSectionFilterTest) { description("Feed ts data from playback and configure Ts section filter to get output"); playbackSingleFilterTest(filterArray[TS_SECTION0], dvrArray[DVR_PLAYBACK0]); if (!playback.support) { return; } playbackSingleFilterTest(filterArray[TS_SECTION0], dvrMap[playback.dvrId]); } TEST_P(TunerRecordHidlTest, AttachFiltersToRecordTest) { Loading @@ -566,7 +509,7 @@ TEST_P(TunerRecordHidlTest, AttachFiltersToRecordTest) { return; } attachSingleFilterToRecordDvrTest(filterArray[TS_RECORD0], frontendMap[record.frontendId], dvrArray[DVR_RECORD0]); dvrMap[record.dvrRecordId]); } TEST_P(TunerRecordHidlTest, RecordDataFlowWithTsRecordFilterTest) { Loading @@ -575,7 +518,7 @@ TEST_P(TunerRecordHidlTest, RecordDataFlowWithTsRecordFilterTest) { return; } recordSingleFilterTest(filterArray[TS_RECORD0], frontendMap[record.frontendId], dvrArray[DVR_RECORD0]); dvrMap[record.dvrRecordId]); } TEST_P(TunerRecordHidlTest, LnbRecordDataFlowWithTsRecordFilterTest) { Loading @@ -584,7 +527,7 @@ TEST_P(TunerRecordHidlTest, LnbRecordDataFlowWithTsRecordFilterTest) { return; } recordSingleFilterTestWithLnb(filterArray[TS_RECORD0], frontendMap[lnbRecord.frontendId], dvrArray[DVR_RECORD0], lnbArray[LNB0]); dvrMap[record.dvrRecordId], lnbArray[LNB0]); } TEST_P(TunerDescramblerHidlTest, CreateDescrambler) { Loading
tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.h +1 −1 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ bool initConfiguration() { return false; } initFrontendConfig(); initDvrConfig(); connectHardwaresToTestCases(); if (!validateConnections()) { ALOGW("[vts] failed to validate connections."); Loading @@ -42,7 +43,6 @@ bool initConfiguration() { initLnbConfig(); initFilterConfig(); initTimeFilterConfig(); initDvrConfig(); initDescramblerConfig(); return true; Loading
tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h +40 −43 Original line number Diff line number Diff line Loading @@ -114,12 +114,6 @@ typedef enum { DISEQC_MAX, } Diseqc; typedef enum { DVR_RECORD0, DVR_PLAYBACK0, DVR_MAX, } Dvr; typedef enum { DESC_0, DESC_MAX, Loading Loading @@ -147,13 +141,6 @@ struct LnbConfig { LnbPosition position; }; struct DvrConfig { DvrType type; uint32_t bufferSize; DvrSettings settings; string playbackInputFile; }; struct DescramblerConfig { uint32_t casSystemId; string provisionStr; Loading @@ -166,24 +153,25 @@ static vector<uint8_t> diseqcMsgArray[DISEQC_MAX]; static FilterConfig filterArray[FILTER_MAX]; static TimeFilterConfig timeFilterArray[TIMER_MAX]; static DemuxFilterType filterLinkageTypes[LINKAGE_DIR][FILTER_MAIN_TYPE_BIT_COUNT]; static DvrConfig dvrArray[DVR_MAX]; static DescramblerConfig descramblerArray[DESC_MAX]; // Hardware configs static map<string, FrontendConfig> frontendMap; static map<string, DvrConfig> dvrMap; // Hardware and test cases connections static LiveBroadcastHardwareConnections live; static ScanHardwareConnections scan; static DvrPlaybackHardwareConnections playback; static DvrRecordHardwareConnections record; static DescramblingHardwareConnections descrambling; static LnbLiveHardwareConnections lnbLive; static LnbRecordHardwareConnections lnbRecord; /** Configuration array for the frontend tune test */ /** Config all the frontends that would be used in the tests */ inline void initFrontendConfig() { // The test will use the internal default fe is default fe is connected to any data flow without // overriding in the xml config. // The test will use the internal default fe when default fe is connected to any data flow // without overriding in the xml config. string defaultFeId = "FE_DEFAULT"; FrontendDvbtSettings dvbtSettings{ .frequency = 578000, Loading @@ -208,10 +196,17 @@ inline void initFrontendConfig() { TunerTestingConfigReader::readFrontendConfig1_0(frontendMap); }; /** Config all the dvrs that would be used in the tests */ inline void initDvrConfig() { // Read customized config TunerTestingConfigReader::readDvrConfig1_0(dvrMap); }; /** Read the vendor configurations of which hardware to use for each test cases/data flows */ inline void connectHardwaresToTestCases() { TunerTestingConfigReader::connectLiveBroadcast(live); TunerTestingConfigReader::connectScan(scan); TunerTestingConfigReader::connectDvrPlayback(playback); TunerTestingConfigReader::connectDvrRecord(record); TunerTestingConfigReader::connectDescrambling(descrambling); TunerTestingConfigReader::connectLnbLive(lnbLive); Loading @@ -228,7 +223,34 @@ inline bool validateConnections() { feIsValid &= lnbLive.support ? frontendMap.find(lnbLive.frontendId) != frontendMap.end() : true; feIsValid &= lnbRecord.support ? frontendMap.find(lnbRecord.frontendId) != frontendMap.end() : true; return feIsValid; if (!feIsValid) { ALOGW("[vts config] dynamic config fe connection is invalid."); return false; } bool dvrIsValid = frontendMap[live.frontendId].isSoftwareFe ? dvrMap.find(live.dvrSoftwareFeId) != dvrMap.end() : true; dvrIsValid &= playback.support ? dvrMap.find(playback.dvrId) != dvrMap.end() : true; if (record.support) { if (frontendMap[record.frontendId].isSoftwareFe) { dvrIsValid &= dvrMap.find(record.dvrSoftwareFeId) != dvrMap.end(); } dvrIsValid &= dvrMap.find(record.dvrRecordId) != dvrMap.end(); } if (descrambling.support && frontendMap[descrambling.frontendId].isSoftwareFe) { dvrIsValid &= dvrMap.find(descrambling.dvrSoftwareFeId) != dvrMap.end(); } if (!dvrIsValid) { ALOGW("[vts config] dynamic config dvr connection is invalid."); return false; } return true; } // TODO: remove all the manual configs after the dynamic config refactoring is done. Loading Loading @@ -341,31 +363,6 @@ inline void initTimeFilterConfig() { timeFilterArray[TIMER0].timeStamp = 1; } /** Configuration array for the dvr test */ inline void initDvrConfig() { RecordSettings recordSettings{ .statusMask = 0xf, .lowThreshold = 0x1000, .highThreshold = 0x07fff, .dataFormat = DataFormat::TS, .packetSize = 188, }; dvrArray[DVR_RECORD0].type = DvrType::RECORD; dvrArray[DVR_RECORD0].bufferSize = FMQ_SIZE_4M; dvrArray[DVR_RECORD0].settings.record(recordSettings); PlaybackSettings playbackSettings{ .statusMask = 0xf, .lowThreshold = 0x1000, .highThreshold = 0x07fff, .dataFormat = DataFormat::TS, .packetSize = 188, }; dvrArray[DVR_PLAYBACK0].type = DvrType::PLAYBACK; dvrArray[DVR_PLAYBACK0].playbackInputFile = "/data/local/tmp/segment000000.ts"; dvrArray[DVR_PLAYBACK0].bufferSize = FMQ_SIZE_4M; dvrArray[DVR_PLAYBACK0].settings.playback(playbackSettings); }; /** Configuration array for the descrambler test */ inline void initDescramblerConfig() { descramblerArray[DESC_0].casSystemId = CLEAR_KEY_SYSTEM_ID; Loading
tv/tuner/config/OWNERS 0 → 100644 +4 −0 Original line number Diff line number Diff line nchalko@google.com amyjojo@google.com shubang@google.com quxiangfang@google.com
tv/tuner/config/TunerTestingConfigReader.h +95 −2 Original line number Diff line number Diff line Loading @@ -70,8 +70,16 @@ struct FrontendConfig { vector<FrontendStatus> expectTuneStatuses; }; struct DvrConfig { DvrType type; uint32_t bufferSize; DvrSettings settings; string playbackInputFile; }; struct LiveBroadcastHardwareConnections { string frontendId; string dvrSoftwareFeId; /* string audioFilterId; string videoFilterId; list string of extra filters; */ Loading @@ -81,9 +89,20 @@ struct ScanHardwareConnections { string frontendId; }; struct DvrPlaybackHardwareConnections { bool support; string frontendId; string dvrId; /* string audioFilterId; string videoFilterId; list string of extra filters; */ }; struct DvrRecordHardwareConnections { bool support; string frontendId; string dvrRecordId; string dvrSoftwareFeId; /* string recordFilterId; string dvrId; */ }; Loading @@ -91,6 +110,7 @@ struct DvrRecordHardwareConnections { struct DescramblingHardwareConnections { bool support; string frontendId; string dvrSoftwareFeId; /* string descramblerId; string audioFilterId; string videoFilterId; Loading Loading @@ -196,9 +216,41 @@ struct TunerTestingConfigReader { } } static void readDvrConfig1_0(map<string, DvrConfig>& dvrMap) { auto hardwareConfig = getHardwareConfig(); if (hardwareConfig.hasDvrs()) { auto dvrs = *hardwareConfig.getFirstDvrs(); for (auto dvrConfig : dvrs.getDvr()) { string id = dvrConfig.getId(); DvrType type; switch (dvrConfig.getType()) { case DvrTypeEnum::PLAYBACK: type = DvrType::PLAYBACK; dvrMap[id].settings.playback(readPlaybackSettings(dvrConfig)); break; case DvrTypeEnum::RECORD: type = DvrType::RECORD; dvrMap[id].settings.record(readRecordSettings(dvrConfig)); break; case DvrTypeEnum::UNKNOWN: ALOGW("[ConfigReader] invalid DVR type"); return; } dvrMap[id].type = type; dvrMap[id].bufferSize = static_cast<uint32_t>(dvrConfig.getBufferSize()); if (dvrConfig.hasInputFilePath()) { dvrMap[id].playbackInputFile = dvrConfig.getInputFilePath(); } } } } static void connectLiveBroadcast(LiveBroadcastHardwareConnections& live) { auto liveConfig = getDataFlowConfiguration().getFirstClearLiveBroadcast(); live.frontendId = liveConfig->getFrontendConnection(); if (liveConfig->hasDvrSoftwareFeConnection()) { live.dvrSoftwareFeId = liveConfig->getDvrSoftwareFeConnection(); } } static void connectScan(ScanHardwareConnections& scan) { Loading @@ -206,6 +258,16 @@ struct TunerTestingConfigReader { scan.frontendId = scanConfig->getFrontendConnection(); } static void connectDvrPlayback(DvrPlaybackHardwareConnections& playback) { auto dataFlow = getDataFlowConfiguration(); if (!dataFlow.hasDvrPlayback()) { playback.support = false; return; } auto playbackConfig = dataFlow.getFirstDvrPlayback(); playback.dvrId = playbackConfig->getDvrConnection(); } static void connectDvrRecord(DvrRecordHardwareConnections& record) { auto dataFlow = getDataFlowConfiguration(); if (!dataFlow.hasDvrRecord()) { Loading @@ -214,6 +276,10 @@ struct TunerTestingConfigReader { } auto recordConfig = dataFlow.getFirstDvrRecord(); record.frontendId = recordConfig->getFrontendConnection(); record.dvrRecordId = recordConfig->getDvrRecordConnection(); if (recordConfig->hasDvrSoftwareFeConnection()) { record.dvrSoftwareFeId = recordConfig->getDvrSoftwareFeConnection(); } } static void connectDescrambling(DescramblingHardwareConnections& descrambling) { Loading @@ -224,6 +290,9 @@ struct TunerTestingConfigReader { } auto descConfig = dataFlow.getFirstDescrambling(); descrambling.frontendId = descConfig->getFrontendConnection(); if (descConfig->hasDvrSoftwareFeConnection()) { descrambling.dvrSoftwareFeId = descConfig->getDvrSoftwareFeConnection(); } } static void connectLnbLive(LnbLiveHardwareConnections& lnbLive) { Loading @@ -248,7 +317,7 @@ struct TunerTestingConfigReader { private: static FrontendDvbtSettings readDvbtFrontendSettings(Frontend feConfig) { ALOGW("[ConfigReader] type is dvbt"); ALOGW("[ConfigReader] fe type is dvbt"); FrontendDvbtSettings dvbtSettings{ .frequency = (uint32_t)feConfig.getFrequency(), }; Loading @@ -266,7 +335,7 @@ struct TunerTestingConfigReader { } static FrontendDvbsSettings readDvbsFrontendSettings(Frontend feConfig) { ALOGW("[ConfigReader] type is dvbs"); ALOGW("[ConfigReader] fe type is dvbs"); FrontendDvbsSettings dvbsSettings{ .frequency = (uint32_t)feConfig.getFrequency(), }; Loading @@ -281,6 +350,30 @@ struct TunerTestingConfigReader { return dvbsSettings; } static PlaybackSettings readPlaybackSettings(Dvr dvrConfig) { ALOGW("[ConfigReader] dvr type is playback"); PlaybackSettings playbackSettings{ .statusMask = static_cast<uint8_t>(dvrConfig.getStatusMask()), .lowThreshold = static_cast<uint32_t>(dvrConfig.getLowThreshold()), .highThreshold = static_cast<uint32_t>(dvrConfig.getHighThreshold()), .dataFormat = static_cast<DataFormat>(dvrConfig.getDataFormat()), .packetSize = static_cast<uint8_t>(dvrConfig.getPacketSize()), }; return playbackSettings; } static RecordSettings readRecordSettings(Dvr dvrConfig) { ALOGW("[ConfigReader] dvr type is record"); RecordSettings recordSettings{ .statusMask = static_cast<uint8_t>(dvrConfig.getStatusMask()), .lowThreshold = static_cast<uint32_t>(dvrConfig.getLowThreshold()), .highThreshold = static_cast<uint32_t>(dvrConfig.getHighThreshold()), .dataFormat = static_cast<DataFormat>(dvrConfig.getDataFormat()), .packetSize = static_cast<uint8_t>(dvrConfig.getPacketSize()), }; return recordSettings; } static TunerConfiguration getTunerConfig() { return *read(configFilePath.c_str()); } static HardwareConfiguration getHardwareConfig() { Loading