Merge "Refactoring the Dvr data flow tests in the Tuner VTS" into rvc-dev am: 5a49885b8c

Change-Id: I411b4c03bdc5f92b7117081ac7c1f7d4c47d27f0
This commit is contained in:
Amy Zhang 2020-04-30 00:17:21 +00:00 committed by Automerger Merge Worker
commit b311b094eb
9 changed files with 266 additions and 341 deletions

View file

@ -73,18 +73,22 @@ Return<Result> Filter::configure(const DemuxFilterSettings& settings) {
switch (mType.mainType) { switch (mType.mainType) {
case DemuxFilterMainType::TS: case DemuxFilterMainType::TS:
mTpid = settings.ts().tpid; mTpid = settings.ts().tpid;
if (mType.subType.tsFilterType() == DemuxTsFilterType::AUDIO ||
mType.subType.tsFilterType() == DemuxTsFilterType::VIDEO) {
mIsMediaFilter = true;
}
break; break;
case DemuxFilterMainType::MMTP: case DemuxFilterMainType::MMTP:
/*mmtpSettings*/ if (mType.subType.mmtpFilterType() == DemuxMmtpFilterType::AUDIO ||
mType.subType.mmtpFilterType() == DemuxMmtpFilterType::VIDEO) {
mIsMediaFilter = true;
}
break; break;
case DemuxFilterMainType::IP: case DemuxFilterMainType::IP:
/*ipSettings*/
break; break;
case DemuxFilterMainType::TLV: case DemuxFilterMainType::TLV:
/*tlvSettings*/
break; break;
case DemuxFilterMainType::ALP: case DemuxFilterMainType::ALP:
/*alpSettings*/
break; break;
default: default:
break; break;
@ -241,9 +245,7 @@ void Filter::filterThreadLoop() {
} }
void Filter::freeAvHandle() { void Filter::freeAvHandle() {
if (mType.mainType != DemuxFilterMainType::TS || if (!mIsMediaFilter) {
(mType.subType.tsFilterType() == DemuxTsFilterType::AUDIO &&
mType.subType.tsFilterType() == DemuxTsFilterType::VIDEO)) {
return; return;
} }
for (int i = 0; i < mFilterEvent.events.size(); i++) { for (int i = 0; i < mFilterEvent.events.size(); i++) {

View file

@ -103,6 +103,7 @@ class Filter : public IFilter {
uint32_t mFilterId; uint32_t mFilterId;
uint32_t mBufferSize; uint32_t mBufferSize;
DemuxFilterType mType; DemuxFilterType mType;
bool mIsMediaFilter = false;
DemuxFilterSettings mFilterSettings; DemuxFilterSettings mFilterSettings;
uint16_t mTpid; uint16_t mTpid;

View file

@ -186,14 +186,14 @@ void DvrCallback::stopRecordThread() {
android::Mutex::Autolock autoLock(mRecordThreadLock); android::Mutex::Autolock autoLock(mRecordThreadLock);
} }
AssertionResult DvrTests::openDvrInDemux(DvrType type) { AssertionResult DvrTests::openDvrInDemux(DvrType type, uint32_t bufferSize) {
Result status; Result status;
EXPECT_TRUE(mDemux) << "Test with openDemux first."; EXPECT_TRUE(mDemux) << "Test with openDemux first.";
// Create dvr callback // Create dvr callback
mDvrCallback = new DvrCallback(); mDvrCallback = new DvrCallback();
mDemux->openDvr(type, FMQ_SIZE_1M, mDvrCallback, [&](Result result, const sp<IDvr>& dvr) { mDemux->openDvr(type, bufferSize, mDvrCallback, [&](Result result, const sp<IDvr>& dvr) {
mDvr = dvr; mDvr = dvr;
status = result; status = result;
}); });
@ -264,4 +264,4 @@ void DvrTests::closeDvr() {
ASSERT_TRUE(mDemux); ASSERT_TRUE(mDemux);
ASSERT_TRUE(mDvr); ASSERT_TRUE(mDvr);
ASSERT_TRUE(mDvr->close() == Result::SUCCESS); ASSERT_TRUE(mDvr->close() == Result::SUCCESS);
} }

View file

@ -146,7 +146,7 @@ class DvrTests {
void setService(sp<ITuner> tuner) { mService = tuner; } void setService(sp<ITuner> tuner) { mService = tuner; }
void setDemux(sp<IDemux> demux) { mDemux = demux; } void setDemux(sp<IDemux> demux) { mDemux = demux; }
void startPlaybackInputThread(string dataInputFile, PlaybackSettings settings) { void startPlaybackInputThread(string& dataInputFile, PlaybackSettings& settings) {
PlaybackConf conf{ PlaybackConf conf{
.inputDataFile = dataInputFile, .inputDataFile = dataInputFile,
.setting = settings, .setting = settings,
@ -162,7 +162,7 @@ class DvrTests {
void testRecordOutput() { mDvrCallback->testRecordOutput(); } void testRecordOutput() { mDvrCallback->testRecordOutput(); }
void stopRecordThread() { mDvrCallback->stopPlaybackThread(); } void stopRecordThread() { mDvrCallback->stopPlaybackThread(); }
AssertionResult openDvrInDemux(DvrType type); AssertionResult openDvrInDemux(DvrType type, uint32_t bufferSize);
AssertionResult configDvr(DvrSettings setting); AssertionResult configDvr(DvrSettings setting);
AssertionResult getDvrMQDescriptor(); AssertionResult getDvrMQDescriptor();
AssertionResult attachFilterToDvr(sp<IFilter> filter); AssertionResult attachFilterToDvr(sp<IFilter> filter);
@ -184,4 +184,4 @@ class DvrTests {
pthread_t mPlaybackshread; pthread_t mPlaybackshread;
bool mPlaybackThreadRunning; bool mPlaybackThreadRunning;
}; };

View file

@ -128,7 +128,7 @@ bool FilterCallback::dumpAvData(DemuxFilterMediaEvent event) {
return true; return true;
} }
AssertionResult FilterTests::openFilterInDemux(DemuxFilterType type) { AssertionResult FilterTests::openFilterInDemux(DemuxFilterType type, uint32_t bufferSize) {
Result status; Result status;
EXPECT_TRUE(mDemux) << "Test with openDemux first."; EXPECT_TRUE(mDemux) << "Test with openDemux first.";
@ -136,7 +136,7 @@ AssertionResult FilterTests::openFilterInDemux(DemuxFilterType type) {
mFilterCallback = new FilterCallback(); mFilterCallback = new FilterCallback();
// Add filter to the local demux // Add filter to the local demux
mDemux->openFilter(type, FMQ_SIZE_16M, mFilterCallback, mDemux->openFilter(type, bufferSize, mFilterCallback,
[&](Result result, const sp<IFilter>& filter) { [&](Result result, const sp<IFilter>& filter) {
mFilter = filter; mFilter = filter;
status = result; status = result;
@ -223,4 +223,4 @@ AssertionResult FilterTests::closeFilter(uint32_t filterId) {
mFilters.erase(filterId); mFilters.erase(filterId);
} }
return AssertionResult(status == Result::SUCCESS); return AssertionResult(status == Result::SUCCESS);
} }

View file

@ -78,9 +78,6 @@ enum FilterEventType : uint8_t {
using FilterMQ = MessageQueue<uint8_t, kSynchronizedReadWrite>; using FilterMQ = MessageQueue<uint8_t, kSynchronizedReadWrite>;
using MQDesc = MQDescriptorSync<uint8_t>; using MQDesc = MQDescriptorSync<uint8_t>;
const uint32_t FMQ_SIZE_1M = 0x100000;
const uint32_t FMQ_SIZE_16M = 0x1000000;
#define WAIT_TIMEOUT 3000000000 #define WAIT_TIMEOUT 3000000000
class FilterCallback : public IFilterCallback { class FilterCallback : public IFilterCallback {
@ -153,7 +150,7 @@ class FilterTests {
std::map<uint32_t, sp<FilterCallback>> getFilterCallbacks() { return mFilterCallbacks; } std::map<uint32_t, sp<FilterCallback>> getFilterCallbacks() { return mFilterCallbacks; }
AssertionResult openFilterInDemux(DemuxFilterType type); AssertionResult openFilterInDemux(DemuxFilterType type, uint32_t bufferSize);
AssertionResult getNewlyOpenedFilterId(uint32_t& filterId); AssertionResult getNewlyOpenedFilterId(uint32_t& filterId);
AssertionResult configFilter(DemuxFilterSettings setting, uint32_t filterId); AssertionResult configFilter(DemuxFilterSettings setting, uint32_t filterId);
AssertionResult getFilterMQDescriptor(uint32_t filterId); AssertionResult getFilterMQDescriptor(uint32_t filterId);

View file

@ -17,7 +17,7 @@
#include "VtsHalTvTunerV1_0TargetTest.h" #include "VtsHalTvTunerV1_0TargetTest.h"
namespace { namespace {
/*======================== Start Descrambler APIs Tests Implementation ========================*/
AssertionResult TunerHidlTest::createDescrambler(uint32_t demuxId) { AssertionResult TunerHidlTest::createDescrambler(uint32_t demuxId) {
Result status; Result status;
mService->openDescrambler([&](Result result, const sp<IDescrambler>& descrambler) { mService->openDescrambler([&](Result result, const sp<IDescrambler>& descrambler) {
@ -46,10 +46,8 @@ AssertionResult TunerHidlTest::closeDescrambler() {
mDescrambler = nullptr; mDescrambler = nullptr;
return AssertionResult(status == Result::SUCCESS); return AssertionResult(status == Result::SUCCESS);
} }
/*========================= End Descrambler APIs Tests Implementation =========================*/
/*========================== Start Data Flow Tests Implementation ==========================*/ AssertionResult TunerBroadcastHidlTest::filterDataOutputTest(vector<string> /*goldenOutputFiles*/) {
AssertionResult TunerHidlTest::broadcastDataFlowTest(vector<string> /*goldenOutputFiles*/) {
// Data Verify Module // Data Verify Module
std::map<uint32_t, sp<FilterCallback>>::iterator it; std::map<uint32_t, sp<FilterCallback>>::iterator it;
std::map<uint32_t, sp<FilterCallback>> filterCallbacks = mFilterTests.getFilterCallbacks(); std::map<uint32_t, sp<FilterCallback>> filterCallbacks = mFilterTests.getFilterCallbacks();
@ -59,154 +57,43 @@ AssertionResult TunerHidlTest::broadcastDataFlowTest(vector<string> /*goldenOutp
return success(); return success();
} }
/* AssertionResult TunerPlaybackHidlTest::filterDataOutputTest(vector<string> /*goldenOutputFiles*/) {
* TODO: re-enable the tests after finalizing the test refactoring.
*/
/*AssertionResult TunerHidlTest::playbackDataFlowTest(
vector<FilterConf> filterConf, PlaybackConf playbackConf,
vector<string> \/\*goldenOutputFiles\*\/) {
Result status;
int filterIdsSize;
// Filter Configuration Module
for (int i = 0; i < filterConf.size(); i++) {
if (addFilterToDemux(filterConf[i].type, filterConf[i].setting) ==
failure() ||
// TODO use a map to save the FMQs/EvenFlags and pass to callback
getFilterMQDescriptor() == failure()) {
return failure();
}
filterIdsSize = mUsedFilterIds.size();
mUsedFilterIds.resize(filterIdsSize + 1);
mUsedFilterIds[filterIdsSize] = mFilterId;
mFilters[mFilterId] = mFilter;
mFilterCallbacks[mFilterId] = mFilterCallback;
mFilterCallback->updateFilterMQ(mFilterMQDescriptor);
// mDemuxCallback->updateGoldenOutputMap(goldenOutputFiles[i]);
status = mFilter->start();
if (status != Result::SUCCESS) {
return failure();
}
}
// Playback Input Module
PlaybackSettings playbackSetting = playbackConf.setting;
if (addPlaybackToDemux(playbackSetting) == failure() ||
getPlaybackMQDescriptor() == failure()) {
return failure();
}
for (int i = 0; i <= filterIdsSize; i++) {
if (mDvr->attachFilter(mFilters[mUsedFilterIds[i]]) != Result::SUCCESS) {
return failure();
}
}
mDvrCallback->startPlaybackInputThread(playbackConf, mPlaybackMQDescriptor);
status = mDvr->start();
if (status != Result::SUCCESS) {
return failure();
}
// Data Verify Module // Data Verify Module
std::map<uint32_t, sp<FilterCallback>>::iterator it; std::map<uint32_t, sp<FilterCallback>>::iterator it;
for (it = mFilterCallbacks.begin(); it != mFilterCallbacks.end(); it++) { std::map<uint32_t, sp<FilterCallback>> filterCallbacks = mFilterTests.getFilterCallbacks();
for (it = filterCallbacks.begin(); it != filterCallbacks.end(); it++) {
it->second->testFilterDataOutput(); it->second->testFilterDataOutput();
} }
mDvrCallback->stopPlaybackThread(); return success();
// Clean Up Module
for (int i = 0; i <= filterIdsSize; i++) {
if (mFilters[mUsedFilterIds[i]]->stop() != Result::SUCCESS) {
return failure();
}
}
if (mDvr->stop() != Result::SUCCESS) {
return failure();
}
mUsedFilterIds.clear();
mFilterCallbacks.clear();
mFilters.clear();
return closeDemux();
} }
AssertionResult TunerHidlTest::recordDataFlowTest(vector<FilterConf> filterConf, void TunerFilterHidlTest::configSingleFilterInDemuxTest(FilterConfig filterConf,
RecordSettings recordSetting, FrontendConfig frontendConf) {
vector<string> goldenOutputFiles) { uint32_t feId;
Result status; uint32_t demuxId;
hidl_vec<FrontendId> feIds; sp<IDemux> demux;
uint32_t filterId;
mService->getFrontendIds([&](Result result, const hidl_vec<FrontendId>& frontendIds) { mFrontendTests.getFrontendIdByType(frontendConf.type, feId);
status = result; ASSERT_TRUE(feId != INVALID_ID);
feIds = frontendIds; ASSERT_TRUE(mFrontendTests.openFrontendById(feId));
}); ASSERT_TRUE(mFrontendTests.setFrontendCallback());
ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId));
ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId));
mFilterTests.setDemux(demux);
ASSERT_TRUE(mFilterTests.openFilterInDemux(filterConf.type, filterConf.bufferSize));
ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(filterId));
ASSERT_TRUE(mFilterTests.configFilter(filterConf.settings, filterId));
ASSERT_TRUE(mFilterTests.getFilterMQDescriptor(filterId));
ASSERT_TRUE(mFilterTests.startFilter(filterId));
ASSERT_TRUE(mFilterTests.stopFilter(filterId));
ASSERT_TRUE(mFilterTests.closeFilter(filterId));
ASSERT_TRUE(mDemuxTests.closeDemux());
ASSERT_TRUE(mFrontendTests.closeFrontend());
}
if (feIds.size() == 0) { void TunerBroadcastHidlTest::broadcastSingleFilterTest(FilterConfig filterConf,
ALOGW("[ WARN ] Frontend isn't available"); FrontendConfig frontendConf) {
return failure();
}
FrontendDvbtSettings dvbt{
.frequency = 1000,
};
FrontendSettings settings;
settings.dvbt(dvbt);
int filterIdsSize;
// Filter Configuration Module
for (int i = 0; i < filterConf.size(); i++) {
if (addFilterToDemux(filterConf[i].type, filterConf[i].setting) ==
failure() ||
// TODO use a map to save the FMQs/EvenFlags and pass to callback
getFilterMQDescriptor() == failure()) {
return failure();
}
filterIdsSize = mUsedFilterIds.size();
mUsedFilterIds.resize(filterIdsSize + 1);
mUsedFilterIds[filterIdsSize] = mFilterId;
mFilters[mFilterId] = mFilter;
}
// Record Config Module
if (addRecordToDemux(recordSetting) == failure() ||
getRecordMQDescriptor() == failure()) {
return failure();
}
for (int i = 0; i <= filterIdsSize; i++) {
if (mDvr->attachFilter(mFilters[mUsedFilterIds[i]]) != Result::SUCCESS) {
return failure();
}
}
mDvrCallback->startRecordOutputThread(recordSetting, mRecordMQDescriptor);
status = mDvr->start();
if (status != Result::SUCCESS) {
return failure();
}
if (setDemuxFrontendDataSource(feIds[0]) != success()) {
return failure();
}
// Data Verify Module
mDvrCallback->testRecordOutput();
// Clean Up Module
for (int i = 0; i <= filterIdsSize; i++) {
if (mFilters[mUsedFilterIds[i]]->stop() != Result::SUCCESS) {
return failure();
}
}
if (mFrontend->stopTune() != Result::SUCCESS) {
return failure();
}
mUsedFilterIds.clear();
mFilterCallbacks.clear();
mFilters.clear();
return closeDemux();
}*/
/*========================= End Data Flow Tests Implementation =========================*/
/*================================= Start Test Module =================================*/
void TunerHidlTest::broadcastSingleFilterTest(FilterConfig filterConf,
FrontendConfig frontendConf) {
uint32_t feId; uint32_t feId;
uint32_t demuxId; uint32_t demuxId;
sp<IDemux> demux; sp<IDemux> demux;
@ -224,15 +111,14 @@ void TunerHidlTest::broadcastSingleFilterTest(FilterConfig filterConf,
ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId));
ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId));
mFilterTests.setDemux(demux); mFilterTests.setDemux(demux);
ASSERT_TRUE(mFilterTests.openFilterInDemux(filterConf.type)); ASSERT_TRUE(mFilterTests.openFilterInDemux(filterConf.type, filterConf.bufferSize));
ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(filterId)); ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(filterId));
ASSERT_TRUE(mFilterTests.configFilter(filterConf.settings, filterId)); ASSERT_TRUE(mFilterTests.configFilter(filterConf.settings, filterId));
ASSERT_TRUE(mFilterTests.getFilterMQDescriptor(filterId)); ASSERT_TRUE(mFilterTests.getFilterMQDescriptor(filterId));
ASSERT_TRUE(mFilterTests.startFilter(filterId)); ASSERT_TRUE(mFilterTests.startFilter(filterId));
// tune test // tune test
ASSERT_TRUE(mFrontendTests.tuneFrontend(frontendConf)); ASSERT_TRUE(mFrontendTests.tuneFrontend(frontendConf));
// broadcast data flow test ASSERT_TRUE(filterDataOutputTest(goldenOutputFiles));
ASSERT_TRUE(broadcastDataFlowTest(goldenOutputFiles));
ASSERT_TRUE(mFrontendTests.stopTuneFrontend()); ASSERT_TRUE(mFrontendTests.stopTuneFrontend());
ASSERT_TRUE(mFilterTests.stopFilter(filterId)); ASSERT_TRUE(mFilterTests.stopFilter(filterId));
ASSERT_TRUE(mFilterTests.closeFilter(filterId)); ASSERT_TRUE(mFilterTests.closeFilter(filterId));
@ -240,9 +126,38 @@ void TunerHidlTest::broadcastSingleFilterTest(FilterConfig filterConf,
ASSERT_TRUE(mFrontendTests.closeFrontend()); ASSERT_TRUE(mFrontendTests.closeFrontend());
} }
void TunerDvrHidlTest::attachSingleFilterToDvrTest(FilterConfig filterConf, void TunerPlaybackHidlTest::playbackSingleFilterTest(FilterConfig filterConf, DvrConfig dvrConf) {
FrontendConfig frontendConf, DvrConfig dvrConf) { uint32_t demuxId;
description("Open and configure a Dvr in Demux."); sp<IDemux> demux;
uint32_t filterId;
sp<IFilter> filter;
ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId));
mFilterTests.setDemux(demux);
mDvrTests.setDemux(demux);
ASSERT_TRUE(mDvrTests.openDvrInDemux(dvrConf.type, dvrConf.bufferSize));
ASSERT_TRUE(mDvrTests.configDvr(dvrConf.settings));
ASSERT_TRUE(mDvrTests.getDvrMQDescriptor());
ASSERT_TRUE(mFilterTests.openFilterInDemux(filterConf.type, filterConf.bufferSize));
ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(filterId));
ASSERT_TRUE(mFilterTests.configFilter(filterConf.settings, filterId));
ASSERT_TRUE(mFilterTests.getFilterMQDescriptor(filterId));
filter = mFilterTests.getFilterById(filterId);
ASSERT_TRUE(filter != nullptr);
mDvrTests.startPlaybackInputThread(dvrConf.playbackInputFile, dvrConf.settings.playback());
ASSERT_TRUE(mDvrTests.startDvr());
ASSERT_TRUE(mFilterTests.startFilter(filterId));
ASSERT_TRUE(filterDataOutputTest(goldenOutputFiles));
mDvrTests.stopPlaybackThread();
ASSERT_TRUE(mFilterTests.stopFilter(filterId));
ASSERT_TRUE(mDvrTests.stopDvr());
ASSERT_TRUE(mFilterTests.closeFilter(filterId));
mDvrTests.closeDvr();
ASSERT_TRUE(mDemuxTests.closeDemux());
}
void TunerRecordHidlTest::recordSingleFilterTest(FilterConfig filterConf,
FrontendConfig frontendConf, DvrConfig dvrConf) {
uint32_t feId; uint32_t feId;
uint32_t demuxId; uint32_t demuxId;
sp<IDemux> demux; sp<IDemux> demux;
@ -257,31 +172,38 @@ void TunerDvrHidlTest::attachSingleFilterToDvrTest(FilterConfig filterConf,
ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId));
mFilterTests.setDemux(demux); mFilterTests.setDemux(demux);
mDvrTests.setDemux(demux); mDvrTests.setDemux(demux);
ASSERT_TRUE(mDvrTests.openDvrInDemux(dvrConf.type)); ASSERT_TRUE(mDvrTests.openDvrInDemux(dvrConf.type, dvrConf.bufferSize));
ASSERT_TRUE(mDvrTests.configDvr(dvrConf.settings)); ASSERT_TRUE(mDvrTests.configDvr(dvrConf.settings));
ASSERT_TRUE(mDvrTests.getDvrMQDescriptor()); ASSERT_TRUE(mDvrTests.getDvrMQDescriptor());
ASSERT_TRUE(mFilterTests.openFilterInDemux(filterConf.type)); ASSERT_TRUE(mFilterTests.openFilterInDemux(filterConf.type, filterConf.bufferSize));
ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(filterId)); ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(filterId));
ASSERT_TRUE(mFilterTests.configFilter(filterConf.settings, filterId)); ASSERT_TRUE(mFilterTests.configFilter(filterConf.settings, filterId));
ASSERT_TRUE(mFilterTests.getFilterMQDescriptor(filterId)); ASSERT_TRUE(mFilterTests.getFilterMQDescriptor(filterId));
ASSERT_TRUE(mFilterTests.startFilter(filterId));
filter = mFilterTests.getFilterById(filterId); filter = mFilterTests.getFilterById(filterId);
ASSERT_TRUE(filter != nullptr); ASSERT_TRUE(filter != nullptr);
ASSERT_TRUE(mDvrTests.attachFilterToDvr(filter)); ASSERT_TRUE(mDvrTests.attachFilterToDvr(filter));
ASSERT_TRUE(mDvrTests.detachFilterToDvr(filter)); mDvrTests.startRecordOutputThread(dvrConf.settings.record());
ASSERT_TRUE(mDvrTests.startDvr());
ASSERT_TRUE(mFilterTests.startFilter(filterId));
mDvrTests.testRecordOutput();
mDvrTests.stopRecordThread();
ASSERT_TRUE(mFilterTests.stopFilter(filterId)); ASSERT_TRUE(mFilterTests.stopFilter(filterId));
ASSERT_TRUE(mDvrTests.stopDvr());
ASSERT_TRUE(mDvrTests.detachFilterToDvr(filter));
ASSERT_TRUE(mFilterTests.closeFilter(filterId)); ASSERT_TRUE(mFilterTests.closeFilter(filterId));
mDvrTests.closeDvr(); mDvrTests.closeDvr();
ASSERT_TRUE(mDemuxTests.closeDemux()); ASSERT_TRUE(mDemuxTests.closeDemux());
ASSERT_TRUE(mFrontendTests.closeFrontend()); ASSERT_TRUE(mFrontendTests.closeFrontend());
} }
void TunerFilterHidlTest::configSingleFilterInDemuxTest(FilterConfig filterConf, void TunerRecordHidlTest::attachSingleFilterToRecordDvrTest(FilterConfig filterConf,
FrontendConfig frontendConf) { FrontendConfig frontendConf,
DvrConfig dvrConf) {
uint32_t feId; uint32_t feId;
uint32_t demuxId; uint32_t demuxId;
sp<IDemux> demux; sp<IDemux> demux;
uint32_t filterId; uint32_t filterId;
sp<IFilter> filter;
mFrontendTests.getFrontendIdByType(frontendConf.type, feId); mFrontendTests.getFrontendIdByType(frontendConf.type, feId);
ASSERT_TRUE(feId != INVALID_ID); ASSERT_TRUE(feId != INVALID_ID);
@ -290,20 +212,28 @@ void TunerFilterHidlTest::configSingleFilterInDemuxTest(FilterConfig filterConf,
ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId));
ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId));
mFilterTests.setDemux(demux); mFilterTests.setDemux(demux);
ASSERT_TRUE(mFilterTests.openFilterInDemux(filterConf.type)); mDvrTests.setDemux(demux);
ASSERT_TRUE(mDvrTests.openDvrInDemux(dvrConf.type, dvrConf.bufferSize));
ASSERT_TRUE(mDvrTests.configDvr(dvrConf.settings));
ASSERT_TRUE(mDvrTests.getDvrMQDescriptor());
ASSERT_TRUE(mFilterTests.openFilterInDemux(filterConf.type, filterConf.bufferSize));
ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(filterId)); ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(filterId));
ASSERT_TRUE(mFilterTests.configFilter(filterConf.settings, filterId)); ASSERT_TRUE(mFilterTests.configFilter(filterConf.settings, filterId));
ASSERT_TRUE(mFilterTests.getFilterMQDescriptor(filterId)); ASSERT_TRUE(mFilterTests.getFilterMQDescriptor(filterId));
filter = mFilterTests.getFilterById(filterId);
ASSERT_TRUE(filter != nullptr);
ASSERT_TRUE(mDvrTests.attachFilterToDvr(filter));
ASSERT_TRUE(mDvrTests.startDvr());
ASSERT_TRUE(mFilterTests.startFilter(filterId)); ASSERT_TRUE(mFilterTests.startFilter(filterId));
ASSERT_TRUE(mFilterTests.stopFilter(filterId)); ASSERT_TRUE(mFilterTests.stopFilter(filterId));
ASSERT_TRUE(mDvrTests.stopDvr());
ASSERT_TRUE(mDvrTests.detachFilterToDvr(filter));
ASSERT_TRUE(mFilterTests.closeFilter(filterId)); ASSERT_TRUE(mFilterTests.closeFilter(filterId));
mDvrTests.closeDvr();
ASSERT_TRUE(mDemuxTests.closeDemux()); ASSERT_TRUE(mDemuxTests.closeDemux());
ASSERT_TRUE(mFrontendTests.closeFrontend()); ASSERT_TRUE(mFrontendTests.closeFrontend());
} }
/*================================== End Test Module ==================================*/
/***************************** End Test Implementation *****************************/
/******************************** Start Test Entry **********************************/
TEST_P(TunerFrontendHidlTest, TuneFrontend) { TEST_P(TunerFrontendHidlTest, TuneFrontend) {
description("Tune one Frontend with specific setting and check Lock event"); description("Tune one Frontend with specific setting and check Lock event");
mFrontendTests.tuneTest(frontendArray[DVBT]); mFrontendTests.tuneTest(frontendArray[DVBT]);
@ -331,6 +261,7 @@ TEST_P(TunerDemuxHidlTest, openDemux) {
ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId));
ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId));
ASSERT_TRUE(mDemuxTests.closeDemux()); ASSERT_TRUE(mDemuxTests.closeDemux());
ASSERT_TRUE(mFrontendTests.closeFrontend());
} }
TEST_P(TunerFilterHidlTest, StartFilterInDemux) { TEST_P(TunerFilterHidlTest, StartFilterInDemux) {
@ -339,23 +270,48 @@ TEST_P(TunerFilterHidlTest, StartFilterInDemux) {
configSingleFilterInDemuxTest(filterArray[TS_VIDEO0], frontendArray[DVBT]); configSingleFilterInDemuxTest(filterArray[TS_VIDEO0], frontendArray[DVBT]);
} }
TEST_P(TunerDvrHidlTest, AttachFiltersToRecordTest) { TEST_P(TunerBroadcastHidlTest, BroadcastDataFlowVideoFilterTest) {
description("Test Video Filter functionality in Broadcast use case.");
broadcastSingleFilterTest(filterArray[TS_VIDEO1], frontendArray[DVBS]);
}
TEST_P(TunerBroadcastHidlTest, BroadcastDataFlowAudioFilterTest) {
description("Test Audio Filter functionality in Broadcast use case.");
broadcastSingleFilterTest(filterArray[TS_AUDIO0], frontendArray[DVBS]);
}
TEST_P(TunerBroadcastHidlTest, BroadcastDataFlowTsFilterTest) {
description("Test TS Filter functionality in Broadcast use case.");
broadcastSingleFilterTest(filterArray[TS_TS0], frontendArray[DVBS]);
}
TEST_P(TunerBroadcastHidlTest, BroadcastDataFlowSectionFilterTest) {
description("Test Section Filter functionality in Broadcast use case.");
broadcastSingleFilterTest(filterArray[TS_SECTION0], frontendArray[DVBS]);
}
TEST_P(TunerBroadcastHidlTest, IonBufferTest) {
description("Test the av filter data bufferring.");
broadcastSingleFilterTest(filterArray[TS_VIDEO0], frontendArray[DVBS]);
}
TEST_P(TunerPlaybackHidlTest, PlaybackDataFlowWithTsRecordFilterTest) {
description("Feed ts data from playback and configure Ts filter to get output");
playbackSingleFilterTest(filterArray[TS_VIDEO1], dvrArray[DVR_PLAYBACK0]);
}
TEST_P(TunerRecordHidlTest, AttachFiltersToRecordTest) {
description("Attach a single filter to the record dvr test."); description("Attach a single filter to the record dvr test.");
// TODO use paramterized tests // TODO use paramterized tests
attachSingleFilterToDvrTest(filterArray[TS_VIDEO0], frontendArray[DVBT], dvrArray[DVR_RECORD0]); attachSingleFilterToRecordDvrTest(filterArray[TS_RECORD0], frontendArray[DVBT],
dvrArray[DVR_RECORD0]);
} }
TEST_P(TunerDvrHidlTest, AttachFiltersToPlaybackTest) { TEST_P(TunerRecordHidlTest, RecordDataFlowWithTsRecordFilterTest) {
description("Attach a single filter to the playback dvr test."); description("Feed ts data from frontend to recording and test with ts record filter");
// TODO use paramterized tests recordSingleFilterTest(filterArray[TS_RECORD0], frontendArray[DVBT], dvrArray[DVR_RECORD0]);
attachSingleFilterToDvrTest(filterArray[TS_VIDEO0], frontendArray[DVBT],
dvrArray[DVR_PLAYBACK0]);
} }
/*============================ Start Descrambler Tests ============================*/
/*
* TODO: re-enable the tests after finalizing the test refactoring.
*/
TEST_P(TunerHidlTest, CreateDescrambler) { TEST_P(TunerHidlTest, CreateDescrambler) {
description("Create Descrambler"); description("Create Descrambler");
uint32_t feId; uint32_t feId;
@ -368,132 +324,16 @@ TEST_P(TunerHidlTest, CreateDescrambler) {
ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId));
ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId));
ASSERT_TRUE(createDescrambler(demuxId)); ASSERT_TRUE(createDescrambler(demuxId));
ASSERT_TRUE(mDemuxTests.closeDemux());
ASSERT_TRUE(closeDescrambler()); ASSERT_TRUE(closeDescrambler());
ASSERT_TRUE(mDemuxTests.closeDemux());
ASSERT_TRUE(mFrontendTests.closeFrontend());
} }
/*============================== End Descrambler Tests ==============================*/
/*============================== Start Data Flow Tests ==============================*/
TEST_P(TunerHidlTest, BroadcastDataFlowVideoFilterTest) {
description("Test Video Filter functionality in Broadcast use case.");
broadcastSingleFilterTest(filterArray[TS_VIDEO1], frontendArray[DVBS]);
}
TEST_P(TunerHidlTest, BroadcastDataFlowAudioFilterTest) {
description("Test Audio Filter functionality in Broadcast use case.");
broadcastSingleFilterTest(filterArray[TS_AUDIO0], frontendArray[DVBS]);
}
TEST_P(TunerHidlTest, BroadcastDataFlowTsFilterTest) {
description("Test TS Filter functionality in Broadcast use case.");
broadcastSingleFilterTest(filterArray[TS_TS0], frontendArray[DVBS]);
}
TEST_P(TunerHidlTest, BroadcastDataFlowSectionFilterTest) {
description("Test Section Filter functionality in Broadcast use case.");
broadcastSingleFilterTest(filterArray[TS_SECTION0], frontendArray[DVBS]);
}
TEST_P(TunerHidlTest, IonBufferTest) {
description("Test the av filter data bufferring.");
broadcastSingleFilterTest(filterArray[TS_VIDEO0], frontendArray[DVBS]);
}
/*
* TODO: re-enable the tests after finalizing the testing stream.
*/
/*TEST_P(TunerHidlTest, PlaybackDataFlowWithSectionFilterTest) {
description("Feed ts data from playback and configure pes filter to get output");
// todo modulize the filter conf parser
vector<FilterConf> filterConf;
filterConf.resize(1);
DemuxFilterSettings filterSetting;
DemuxTsFilterSettings tsFilterSetting{
.tpid = 18,
};
DemuxFilterSectionSettings sectionFilterSetting;
tsFilterSetting.filterSettings.section(sectionFilterSetting);
filterSetting.ts(tsFilterSetting);
DemuxFilterType type{
.mainType = DemuxFilterMainType::TS,
};
type.subType.tsFilterType(DemuxTsFilterType::SECTION);
FilterConf sectionFilterConf{
.type = type,
.setting = filterSetting,
};
filterConf[0] = sectionFilterConf;
PlaybackSettings playbackSetting{
.statusMask = 0xf,
.lowThreshold = 0x1000,
.highThreshold = 0x07fff,
.dataFormat = DataFormat::TS,
.packetSize = 188,
};
PlaybackConf playbackConf{
.inputDataFile = "/vendor/etc/test1.ts",
.setting = playbackSetting,
};
vector<string> goldenOutputFiles;
ASSERT_TRUE(playbackDataFlowTest(filterConf, playbackConf, goldenOutputFiles));
}
TEST_P(TunerHidlTest, RecordDataFlowWithTsRecordFilterTest) {
description("Feed ts data from frontend to recording and test with ts record filter");
// todo modulize the filter conf parser
vector<FilterConf> filterConf;
filterConf.resize(1);
DemuxFilterSettings filterSetting;
DemuxTsFilterSettings tsFilterSetting{
.tpid = 119,
};
DemuxFilterRecordSettings recordFilterSetting;
tsFilterSetting.filterSettings.record(recordFilterSetting);
filterSetting.ts(tsFilterSetting);
DemuxFilterType type{
.mainType = DemuxFilterMainType::TS,
};
type.subType.tsFilterType(DemuxTsFilterType::RECORD);
FilterConf recordFilterConf{
.type = type,
.setting = filterSetting,
};
filterConf[0] = recordFilterConf;
RecordSettings recordSetting{
.statusMask = 0xf,
.lowThreshold = 0x1000,
.highThreshold = 0x07fff,
.dataFormat = DataFormat::TS,
.packetSize = 188,
};
vector<string> goldenOutputFiles;
ASSERT_TRUE(recordDataFlowTest(filterConf, recordSetting, goldenOutputFiles));
}*/
/*============================== End Data Flow Tests ==============================*/
/******************************** End Test Entry **********************************/
INSTANTIATE_TEST_SUITE_P( INSTANTIATE_TEST_SUITE_P(
PerInstance, TunerFrontendHidlTest, PerInstance, TunerFrontendHidlTest,
testing::ValuesIn(android::hardware::getAllHalInstanceNames(ITuner::descriptor)), testing::ValuesIn(android::hardware::getAllHalInstanceNames(ITuner::descriptor)),
android::hardware::PrintInstanceNameToString); android::hardware::PrintInstanceNameToString);
INSTANTIATE_TEST_SUITE_P(
PerInstance, TunerHidlTest,
testing::ValuesIn(android::hardware::getAllHalInstanceNames(ITuner::descriptor)),
android::hardware::PrintInstanceNameToString);
INSTANTIATE_TEST_SUITE_P( INSTANTIATE_TEST_SUITE_P(
PerInstance, TunerDemuxHidlTest, PerInstance, TunerDemuxHidlTest,
testing::ValuesIn(android::hardware::getAllHalInstanceNames(ITuner::descriptor)), testing::ValuesIn(android::hardware::getAllHalInstanceNames(ITuner::descriptor)),
@ -505,7 +345,22 @@ INSTANTIATE_TEST_SUITE_P(
android::hardware::PrintInstanceNameToString); android::hardware::PrintInstanceNameToString);
INSTANTIATE_TEST_SUITE_P( INSTANTIATE_TEST_SUITE_P(
PerInstance, TunerDvrHidlTest, PerInstance, TunerBroadcastHidlTest,
testing::ValuesIn(android::hardware::getAllHalInstanceNames(ITuner::descriptor)),
android::hardware::PrintInstanceNameToString);
INSTANTIATE_TEST_SUITE_P(
PerInstance, TunerPlaybackHidlTest,
testing::ValuesIn(android::hardware::getAllHalInstanceNames(ITuner::descriptor)),
android::hardware::PrintInstanceNameToString);
INSTANTIATE_TEST_SUITE_P(
PerInstance, TunerRecordHidlTest,
testing::ValuesIn(android::hardware::getAllHalInstanceNames(ITuner::descriptor)),
android::hardware::PrintInstanceNameToString);
INSTANTIATE_TEST_SUITE_P(
PerInstance, TunerHidlTest,
testing::ValuesIn(android::hardware::getAllHalInstanceNames(ITuner::descriptor)), testing::ValuesIn(android::hardware::getAllHalInstanceNames(ITuner::descriptor)),
android::hardware::PrintInstanceNameToString); android::hardware::PrintInstanceNameToString);
} // namespace } // namespace

View file

@ -33,13 +33,19 @@ static AssertionResult success() {
namespace { namespace {
void initConfiguration() {
initFrontendConfig();
initFrontendScanConfig();
initFilterConfig();
initDvrConfig();
}
class TunerFrontendHidlTest : public testing::TestWithParam<std::string> { class TunerFrontendHidlTest : public testing::TestWithParam<std::string> {
public: public:
virtual void SetUp() override { virtual void SetUp() override {
mService = ITuner::getService(GetParam()); mService = ITuner::getService(GetParam());
ASSERT_NE(mService, nullptr); ASSERT_NE(mService, nullptr);
initFrontendConfig(); initConfiguration();
initFrontendScanConfig();
mFrontendTests.setService(mService); mFrontendTests.setService(mService);
} }
@ -58,9 +64,7 @@ class TunerDemuxHidlTest : public testing::TestWithParam<std::string> {
virtual void SetUp() override { virtual void SetUp() override {
mService = ITuner::getService(GetParam()); mService = ITuner::getService(GetParam());
ASSERT_NE(mService, nullptr); ASSERT_NE(mService, nullptr);
initFrontendConfig(); initConfiguration();
initFrontendScanConfig();
initFilterConfig();
mFrontendTests.setService(mService); mFrontendTests.setService(mService);
mDemuxTests.setService(mService); mDemuxTests.setService(mService);
@ -81,9 +85,7 @@ class TunerFilterHidlTest : public testing::TestWithParam<std::string> {
virtual void SetUp() override { virtual void SetUp() override {
mService = ITuner::getService(GetParam()); mService = ITuner::getService(GetParam());
ASSERT_NE(mService, nullptr); ASSERT_NE(mService, nullptr);
initFrontendConfig(); initConfiguration();
initFrontendScanConfig();
initFilterConfig();
mFrontendTests.setService(mService); mFrontendTests.setService(mService);
mDemuxTests.setService(mService); mDemuxTests.setService(mService);
@ -103,15 +105,39 @@ class TunerFilterHidlTest : public testing::TestWithParam<std::string> {
FilterTests mFilterTests; FilterTests mFilterTests;
}; };
class TunerDvrHidlTest : public testing::TestWithParam<std::string> { class TunerBroadcastHidlTest : public testing::TestWithParam<std::string> {
public: public:
virtual void SetUp() override { virtual void SetUp() override {
mService = ITuner::getService(GetParam()); mService = ITuner::getService(GetParam());
ASSERT_NE(mService, nullptr); ASSERT_NE(mService, nullptr);
initFrontendConfig(); initConfiguration();
initFrontendScanConfig();
initFilterConfig(); mFrontendTests.setService(mService);
initDvrConfig(); mDemuxTests.setService(mService);
mFilterTests.setService(mService);
}
protected:
static void description(const std::string& description) {
RecordProperty("description", description);
}
sp<ITuner> mService;
FrontendTests mFrontendTests;
DemuxTests mDemuxTests;
FilterTests mFilterTests;
AssertionResult filterDataOutputTest(vector<string> goldenOutputFiles);
void broadcastSingleFilterTest(FilterConfig filterConf, FrontendConfig frontendConf);
};
class TunerPlaybackHidlTest : public testing::TestWithParam<std::string> {
public:
virtual void SetUp() override {
mService = ITuner::getService(GetParam());
ASSERT_NE(mService, nullptr);
initConfiguration();
mFrontendTests.setService(mService); mFrontendTests.setService(mService);
mDemuxTests.setService(mService); mDemuxTests.setService(mService);
@ -124,8 +150,39 @@ class TunerDvrHidlTest : public testing::TestWithParam<std::string> {
RecordProperty("description", description); RecordProperty("description", description);
} }
void attachSingleFilterToDvrTest(FilterConfig filterConf, FrontendConfig frontendConf, sp<ITuner> mService;
DvrConfig dvrConf); FrontendTests mFrontendTests;
DemuxTests mDemuxTests;
FilterTests mFilterTests;
DvrTests mDvrTests;
AssertionResult filterDataOutputTest(vector<string> goldenOutputFiles);
void playbackSingleFilterTest(FilterConfig filterConf, DvrConfig dvrConf);
};
class TunerRecordHidlTest : public testing::TestWithParam<std::string> {
public:
virtual void SetUp() override {
mService = ITuner::getService(GetParam());
ASSERT_NE(mService, nullptr);
initConfiguration();
mFrontendTests.setService(mService);
mDemuxTests.setService(mService);
mFilterTests.setService(mService);
mDvrTests.setService(mService);
}
protected:
static void description(const std::string& description) {
RecordProperty("description", description);
}
void attachSingleFilterToRecordDvrTest(FilterConfig filterConf, FrontendConfig frontendConf,
DvrConfig dvrConf);
void recordSingleFilterTest(FilterConfig filterConf, FrontendConfig frontendConf,
DvrConfig dvrConf);
sp<ITuner> mService; sp<ITuner> mService;
FrontendTests mFrontendTests; FrontendTests mFrontendTests;
@ -139,13 +196,10 @@ class TunerHidlTest : public testing::TestWithParam<std::string> {
virtual void SetUp() override { virtual void SetUp() override {
mService = ITuner::getService(GetParam()); mService = ITuner::getService(GetParam());
ASSERT_NE(mService, nullptr); ASSERT_NE(mService, nullptr);
initFrontendConfig(); initConfiguration();
initFrontendScanConfig();
initFilterConfig();
mFrontendTests.setService(mService); mFrontendTests.setService(mService);
mDemuxTests.setService(mService); mDemuxTests.setService(mService);
mFilterTests.setService(mService);
} }
protected: protected:
@ -156,20 +210,10 @@ class TunerHidlTest : public testing::TestWithParam<std::string> {
sp<ITuner> mService; sp<ITuner> mService;
FrontendTests mFrontendTests; FrontendTests mFrontendTests;
DemuxTests mDemuxTests; DemuxTests mDemuxTests;
FilterTests mFilterTests;
sp<IDescrambler> mDescrambler; sp<IDescrambler> mDescrambler;
AssertionResult createDescrambler(uint32_t demuxId); AssertionResult createDescrambler(uint32_t demuxId);
AssertionResult closeDescrambler(); AssertionResult closeDescrambler();
AssertionResult playbackDataFlowTest(vector<FilterConfig> filterConf, PlaybackConf playbackConf,
vector<string> goldenOutputFiles);
AssertionResult recordDataFlowTest(vector<FilterConfig> filterConf,
RecordSettings recordSetting,
vector<string> goldenOutputFiles);
AssertionResult broadcastDataFlowTest(vector<string> goldenOutputFiles);
void broadcastSingleFilterTest(FilterConfig filterConf, FrontendConfig frontendConf);
}; };
} // namespace } // namespace

View file

@ -26,6 +26,7 @@ using android::hardware::tv::tuner::V1_0::DemuxFilterEvent;
using android::hardware::tv::tuner::V1_0::DemuxFilterMainType; using android::hardware::tv::tuner::V1_0::DemuxFilterMainType;
using android::hardware::tv::tuner::V1_0::DemuxFilterSettings; using android::hardware::tv::tuner::V1_0::DemuxFilterSettings;
using android::hardware::tv::tuner::V1_0::DemuxFilterType; using android::hardware::tv::tuner::V1_0::DemuxFilterType;
using android::hardware::tv::tuner::V1_0::DemuxRecordScIndexType;
using android::hardware::tv::tuner::V1_0::DemuxTpid; using android::hardware::tv::tuner::V1_0::DemuxTpid;
using android::hardware::tv::tuner::V1_0::DemuxTsFilterType; using android::hardware::tv::tuner::V1_0::DemuxTsFilterType;
using android::hardware::tv::tuner::V1_0::DvrSettings; using android::hardware::tv::tuner::V1_0::DvrSettings;
@ -45,6 +46,10 @@ using android::hardware::tv::tuner::V1_0::RecordSettings;
using namespace std; using namespace std;
const uint32_t FMQ_SIZE_1M = 0x100000;
const uint32_t FMQ_SIZE_4M = 0x400000;
const uint32_t FMQ_SIZE_16M = 0x1000000;
typedef enum { typedef enum {
TS_VIDEO0, TS_VIDEO0,
TS_VIDEO1, TS_VIDEO1,
@ -53,6 +58,7 @@ typedef enum {
TS_PCR0, TS_PCR0,
TS_SECTION0, TS_SECTION0,
TS_TS0, TS_TS0,
TS_RECORD0,
FILTER_MAX, FILTER_MAX,
} Filter; } Filter;
@ -74,6 +80,7 @@ typedef enum {
} Dvr; } Dvr;
struct FilterConfig { struct FilterConfig {
uint32_t bufferSize;
DemuxFilterType type; DemuxFilterType type;
DemuxFilterSettings settings; DemuxFilterSettings settings;
}; };
@ -93,7 +100,9 @@ struct ChannelConfig {
struct DvrConfig { struct DvrConfig {
DvrType type; DvrType type;
uint32_t bufferSize;
DvrSettings settings; DvrSettings settings;
string playbackInputFile;
}; };
static FrontendConfig frontendArray[FILTER_MAX]; static FrontendConfig frontendArray[FILTER_MAX];
@ -143,20 +152,24 @@ inline void initFilterConfig() {
// TS VIDEO filter setting for default implementation testing // TS VIDEO filter setting for default implementation testing
filterArray[TS_VIDEO0].type.mainType = DemuxFilterMainType::TS; filterArray[TS_VIDEO0].type.mainType = DemuxFilterMainType::TS;
filterArray[TS_VIDEO0].type.subType.tsFilterType(DemuxTsFilterType::VIDEO); filterArray[TS_VIDEO0].type.subType.tsFilterType(DemuxTsFilterType::VIDEO);
filterArray[TS_VIDEO0].bufferSize = FMQ_SIZE_16M;
filterArray[TS_VIDEO0].settings.ts().tpid = 119; filterArray[TS_VIDEO0].settings.ts().tpid = 119;
filterArray[TS_VIDEO0].settings.ts().filterSettings.av({.isPassthrough = false}); filterArray[TS_VIDEO0].settings.ts().filterSettings.av({.isPassthrough = false});
filterArray[TS_VIDEO1].type.mainType = DemuxFilterMainType::TS; filterArray[TS_VIDEO1].type.mainType = DemuxFilterMainType::TS;
filterArray[TS_VIDEO1].type.subType.tsFilterType(DemuxTsFilterType::VIDEO); filterArray[TS_VIDEO1].type.subType.tsFilterType(DemuxTsFilterType::VIDEO);
filterArray[TS_VIDEO1].bufferSize = FMQ_SIZE_16M;
filterArray[TS_VIDEO1].settings.ts().tpid = 81; filterArray[TS_VIDEO1].settings.ts().tpid = 81;
filterArray[TS_VIDEO1].settings.ts().filterSettings.av({.isPassthrough = false}); filterArray[TS_VIDEO1].settings.ts().filterSettings.av({.isPassthrough = false});
// TS AUDIO filter setting // TS AUDIO filter setting
filterArray[TS_AUDIO0].type.mainType = DemuxFilterMainType::TS; filterArray[TS_AUDIO0].type.mainType = DemuxFilterMainType::TS;
filterArray[TS_AUDIO0].type.subType.tsFilterType(DemuxTsFilterType::AUDIO); filterArray[TS_AUDIO0].type.subType.tsFilterType(DemuxTsFilterType::AUDIO);
filterArray[TS_AUDIO0].bufferSize = FMQ_SIZE_16M;
filterArray[TS_AUDIO0].settings.ts().tpid = 84; filterArray[TS_AUDIO0].settings.ts().tpid = 84;
filterArray[TS_AUDIO0].settings.ts().filterSettings.av({.isPassthrough = false}); filterArray[TS_AUDIO0].settings.ts().filterSettings.av({.isPassthrough = false});
// TS PES filter setting // TS PES filter setting
filterArray[TS_PES0].type.mainType = DemuxFilterMainType::TS; filterArray[TS_PES0].type.mainType = DemuxFilterMainType::TS;
filterArray[TS_PES0].type.subType.tsFilterType(DemuxTsFilterType::PES); filterArray[TS_PES0].type.subType.tsFilterType(DemuxTsFilterType::PES);
filterArray[TS_PES0].bufferSize = FMQ_SIZE_16M;
filterArray[TS_PES0].settings.ts().tpid = 256; filterArray[TS_PES0].settings.ts().tpid = 256;
filterArray[TS_PES0].settings.ts().filterSettings.pesData({ filterArray[TS_PES0].settings.ts().filterSettings.pesData({
.isRaw = false, .isRaw = false,
@ -165,20 +178,30 @@ inline void initFilterConfig() {
// TS PCR filter setting // TS PCR filter setting
filterArray[TS_PCR0].type.mainType = DemuxFilterMainType::TS; filterArray[TS_PCR0].type.mainType = DemuxFilterMainType::TS;
filterArray[TS_PCR0].type.subType.tsFilterType(DemuxTsFilterType::PCR); filterArray[TS_PCR0].type.subType.tsFilterType(DemuxTsFilterType::PCR);
filterArray[TS_PCR0].bufferSize = FMQ_SIZE_16M;
filterArray[TS_PCR0].settings.ts().tpid = 81; filterArray[TS_PCR0].settings.ts().tpid = 81;
filterArray[TS_PCR0].settings.ts().filterSettings.noinit(); filterArray[TS_PCR0].settings.ts().filterSettings.noinit();
// TS filter setting // TS filter setting
filterArray[TS_TS0].type.mainType = DemuxFilterMainType::TS; filterArray[TS_TS0].type.mainType = DemuxFilterMainType::TS;
filterArray[TS_TS0].type.subType.tsFilterType(DemuxTsFilterType::TS); filterArray[TS_TS0].type.subType.tsFilterType(DemuxTsFilterType::TS);
filterArray[TS_TS0].settings.ts().tpid = 48; filterArray[TS_TS0].bufferSize = FMQ_SIZE_16M;
filterArray[TS_TS0].settings.ts().tpid = 18;
filterArray[TS_TS0].settings.ts().filterSettings.noinit(); filterArray[TS_TS0].settings.ts().filterSettings.noinit();
// TS SECTION filter setting // TS SECTION filter setting
filterArray[TS_SECTION0].type.mainType = DemuxFilterMainType::TS; filterArray[TS_SECTION0].type.mainType = DemuxFilterMainType::TS;
filterArray[TS_SECTION0].type.subType.tsFilterType(DemuxTsFilterType::SECTION); filterArray[TS_SECTION0].type.subType.tsFilterType(DemuxTsFilterType::SECTION);
filterArray[TS_SECTION0].bufferSize = FMQ_SIZE_16M;
filterArray[TS_SECTION0].settings.ts().tpid = 48; filterArray[TS_SECTION0].settings.ts().tpid = 48;
filterArray[TS_SECTION0].settings.ts().filterSettings.section({ filterArray[TS_SECTION0].settings.ts().filterSettings.section({
.isRaw = false, .isRaw = false,
}); });
// TS RECORD filter setting
filterArray[TS_RECORD0].type.mainType = DemuxFilterMainType::TS;
filterArray[TS_RECORD0].type.subType.tsFilterType(DemuxTsFilterType::RECORD);
filterArray[TS_RECORD0].settings.ts().tpid = 81;
filterArray[TS_RECORD0].settings.ts().filterSettings.record({
.scIndexType = DemuxRecordScIndexType::NONE,
});
}; };
/** Configuration array for the dvr test */ /** Configuration array for the dvr test */
@ -191,6 +214,7 @@ inline void initDvrConfig() {
.packetSize = 188, .packetSize = 188,
}; };
dvrArray[DVR_RECORD0].type = DvrType::RECORD; dvrArray[DVR_RECORD0].type = DvrType::RECORD;
dvrArray[DVR_RECORD0].bufferSize = FMQ_SIZE_4M;
dvrArray[DVR_RECORD0].settings.record(recordSettings); dvrArray[DVR_RECORD0].settings.record(recordSettings);
PlaybackSettings playbackSettings{ PlaybackSettings playbackSettings{
.statusMask = 0xf, .statusMask = 0xf,
@ -200,5 +224,7 @@ inline void initDvrConfig() {
.packetSize = 188, .packetSize = 188,
}; };
dvrArray[DVR_PLAYBACK0].type = DvrType::PLAYBACK; dvrArray[DVR_PLAYBACK0].type = DvrType::PLAYBACK;
dvrArray[DVR_PLAYBACK0].playbackInputFile = "/vendor/etc/test1.ts";
dvrArray[DVR_PLAYBACK0].bufferSize = FMQ_SIZE_4M;
dvrArray[DVR_PLAYBACK0].settings.playback(playbackSettings); dvrArray[DVR_PLAYBACK0].settings.playback(playbackSettings);
}; };