Adjust tuner default implementation and VTS types size.
Bug: 195693712
Test: atest VtsHalTvTunerTargetTest
Test: atest android.media.tv.tuner.cts
Change-Id: Ie9d20c74b05ecc10333ca883fe38d26d78f33949
diff --git a/tv/tuner/aidl/default/Dvr.cpp b/tv/tuner/aidl/default/Dvr.cpp
index 9eadb8c..4f34b8e 100644
--- a/tv/tuner/aidl/default/Dvr.cpp
+++ b/tv/tuner/aidl/default/Dvr.cpp
@@ -237,7 +237,7 @@
}
PlaybackStatus Dvr::checkPlaybackStatusChange(uint32_t availableToWrite, uint32_t availableToRead,
- uint32_t highThreshold, uint32_t lowThreshold) {
+ int64_t highThreshold, int64_t lowThreshold) {
if (availableToWrite == 0) {
return PlaybackStatus::SPACE_FULL;
} else if (availableToRead > highThreshold) {
@@ -252,9 +252,8 @@
bool Dvr::readPlaybackFMQ(bool isVirtualFrontend, bool isRecording) {
// Read playback data from the input FMQ
- int size = mDvrMQ->availableToRead();
- uint8_t playbackPacketSize =
- static_cast<uint8_t>(mDvrSettings.get<DvrSettings::Tag::playback>().packetSize);
+ size_t size = mDvrMQ->availableToRead();
+ int64_t playbackPacketSize = mDvrSettings.get<DvrSettings::Tag::playback>().packetSize;
vector<int8_t> dataOutputBuffer;
dataOutputBuffer.resize(playbackPacketSize);
// Dispatch the packet to the PID matching filter output buffer
@@ -461,7 +460,7 @@
}
RecordStatus Dvr::checkRecordStatusChange(uint32_t availableToWrite, uint32_t availableToRead,
- uint32_t highThreshold, uint32_t lowThreshold) {
+ int64_t highThreshold, int64_t lowThreshold) {
if (availableToWrite == 0) {
return RecordStatus::OVERFLOW;
} else if (availableToRead > highThreshold) {
diff --git a/tv/tuner/aidl/default/Dvr.h b/tv/tuner/aidl/default/Dvr.h
index 68933ae..586f885 100644
--- a/tv/tuner/aidl/default/Dvr.h
+++ b/tv/tuner/aidl/default/Dvr.h
@@ -101,9 +101,9 @@
void maySendPlaybackStatusCallback();
void maySendRecordStatusCallback();
PlaybackStatus checkPlaybackStatusChange(uint32_t availableToWrite, uint32_t availableToRead,
- uint32_t highThreshold, uint32_t lowThreshold);
+ int64_t highThreshold, int64_t lowThreshold);
RecordStatus checkRecordStatusChange(uint32_t availableToWrite, uint32_t availableToRead,
- uint32_t highThreshold, uint32_t lowThreshold);
+ int64_t highThreshold, int64_t lowThreshold);
/**
* A dispatcher to read and dispatch input data to all the started filters.
* Each filter handler handles the data filtering/output writing/filterEvent updating.
diff --git a/tv/tuner/aidl/default/Filter.cpp b/tv/tuner/aidl/default/Filter.cpp
index 77ca2ee..9755e39 100644
--- a/tv/tuner/aidl/default/Filter.cpp
+++ b/tv/tuner/aidl/default/Filter.cpp
@@ -646,8 +646,8 @@
DemuxFilterPesEvent pesEvent;
pesEvent = {
// temp dump meta data
- .streamId = static_cast<char16_t>(mPesOutput[3]),
- .dataLength = static_cast<char16_t>(mPesOutput.size()),
+ .streamId = static_cast<int32_t>(mPesOutput[3]),
+ .dataLength = static_cast<int32_t>(mPesOutput.size()),
};
if (DEBUG_FILTER) {
ALOGD("[Filter] assembled pes data length %d", pesEvent.dataLength);
@@ -793,7 +793,7 @@
.tableId = 0,
.version = 1,
.sectionNum = 1,
- .dataLength = static_cast<char16_t>(data.size()),
+ .dataLength = static_cast<int32_t>(data.size()),
};
mFilterEvents[size].set<DemuxFilterEvent::Tag::section>(secEvent);
return true;
@@ -891,7 +891,7 @@
mFilterEvents[size].get<DemuxFilterEvent::Tag::media>().avMemory =
::android::dupToAidl(nativeHandle);
mFilterEvents[size].get<DemuxFilterEvent::Tag::media>().dataLength =
- static_cast<int32_t>(output.size());
+ static_cast<int64_t>(output.size());
mFilterEvents[size].get<DemuxFilterEvent::Tag::media>().avDataId = static_cast<int64_t>(dataId);
if (mPts) {
mFilterEvents[size].get<DemuxFilterEvent::Tag::media>().pts = mPts;
@@ -932,10 +932,9 @@
mFilterEvents[size] = DemuxFilterEvent::make<DemuxFilterEvent::Tag::media>();
mFilterEvents[size].get<DemuxFilterEvent::Tag::media>().avMemory =
::android::dupToAidl(nativeHandle);
- mFilterEvents[size].get<DemuxFilterEvent::Tag::media>().offset =
- static_cast<int32_t>(mSharedAvMemOffset);
+ mFilterEvents[size].get<DemuxFilterEvent::Tag::media>().offset = mSharedAvMemOffset;
mFilterEvents[size].get<DemuxFilterEvent::Tag::media>().dataLength =
- static_cast<int32_t>(output.size());
+ static_cast<int64_t>(output.size());
if (mPts) {
mFilterEvents[size].get<DemuxFilterEvent::Tag::media>().pts = mPts;
mPts = 0;
diff --git a/tv/tuner/aidl/default/Filter.h b/tv/tuner/aidl/default/Filter.h
index 30eb24b..3f40256 100644
--- a/tv/tuner/aidl/default/Filter.h
+++ b/tv/tuner/aidl/default/Filter.h
@@ -221,7 +221,7 @@
// Shared A/V memory handle
native_handle_t* mSharedAvMemHandle = nullptr;
bool mUsingSharedAvMem = false;
- uint32_t mSharedAvMemOffset = 0;
+ int64_t mSharedAvMemOffset = 0;
uint32_t mAudioStreamType;
uint32_t mVideoStreamType;
diff --git a/tv/tuner/aidl/default/Frontend.cpp b/tv/tuner/aidl/default/Frontend.cpp
index 438f897..660d0bb 100644
--- a/tv/tuner/aidl/default/Frontend.cpp
+++ b/tv/tuner/aidl/default/Frontend.cpp
@@ -94,7 +94,7 @@
return ::ndk::ScopedAStatus::ok();
}
- int32_t frequency = 0;
+ int64_t frequency = 0;
switch (in_settings.getTag()) {
case FrontendSettings::Tag::analog:
frequency = in_settings.get<FrontendSettings::Tag::analog>().frequency;
@@ -133,7 +133,7 @@
{
FrontendScanMessage msg;
- vector<int32_t> frequencies = {frequency};
+ vector<int64_t> frequencies = {frequency};
msg.set<FrontendScanMessage::Tag::frequencies>(frequencies);
mCallback->onScanMessage(FrontendScanMessageType::FREQUENCY, msg);
}
@@ -165,21 +165,21 @@
{
FrontendScanMessage msg;
- vector<uint8_t> plpIds = {2};
+ vector<int32_t> plpIds = {2};
msg.set<FrontendScanMessage::Tag::plpIds>(plpIds);
mCallback->onScanMessage(FrontendScanMessageType::PLP_IDS, msg);
}
{
FrontendScanMessage msg;
- vector<uint8_t> groupIds = {3};
+ vector<int32_t> groupIds = {3};
msg.set<FrontendScanMessage::Tag::groupIds>(groupIds);
mCallback->onScanMessage(FrontendScanMessageType::GROUP_IDS, msg);
}
{
FrontendScanMessage msg;
- vector<char16_t> inputStreamIds = {1};
+ vector<int32_t> inputStreamIds = {1};
msg.set<FrontendScanMessage::Tag::inputStreamIds>(inputStreamIds);
mCallback->onScanMessage(FrontendScanMessageType::INPUT_STREAM_IDS, msg);
}
@@ -350,7 +350,7 @@
break;
}
case FrontendStatusType::PLP_ID: {
- status.set<FrontendStatus::plpId>(101); // type uint8_t
+ status.set<FrontendStatus::plpId>(101);
break;
}
case FrontendStatusType::EWBS: {
@@ -613,7 +613,7 @@
break;
}
case FrontendStatusType::ISDBT_SEGMENTS: {
- vector<uint8_t> segments = {2, 3};
+ vector<int32_t> segments = {2, 3};
status.set<FrontendStatus::isdbtSegment>(segments);
break;
}
diff --git a/tv/tuner/aidl/vts/functional/FilterTests.cpp b/tv/tuner/aidl/vts/functional/FilterTests.cpp
index 381475a..c53adb2 100644
--- a/tv/tuner/aidl/vts/functional/FilterTests.cpp
+++ b/tv/tuner/aidl/vts/functional/FilterTests.cpp
@@ -118,8 +118,8 @@
}
bool FilterCallback::dumpAvData(const DemuxFilterMediaEvent& event) {
- int32_t length = event.dataLength;
- int32_t offset = event.offset;
+ int64_t length = event.dataLength;
+ int64_t offset = event.offset;
int av_fd;
// read data from buffer pointed by a handle
if (event.avMemory.fds.size() == 0) {
diff --git a/tv/tuner/aidl/vts/functional/FrontendTests.cpp b/tv/tuner/aidl/vts/functional/FrontendTests.cpp
index 93b7976..7dce4fb 100644
--- a/tv/tuner/aidl/vts/functional/FrontendTests.cpp
+++ b/tv/tuner/aidl/vts/functional/FrontendTests.cpp
@@ -120,7 +120,7 @@
void FrontendCallback::scanTest(std::shared_ptr<IFrontend>& frontend, FrontendConfig config,
FrontendScanType type) {
- int32_t targetFrequency = getTargetFrequency(config.settings);
+ int64_t targetFrequency = getTargetFrequency(config.settings);
if (type == FrontendScanType::SCAN_BLIND) {
// reset the frequency in the scan configuration to test blind scan. The settings param of
// passed in means the real input config on the transponder connected to the DUT.
@@ -176,7 +176,7 @@
mScanMsgProcessed = true;
}
-int32_t FrontendCallback::getTargetFrequency(FrontendSettings& settings) {
+int64_t FrontendCallback::getTargetFrequency(FrontendSettings& settings) {
switch (settings.getTag()) {
case FrontendSettings::Tag::analog:
return settings.get<FrontendSettings::Tag::analog>().frequency;
@@ -202,7 +202,7 @@
}
void FrontendCallback::resetBlindScanStartingFrequency(FrontendConfig& config,
- int32_t resetingFreq) {
+ int64_t resetingFreq) {
switch (config.settings.getTag()) {
case FrontendSettings::Tag::analog:
config.settings.get<FrontendSettings::Tag::analog>().frequency = resetingFreq;
diff --git a/tv/tuner/aidl/vts/functional/FrontendTests.h b/tv/tuner/aidl/vts/functional/FrontendTests.h
index b65704f..e5a9cd3 100644
--- a/tv/tuner/aidl/vts/functional/FrontendTests.h
+++ b/tv/tuner/aidl/vts/functional/FrontendTests.h
@@ -53,8 +53,8 @@
FrontendScanType type);
// Helper methods
- int32_t getTargetFrequency(FrontendSettings& settings);
- void resetBlindScanStartingFrequency(FrontendConfig& config, int32_t resetingFreq);
+ int64_t getTargetFrequency(FrontendSettings& settings);
+ void resetBlindScanStartingFrequency(FrontendConfig& config, int64_t resetingFreq);
private:
void readFrontendScanMessage_Modulation(FrontendModulation modulation);
@@ -113,7 +113,7 @@
.lowThreshold = 0x1000,
.highThreshold = 0x07fff,
.dataFormat = DataFormat::ES,
- .packetSize = static_cast<int8_t>(188),
+ .packetSize = static_cast<int64_t>(188),
};
dvrConfig.type = DvrType::PLAYBACK;
dvrConfig.playbackInputFile = "/data/local/tmp/test.es";
diff --git a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h
index 2d7be9e..b411011 100644
--- a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h
+++ b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h
@@ -334,7 +334,7 @@
filterMap[id].settings = settings;
if (filterConfig.hasMonitorEventTypes()) {
- filterMap[id].monitorEventTypes = (uint32_t)filterConfig.getMonitorEventTypes();
+ filterMap[id].monitorEventTypes = (int32_t)filterConfig.getMonitorEventTypes();
}
if (filterConfig.hasAvFilterSettings_optional()) {
auto av = filterConfig.getFirstAvFilterSettings_optional();
@@ -380,7 +380,7 @@
return;
}
dvrMap[id].type = type;
- dvrMap[id].bufferSize = static_cast<uint32_t>(dvrConfig.getBufferSize());
+ dvrMap[id].bufferSize = static_cast<int32_t>(dvrConfig.getBufferSize());
if (dvrConfig.hasInputFilePath()) {
dvrMap[id].playbackInputFile = dvrConfig.getInputFilePath();
}
@@ -413,7 +413,7 @@
for (auto descramblerConfig : descramblers.getDescrambler()) {
string id = descramblerConfig.getId();
descramblerMap[id].casSystemId =
- static_cast<uint32_t>(descramblerConfig.getCasSystemId());
+ static_cast<int32_t>(descramblerConfig.getCasSystemId());
if (descramblerConfig.hasProvisionStr()) {
descramblerMap[id].provisionStr = descramblerConfig.getProvisionStr();
} else {
@@ -450,8 +450,7 @@
auto timeFilters = *hardwareConfig.getFirstTimeFilters();
for (auto timeFilterConfig : timeFilters.getTimeFilter()) {
string id = timeFilterConfig.getId();
- timeFilterMap[id].timeStamp =
- static_cast<uint64_t>(timeFilterConfig.getTimeStamp());
+ timeFilterMap[id].timeStamp = static_cast<int64_t>(timeFilterConfig.getTimeStamp());
}
}
}
@@ -625,14 +624,17 @@
static FrontendDvbtSettings readDvbtFrontendSettings(Frontend feConfig) {
ALOGW("[ConfigReader] fe type is dvbt");
FrontendDvbtSettings dvbtSettings{
- .frequency = (int32_t)feConfig.getFrequency(),
+ .frequency = (int64_t)feConfig.getFrequency(),
};
+ if (feConfig.hasEndFrequency()) {
+ dvbtSettings.endFrequency = (int64_t)feConfig.getEndFrequency();
+ }
if (!feConfig.hasDvbtFrontendSettings_optional()) {
ALOGW("[ConfigReader] no more dvbt settings");
return dvbtSettings;
}
auto dvbt = feConfig.getFirstDvbtFrontendSettings_optional();
- uint32_t trans = static_cast<uint32_t>(dvbt->getTransmissionMode());
+ int32_t trans = static_cast<int32_t>(dvbt->getTransmissionMode());
dvbtSettings.transmissionMode = static_cast<FrontendDvbtTransmissionMode>(trans);
dvbtSettings.bandwidth = static_cast<FrontendDvbtBandwidth>(dvbt->getBandwidth());
dvbtSettings.isHighPriority = dvbt->getIsHighPriority();
@@ -656,15 +658,18 @@
static FrontendDvbsSettings readDvbsFrontendSettings(Frontend feConfig) {
ALOGW("[ConfigReader] fe type is dvbs");
FrontendDvbsSettings dvbsSettings{
- .frequency = (int32_t)feConfig.getFrequency(),
+ .frequency = (int64_t)feConfig.getFrequency(),
};
+ if (feConfig.hasEndFrequency()) {
+ dvbsSettings.endFrequency = (int64_t)feConfig.getEndFrequency();
+ }
if (!feConfig.hasDvbsFrontendSettings_optional()) {
ALOGW("[ConfigReader] no more dvbs settings");
return dvbsSettings;
}
- dvbsSettings.symbolRate = static_cast<uint32_t>(
+ dvbsSettings.symbolRate = static_cast<int32_t>(
feConfig.getFirstDvbsFrontendSettings_optional()->getSymbolRate());
- dvbsSettings.inputStreamId = static_cast<uint32_t>(
+ dvbsSettings.inputStreamId = static_cast<int32_t>(
feConfig.getFirstDvbsFrontendSettings_optional()->getInputStreamId());
auto dvbs = feConfig.getFirstDvbsFrontendSettings_optional();
if (dvbs->hasScanType()) {
@@ -968,11 +973,11 @@
static PlaybackSettings readPlaybackSettings(Dvr dvrConfig) {
ALOGW("[ConfigReader] dvr type is playback");
PlaybackSettings playbackSettings{
- .statusMask = static_cast<uint8_t>(dvrConfig.getStatusMask()),
- .lowThreshold = static_cast<int32_t>(dvrConfig.getLowThreshold()),
- .highThreshold = static_cast<int32_t>(dvrConfig.getHighThreshold()),
+ .statusMask = static_cast<int8_t>(dvrConfig.getStatusMask()),
+ .lowThreshold = static_cast<int64_t>(dvrConfig.getLowThreshold()),
+ .highThreshold = static_cast<int64_t>(dvrConfig.getHighThreshold()),
.dataFormat = static_cast<DataFormat>(dvrConfig.getDataFormat()),
- .packetSize = static_cast<int8_t>(dvrConfig.getPacketSize()),
+ .packetSize = static_cast<int64_t>(dvrConfig.getPacketSize()),
};
return playbackSettings;
}
@@ -980,11 +985,11 @@
static RecordSettings readRecordSettings(Dvr dvrConfig) {
ALOGW("[ConfigReader] dvr type is record");
RecordSettings recordSettings{
- .statusMask = static_cast<uint8_t>(dvrConfig.getStatusMask()),
- .lowThreshold = static_cast<int32_t>(dvrConfig.getLowThreshold()),
- .highThreshold = static_cast<int32_t>(dvrConfig.getHighThreshold()),
+ .statusMask = static_cast<int8_t>(dvrConfig.getStatusMask()),
+ .lowThreshold = static_cast<int64_t>(dvrConfig.getLowThreshold()),
+ .highThreshold = static_cast<int64_t>(dvrConfig.getHighThreshold()),
.dataFormat = static_cast<DataFormat>(dvrConfig.getDataFormat()),
- .packetSize = static_cast<int8_t>(dvrConfig.getPacketSize()),
+ .packetSize = static_cast<int64_t>(dvrConfig.getPacketSize()),
};
return recordSettings;
}