Hongguang | 600a6ae | 2021-07-08 18:51:51 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2021 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include <binder/MemoryDealer.h> |
| 18 | |
| 19 | #include "../../../config/TunerTestingConfigAidlReaderV1_0.h" |
| 20 | |
| 21 | #include <aidl/android/hardware/tv/tuner/DataFormat.h> |
| 22 | #include <aidl/android/hardware/tv/tuner/DemuxAlpFilterType.h> |
| 23 | #include <aidl/android/hardware/tv/tuner/DemuxFilterMainType.h> |
| 24 | #include <aidl/android/hardware/tv/tuner/DemuxFilterMonitorEventType.h> |
| 25 | #include <aidl/android/hardware/tv/tuner/DemuxFilterSettings.h> |
| 26 | #include <aidl/android/hardware/tv/tuner/DemuxFilterType.h> |
| 27 | #include <aidl/android/hardware/tv/tuner/DemuxIpAddress.h> |
| 28 | #include <aidl/android/hardware/tv/tuner/DemuxIpFilterSettings.h> |
| 29 | #include <aidl/android/hardware/tv/tuner/DemuxIpFilterType.h> |
| 30 | #include <aidl/android/hardware/tv/tuner/DemuxMmtpFilterType.h> |
| 31 | #include <aidl/android/hardware/tv/tuner/DemuxRecordScIndexType.h> |
| 32 | #include <aidl/android/hardware/tv/tuner/DemuxTsFilterType.h> |
| 33 | #include <aidl/android/hardware/tv/tuner/DvrSettings.h> |
| 34 | #include <aidl/android/hardware/tv/tuner/DvrType.h> |
| 35 | #include <aidl/android/hardware/tv/tuner/FrontendDvbtBandwidth.h> |
| 36 | #include <aidl/android/hardware/tv/tuner/FrontendDvbtCoderate.h> |
| 37 | #include <aidl/android/hardware/tv/tuner/FrontendDvbtConstellation.h> |
| 38 | #include <aidl/android/hardware/tv/tuner/FrontendDvbtGuardInterval.h> |
| 39 | #include <aidl/android/hardware/tv/tuner/FrontendDvbtHierarchy.h> |
| 40 | #include <aidl/android/hardware/tv/tuner/FrontendDvbtSettings.h> |
| 41 | #include <aidl/android/hardware/tv/tuner/FrontendDvbtStandard.h> |
| 42 | #include <aidl/android/hardware/tv/tuner/FrontendDvbtTransmissionMode.h> |
| 43 | #include <aidl/android/hardware/tv/tuner/FrontendSettings.h> |
| 44 | #include <aidl/android/hardware/tv/tuner/FrontendType.h> |
| 45 | #include <aidl/android/hardware/tv/tuner/PlaybackSettings.h> |
| 46 | #include <aidl/android/hardware/tv/tuner/RecordSettings.h> |
| 47 | |
| 48 | using namespace std; |
| 49 | using namespace aidl::android::hardware::tv::tuner; |
| 50 | using namespace android::media::tuner::testing::configuration::V1_0; |
| 51 | |
| 52 | const int32_t FMQ_SIZE_4M = 0x400000; |
| 53 | const int32_t FMQ_SIZE_16M = 0x1000000; |
| 54 | |
Hongguang | 16dacc1 | 2021-11-01 15:51:52 -0700 | [diff] [blame] | 55 | const string configFilePath = "/vendor/etc/tuner_vts_config_aidl_V1.xml"; |
Hongguang | 600a6ae | 2021-07-08 18:51:51 -0700 | [diff] [blame] | 56 | |
| 57 | #define FILTER_MAIN_TYPE_BIT_COUNT 5 |
| 58 | |
| 59 | // Hardware configs |
| 60 | static map<string, FrontendConfig> frontendMap; |
| 61 | static map<string, FilterConfig> filterMap; |
| 62 | static map<string, DvrConfig> dvrMap; |
| 63 | static map<string, LnbConfig> lnbMap; |
| 64 | static map<string, TimeFilterConfig> timeFilterMap; |
| 65 | static map<string, vector<uint8_t>> diseqcMsgMap; |
| 66 | static map<string, DescramblerConfig> descramblerMap; |
| 67 | |
| 68 | // Hardware and test cases connections |
| 69 | static LiveBroadcastHardwareConnections live; |
| 70 | static ScanHardwareConnections scan; |
| 71 | static DvrPlaybackHardwareConnections playback; |
| 72 | static DvrRecordHardwareConnections record; |
| 73 | static DescramblingHardwareConnections descrambling; |
| 74 | static LnbLiveHardwareConnections lnbLive; |
| 75 | static LnbRecordHardwareConnections lnbRecord; |
| 76 | static TimeFilterHardwareConnections timeFilter; |
| 77 | |
| 78 | /** Config all the frontends that would be used in the tests */ |
| 79 | inline void initFrontendConfig() { |
| 80 | // The test will use the internal default fe when default fe is connected to any data flow |
| 81 | // without overriding in the xml config. |
| 82 | string defaultFeId = "FE_DEFAULT"; |
| 83 | FrontendDvbtSettings dvbtSettings{ |
Gareth Fenn | 282fb37 | 2021-09-27 15:14:11 +0100 | [diff] [blame] | 84 | .frequency = 578000000, |
Hongguang | 600a6ae | 2021-07-08 18:51:51 -0700 | [diff] [blame] | 85 | .transmissionMode = FrontendDvbtTransmissionMode::AUTO, |
| 86 | .bandwidth = FrontendDvbtBandwidth::BANDWIDTH_8MHZ, |
| 87 | .isHighPriority = true, |
| 88 | }; |
| 89 | frontendMap[defaultFeId].type = FrontendType::DVBT; |
| 90 | frontendMap[defaultFeId].settings.set<FrontendSettings::Tag::dvbt>(dvbtSettings); |
| 91 | |
| 92 | vector<FrontendStatusType> types; |
| 93 | types.push_back(FrontendStatusType::UEC); |
| 94 | types.push_back(FrontendStatusType::IS_MISO); |
| 95 | |
| 96 | vector<FrontendStatus> statuses; |
| 97 | FrontendStatus status; |
| 98 | status.set<FrontendStatus::Tag::uec>(4); |
| 99 | statuses.push_back(status); |
| 100 | status.set<FrontendStatus::Tag::isMiso>(true); |
| 101 | statuses.push_back(status); |
| 102 | |
| 103 | frontendMap[defaultFeId].tuneStatusTypes = types; |
| 104 | frontendMap[defaultFeId].expectTuneStatuses = statuses; |
| 105 | frontendMap[defaultFeId].isSoftwareFe = true; |
| 106 | frontendMap[defaultFeId].canConnectToCiCam = true; |
| 107 | frontendMap[defaultFeId].ciCamId = 0; |
| 108 | FrontendDvbtSettings dvbt; |
| 109 | dvbt.transmissionMode = FrontendDvbtTransmissionMode::MODE_8K_E; |
| 110 | frontendMap[defaultFeId].settings.set<FrontendSettings::Tag::dvbt>(dvbt); |
| 111 | // Read customized config |
| 112 | TunerTestingConfigAidlReader1_0::readFrontendConfig1_0(frontendMap); |
| 113 | }; |
| 114 | |
| 115 | inline void initFilterConfig() { |
| 116 | // The test will use the internal default filter when default filter is connected to any |
| 117 | // data flow without overriding in the xml config. |
| 118 | string defaultAudioFilterId = "FILTER_AUDIO_DEFAULT"; |
| 119 | string defaultVideoFilterId = "FILTER_VIDEO_DEFAULT"; |
| 120 | |
| 121 | filterMap[defaultVideoFilterId].type.mainType = DemuxFilterMainType::TS; |
Hongguang | ce1e30d | 2021-08-02 21:55:44 -0700 | [diff] [blame] | 122 | filterMap[defaultVideoFilterId].type.subType.set<DemuxFilterSubType::Tag::tsFilterType>( |
| 123 | DemuxTsFilterType::VIDEO); |
Hongguang | 600a6ae | 2021-07-08 18:51:51 -0700 | [diff] [blame] | 124 | filterMap[defaultVideoFilterId].bufferSize = FMQ_SIZE_16M; |
| 125 | filterMap[defaultVideoFilterId].settings = |
| 126 | DemuxFilterSettings::make<DemuxFilterSettings::Tag::ts>(); |
| 127 | filterMap[defaultVideoFilterId].settings.get<DemuxFilterSettings::Tag::ts>().tpid = 256; |
| 128 | DemuxFilterAvSettings video; |
| 129 | video.isPassthrough = false; |
| 130 | filterMap[defaultVideoFilterId] |
| 131 | .settings.get<DemuxFilterSettings::Tag::ts>() |
| 132 | .filterSettings.set<DemuxTsFilterSettingsFilterSettings::Tag::av>(video); |
| 133 | filterMap[defaultVideoFilterId].monitorEventTypes = |
| 134 | static_cast<int32_t>(DemuxFilterMonitorEventType::SCRAMBLING_STATUS) | |
| 135 | static_cast<int32_t>(DemuxFilterMonitorEventType::IP_CID_CHANGE); |
| 136 | filterMap[defaultVideoFilterId].streamType.set<AvStreamType::Tag::video>( |
| 137 | VideoStreamType::MPEG1); |
| 138 | |
| 139 | filterMap[defaultAudioFilterId].type.mainType = DemuxFilterMainType::TS; |
Hongguang | ce1e30d | 2021-08-02 21:55:44 -0700 | [diff] [blame] | 140 | filterMap[defaultAudioFilterId].type.subType.set<DemuxFilterSubType::Tag::tsFilterType>( |
| 141 | DemuxTsFilterType::AUDIO); |
Hongguang | 600a6ae | 2021-07-08 18:51:51 -0700 | [diff] [blame] | 142 | filterMap[defaultAudioFilterId].bufferSize = FMQ_SIZE_16M; |
| 143 | filterMap[defaultAudioFilterId].settings = |
| 144 | DemuxFilterSettings::make<DemuxFilterSettings::Tag::ts>(); |
| 145 | filterMap[defaultAudioFilterId].settings.get<DemuxFilterSettings::Tag::ts>().tpid = 256; |
| 146 | DemuxFilterAvSettings audio; |
| 147 | audio.isPassthrough = false; |
| 148 | filterMap[defaultAudioFilterId] |
| 149 | .settings.get<DemuxFilterSettings::Tag::ts>() |
| 150 | .filterSettings.set<DemuxTsFilterSettingsFilterSettings::Tag::av>(audio); |
| 151 | filterMap[defaultAudioFilterId].monitorEventTypes = |
| 152 | static_cast<int32_t>(DemuxFilterMonitorEventType::SCRAMBLING_STATUS) | |
| 153 | static_cast<int32_t>(DemuxFilterMonitorEventType::IP_CID_CHANGE); |
| 154 | filterMap[defaultAudioFilterId].streamType.set<AvStreamType::Tag::audio>(AudioStreamType::MP3); |
| 155 | // Read customized config |
| 156 | TunerTestingConfigAidlReader1_0::readFilterConfig1_0(filterMap); |
| 157 | }; |
| 158 | |
| 159 | /** Config all the dvrs that would be used in the tests */ |
| 160 | inline void initDvrConfig() { |
| 161 | // Read customized config |
| 162 | TunerTestingConfigAidlReader1_0::readDvrConfig1_0(dvrMap); |
| 163 | }; |
| 164 | |
Frankie Lizcano | 1fd5297 | 2022-06-30 16:50:21 +0000 | [diff] [blame] | 165 | inline void initTimeFilterConfig() { |
| 166 | // Read customized config |
| 167 | TunerTestingConfigAidlReader1_0::readTimeFilterConfig1_0(timeFilterMap); |
| 168 | }; |
| 169 | |
Frankie Lizcano | f535212 | 2022-06-29 22:10:16 +0000 | [diff] [blame] | 170 | inline void initDescramblerConfig() { |
| 171 | // Read customized config |
| 172 | TunerTestingConfigAidlReader1_0::readDescramblerConfig1_0(descramblerMap); |
| 173 | } |
| 174 | |
Frankie Lizcano | 647d5aa | 2022-06-30 20:49:31 +0000 | [diff] [blame] | 175 | inline void initLnbConfig() { |
| 176 | // Read customized config |
| 177 | TunerTestingConfigAidlReader1_0::readLnbConfig1_0(lnbMap); |
| 178 | }; |
| 179 | |
| 180 | inline void initDiseqcMsgsConfig() { |
| 181 | // Read customized config |
| 182 | TunerTestingConfigAidlReader1_0::readDiseqcMessages(diseqcMsgMap); |
| 183 | }; |
| 184 | |
Frankie Lizcano | 5b29f50 | 2022-07-06 22:09:42 +0000 | [diff] [blame] | 185 | inline void determineScan() { |
| 186 | if (!frontendMap.empty()) { |
| 187 | scan.hasFrontendConnection = true; |
| 188 | ALOGD("Can support scan"); |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | inline void determineTimeFilter() { |
| 193 | if (!timeFilterMap.empty()) { |
| 194 | timeFilter.support = true; |
| 195 | ALOGD("Can support time filter"); |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | inline void determineDvrPlayback() { |
| 200 | if (!playbackDvrIds.empty() && !audioFilterIds.empty() && !videoFilterIds.empty()) { |
| 201 | playback.support = true; |
| 202 | ALOGD("Can support dvr playback"); |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | inline void determineLnbLive() { |
| 207 | if (!audioFilterIds.empty() && !videoFilterIds.empty() && !frontendMap.empty() && |
| 208 | !lnbMap.empty()) { |
| 209 | lnbLive.support = true; |
| 210 | ALOGD("Can support lnb live"); |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | inline void determineLnbRecord() { |
| 215 | if (!frontendMap.empty() && !recordFilterIds.empty() && !recordDvrIds.empty() && |
| 216 | !lnbMap.empty()) { |
| 217 | lnbRecord.support = true; |
| 218 | ALOGD("Can support lnb record"); |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | inline void determineLive() { |
| 223 | if (videoFilterIds.empty() || audioFilterIds.empty() || frontendMap.empty()) { |
| 224 | return; |
| 225 | } |
| 226 | if (hasSwFe && !hasHwFe && dvrMap.empty()) { |
| 227 | ALOGD("Cannot configure Live. Only software frontends and no dvr connections"); |
| 228 | return; |
| 229 | } |
| 230 | ALOGD("Can support live"); |
| 231 | live.hasFrontendConnection = true; |
| 232 | } |
| 233 | |
| 234 | inline void determineDescrambling() { |
| 235 | if (descramblerMap.empty() || audioFilterIds.empty() || videoFilterIds.empty()) { |
| 236 | return; |
| 237 | } |
| 238 | if (frontendMap.empty() && playbackDvrIds.empty()) { |
| 239 | ALOGD("Cannot configure descrambling. No frontends or playback dvr's"); |
| 240 | return; |
| 241 | } |
| 242 | if (hasSwFe && !hasHwFe && playbackDvrIds.empty()) { |
| 243 | ALOGD("cannot configure descrambling. Only SW frontends and no playback dvr's"); |
| 244 | return; |
| 245 | } |
| 246 | ALOGD("Can support descrambling"); |
| 247 | descrambling.support = true; |
| 248 | } |
| 249 | |
| 250 | inline void determineDvrRecord() { |
| 251 | if (recordDvrIds.empty() || recordFilterIds.empty()) { |
| 252 | return; |
| 253 | } |
| 254 | if (frontendMap.empty() && playbackDvrIds.empty()) { |
| 255 | ALOGD("Cannot support dvr record. No frontends and no playback dvr's"); |
| 256 | return; |
| 257 | } |
| 258 | if (hasSwFe && !hasHwFe && playbackDvrIds.empty()) { |
| 259 | ALOGD("Cannot support dvr record. Only SW frontends and no playback dvr's"); |
| 260 | return; |
| 261 | } |
| 262 | ALOGD("Can support dvr record."); |
| 263 | record.support = true; |
| 264 | } |
| 265 | |
Hongguang | 600a6ae | 2021-07-08 18:51:51 -0700 | [diff] [blame] | 266 | /** Read the vendor configurations of which hardware to use for each test cases/data flows */ |
| 267 | inline void connectHardwaresToTestCases() { |
| 268 | TunerTestingConfigAidlReader1_0::connectLiveBroadcast(live); |
| 269 | TunerTestingConfigAidlReader1_0::connectScan(scan); |
| 270 | TunerTestingConfigAidlReader1_0::connectDvrRecord(record); |
Frankie Lizcano | 1fd5297 | 2022-06-30 16:50:21 +0000 | [diff] [blame] | 271 | TunerTestingConfigAidlReader1_0::connectTimeFilter(timeFilter); |
Frankie Lizcano | f535212 | 2022-06-29 22:10:16 +0000 | [diff] [blame] | 272 | TunerTestingConfigAidlReader1_0::connectDescrambling(descrambling); |
Frankie Lizcano | 647d5aa | 2022-06-30 20:49:31 +0000 | [diff] [blame] | 273 | TunerTestingConfigAidlReader1_0::connectLnbLive(lnbLive); |
| 274 | TunerTestingConfigAidlReader1_0::connectLnbRecord(lnbRecord); |
Frankie Lizcano | 5046193 | 2022-06-28 21:36:26 +0000 | [diff] [blame] | 275 | TunerTestingConfigAidlReader1_0::connectDvrPlayback(playback); |
Hongguang | 600a6ae | 2021-07-08 18:51:51 -0700 | [diff] [blame] | 276 | }; |
| 277 | |
Frankie Lizcano | 5b29f50 | 2022-07-06 22:09:42 +0000 | [diff] [blame] | 278 | inline void determineDataFlows() { |
| 279 | determineScan(); |
| 280 | determineTimeFilter(); |
| 281 | determineDvrPlayback(); |
| 282 | determineLnbLive(); |
| 283 | determineLnbRecord(); |
| 284 | determineLive(); |
| 285 | determineDescrambling(); |
| 286 | determineDvrRecord(); |
| 287 | } |
| 288 | |
Hongguang | 600a6ae | 2021-07-08 18:51:51 -0700 | [diff] [blame] | 289 | inline bool validateConnections() { |
| 290 | if (record.support && !record.hasFrontendConnection && |
| 291 | record.dvrSourceId.compare(emptyHardwareId) == 0) { |
| 292 | ALOGW("[vts config] Record must support either a DVR source or a Frontend source."); |
| 293 | return false; |
| 294 | } |
Gareth Fenn | 9a80845 | 2022-03-31 08:40:00 +0100 | [diff] [blame] | 295 | bool feIsValid = live.hasFrontendConnection |
| 296 | ? frontendMap.find(live.frontendId) != frontendMap.end() |
| 297 | : true; |
| 298 | feIsValid &= scan.hasFrontendConnection ? frontendMap.find(scan.frontendId) != frontendMap.end() |
| 299 | : true; |
| 300 | feIsValid &= record.support && record.hasFrontendConnection |
| 301 | ? frontendMap.find(record.frontendId) != frontendMap.end() |
| 302 | : true; |
Frankie Lizcano | f535212 | 2022-06-29 22:10:16 +0000 | [diff] [blame] | 303 | feIsValid &= descrambling.support && descrambling.hasFrontendConnection |
| 304 | ? frontendMap.find(descrambling.frontendId) != frontendMap.end() |
| 305 | : true; |
Hongguang | 600a6ae | 2021-07-08 18:51:51 -0700 | [diff] [blame] | 306 | |
Frankie Lizcano | 647d5aa | 2022-06-30 20:49:31 +0000 | [diff] [blame] | 307 | feIsValid &= lnbLive.support ? frontendMap.find(lnbLive.frontendId) != frontendMap.end() : true; |
| 308 | |
| 309 | feIsValid &= |
| 310 | lnbRecord.support ? frontendMap.find(lnbRecord.frontendId) != frontendMap.end() : true; |
| 311 | |
Hongguang | 600a6ae | 2021-07-08 18:51:51 -0700 | [diff] [blame] | 312 | if (!feIsValid) { |
| 313 | ALOGW("[vts config] dynamic config fe connection is invalid."); |
| 314 | return false; |
| 315 | } |
| 316 | |
| 317 | bool dvrIsValid = frontendMap[live.frontendId].isSoftwareFe |
| 318 | ? dvrMap.find(live.dvrSoftwareFeId) != dvrMap.end() |
| 319 | : true; |
| 320 | |
| 321 | if (record.support) { |
| 322 | if (record.hasFrontendConnection) { |
| 323 | if (frontendMap[record.frontendId].isSoftwareFe) { |
| 324 | dvrIsValid &= dvrMap.find(record.dvrSoftwareFeId) != dvrMap.end(); |
| 325 | } |
| 326 | } else { |
| 327 | dvrIsValid &= dvrMap.find(record.dvrSourceId) != dvrMap.end(); |
| 328 | } |
| 329 | dvrIsValid &= dvrMap.find(record.dvrRecordId) != dvrMap.end(); |
| 330 | } |
| 331 | |
Frankie Lizcano | f535212 | 2022-06-29 22:10:16 +0000 | [diff] [blame] | 332 | if (descrambling.support) { |
| 333 | if (descrambling.hasFrontendConnection) { |
| 334 | if (frontendMap[descrambling.frontendId].isSoftwareFe) { |
| 335 | dvrIsValid &= dvrMap.find(descrambling.dvrSoftwareFeId) != dvrMap.end(); |
| 336 | } |
| 337 | } else { |
| 338 | dvrIsValid &= dvrMap.find(descrambling.dvrSourceId) != dvrMap.end(); |
| 339 | } |
| 340 | } |
| 341 | |
Frankie Lizcano | 647d5aa | 2022-06-30 20:49:31 +0000 | [diff] [blame] | 342 | dvrIsValid &= lnbRecord.support ? dvrMap.find(lnbRecord.dvrRecordId) != dvrMap.end() : true; |
| 343 | |
Frankie Lizcano | 5046193 | 2022-06-28 21:36:26 +0000 | [diff] [blame] | 344 | dvrIsValid &= playback.support ? dvrMap.find(playback.dvrId) != dvrMap.end() : true; |
| 345 | |
Hongguang | 600a6ae | 2021-07-08 18:51:51 -0700 | [diff] [blame] | 346 | if (!dvrIsValid) { |
| 347 | ALOGW("[vts config] dynamic config dvr connection is invalid."); |
| 348 | return false; |
| 349 | } |
| 350 | |
Gareth Fenn | 9a80845 | 2022-03-31 08:40:00 +0100 | [diff] [blame] | 351 | bool filterIsValid = (live.hasFrontendConnection) |
| 352 | ? filterMap.find(live.audioFilterId) != filterMap.end() && |
| 353 | filterMap.find(live.videoFilterId) != filterMap.end() |
| 354 | : true; |
Hongguang | 600a6ae | 2021-07-08 18:51:51 -0700 | [diff] [blame] | 355 | filterIsValid &= |
| 356 | record.support ? filterMap.find(record.recordFilterId) != filterMap.end() : true; |
| 357 | |
Frankie Lizcano | f535212 | 2022-06-29 22:10:16 +0000 | [diff] [blame] | 358 | filterIsValid &= descrambling.support |
| 359 | ? filterMap.find(descrambling.videoFilterId) != filterMap.end() && |
| 360 | filterMap.find(descrambling.audioFilterId) != filterMap.end() |
| 361 | : true; |
| 362 | |
| 363 | for (auto& filterId : descrambling.extraFilters) { |
| 364 | filterIsValid &= filterMap.find(filterId) != filterMap.end(); |
| 365 | } |
| 366 | |
Frankie Lizcano | 647d5aa | 2022-06-30 20:49:31 +0000 | [diff] [blame] | 367 | filterIsValid &= lnbLive.support |
| 368 | ? filterMap.find(lnbLive.audioFilterId) != filterMap.end() && |
| 369 | filterMap.find(lnbLive.videoFilterId) != filterMap.end() |
| 370 | : true; |
| 371 | |
| 372 | filterIsValid &= |
| 373 | lnbRecord.support ? filterMap.find(lnbRecord.recordFilterId) != filterMap.end() : true; |
| 374 | |
| 375 | for (auto& filterId : lnbRecord.extraFilters) { |
| 376 | filterIsValid &= filterMap.find(filterId) != filterMap.end(); |
| 377 | } |
| 378 | |
| 379 | for (auto& filterId : lnbLive.extraFilters) { |
| 380 | filterIsValid &= filterMap.find(filterId) != filterMap.end(); |
| 381 | } |
| 382 | |
Frankie Lizcano | 5046193 | 2022-06-28 21:36:26 +0000 | [diff] [blame] | 383 | filterIsValid &= playback.support |
| 384 | ? filterMap.find(playback.audioFilterId) != filterMap.end() && |
| 385 | filterMap.find(playback.videoFilterId) != filterMap.end() |
| 386 | : true; |
| 387 | filterIsValid &= playback.sectionFilterId.compare(emptyHardwareId) == 0 |
| 388 | ? true |
| 389 | : filterMap.find(playback.sectionFilterId) != filterMap.end(); |
| 390 | |
| 391 | for (auto& filterId : playback.extraFilters) { |
| 392 | filterIsValid &= |
| 393 | playback.hasExtraFilters ? filterMap.find(filterId) != filterMap.end() : true; |
| 394 | } |
| 395 | |
Hongguang | 600a6ae | 2021-07-08 18:51:51 -0700 | [diff] [blame] | 396 | if (!filterIsValid) { |
| 397 | ALOGW("[vts config] dynamic config filter connection is invalid."); |
| 398 | return false; |
| 399 | } |
| 400 | |
Frankie Lizcano | 1fd5297 | 2022-06-30 16:50:21 +0000 | [diff] [blame] | 401 | bool timeFilterIsValid = |
| 402 | timeFilter.support ? timeFilterMap.find(timeFilter.timeFilterId) != timeFilterMap.end() |
| 403 | : true; |
| 404 | |
| 405 | if (!timeFilterIsValid) { |
| 406 | ALOGW("[vts config] dynamic config time filter connection is invalid."); |
Frankie Lizcano | f535212 | 2022-06-29 22:10:16 +0000 | [diff] [blame] | 407 | } |
| 408 | |
| 409 | bool descramblerIsValid = |
| 410 | descrambling.support |
| 411 | ? descramblerMap.find(descrambling.descramblerId) != descramblerMap.end() |
| 412 | : true; |
| 413 | |
| 414 | if (!descramblerIsValid) { |
| 415 | ALOGW("[vts config] dynamic config descrambler connection is invalid."); |
Frankie Lizcano | 1fd5297 | 2022-06-30 16:50:21 +0000 | [diff] [blame] | 416 | return false; |
| 417 | } |
| 418 | |
Frankie Lizcano | 647d5aa | 2022-06-30 20:49:31 +0000 | [diff] [blame] | 419 | bool lnbIsValid = lnbLive.support ? lnbMap.find(lnbLive.lnbId) != lnbMap.end() : true; |
| 420 | |
| 421 | lnbIsValid &= lnbRecord.support ? lnbMap.find(lnbRecord.lnbId) != lnbMap.end() : true; |
| 422 | |
| 423 | if (!lnbIsValid) { |
| 424 | ALOGW("[vts config] dynamic config lnb connection is invalid."); |
| 425 | return false; |
| 426 | } |
| 427 | |
| 428 | bool diseqcMsgsIsValid = true; |
| 429 | |
| 430 | for (auto& msg : lnbRecord.diseqcMsgs) { |
| 431 | diseqcMsgsIsValid &= diseqcMsgMap.find(msg) != diseqcMsgMap.end(); |
| 432 | } |
| 433 | |
| 434 | for (auto& msg : lnbLive.diseqcMsgs) { |
| 435 | diseqcMsgsIsValid &= diseqcMsgMap.find(msg) != diseqcMsgMap.end(); |
| 436 | } |
| 437 | |
| 438 | if (!diseqcMsgsIsValid) { |
| 439 | ALOGW("[vts config] dynamic config diseqcMsg is invalid."); |
| 440 | return false; |
| 441 | } |
| 442 | |
Hongguang | 600a6ae | 2021-07-08 18:51:51 -0700 | [diff] [blame] | 443 | return true; |
| 444 | } |