From 3bf2cf55fee4320ed01d4b02dc30872d8249d024 Mon Sep 17 00:00:00 2001 From: Daniel Silhavy Date: Fri, 14 Apr 2023 10:18:51 +0200 Subject: [PATCH 1/9] Add missing assignment of $period_timing_info global variable. Also fix addressing of the attributes of the resulting associative array. --- CMAF/impl/checkCMAFPresentation.php | 2 +- DASH/LowLatency/impl/validateSegmentTimeline.php | 2 +- HbbTV_DVB/impl/mpdTimingInfo.php | 6 +++--- HbbTV_DVB/impl/representationValidation.php | 2 +- HbbTV_DVB/impl/segmentToPeriodDurationCheck.php | 2 +- Utils/impl/MPDHandler/computeDynamicIntervals.php | 2 +- Utils/impl/MPDHandler/getDurationsForAllPeriods.php | 2 +- Utils/impl/MPDHandler/getPeriodDurationInfo.php | 6 +++++- Utils/segment_validation.php | 12 ++++++++---- 9 files changed, 22 insertions(+), 14 deletions(-) diff --git a/CMAF/impl/checkCMAFPresentation.php b/CMAF/impl/checkCMAFPresentation.php index a04aadb3..8c42ada7 100644 --- a/CMAF/impl/checkCMAFPresentation.php +++ b/CMAF/impl/checkCMAFPresentation.php @@ -17,7 +17,7 @@ $longestFragmentDuration = 0; $videoFragDur = 0; -$presentationDuration = $period_timing_info[1]; +$presentationDuration = $period_timing_info["duration"]; $adaptationSets = $mpdHandler->getFeatures()['Period'][$mpdHandler->getSelectedPeriod()]['AdaptationSet']; for ($adaptationSetIndex = 0; $adaptationSetIndex < sizeof($adaptationSets); $adaptationSetIndex++) { $adaptationSet = $adaptationSets[$adaptationSetIndex]; diff --git a/DASH/LowLatency/impl/validateSegmentTimeline.php b/DASH/LowLatency/impl/validateSegmentTimeline.php index 1b0a1b82..99c9198c 100644 --- a/DASH/LowLatency/impl/validateSegmentTimeline.php +++ b/DASH/LowLatency/impl/validateSegmentTimeline.php @@ -42,7 +42,7 @@ if ($r < 0) { $until = ($sIndex != $segmentElementCount - 1) ? - $segmentElements[$sIndex + 1]['t'] : $period_timing_info[1] * $timescale; + $segmentElements[$sIndex + 1]['t'] : $period_timing_info["duration"] * $timescale; while ($t < $until) { $logger->test( "DASH-IF IOP CR Low Latency Live", diff --git a/HbbTV_DVB/impl/mpdTimingInfo.php b/HbbTV_DVB/impl/mpdTimingInfo.php index 413e844d..ed933949 100644 --- a/HbbTV_DVB/impl/mpdTimingInfo.php +++ b/HbbTV_DVB/impl/mpdTimingInfo.php @@ -11,7 +11,7 @@ $duration = ($seg_acc['duration'] != '') ? (int)($seg_acc['duration']) : 0; $timescale = ($seg_acc['timescale'] != '') ? (int)($seg_acc['timescale']) : 1; - $pres_start = $period_timing_info[0] - $pto / $timescale; + $pres_start = $period_timing_info["start"] - $pto / $timescale; $segtimeline = $seg_acc['SegmentTimeline']; if ($segtimeline != null && sizeof($segtimeline) != 0) { @@ -37,7 +37,7 @@ $index++; } } else { - $segment_cnt = ceil($period_timing_info[1] / $segmentDuration); + $segment_cnt = ceil($period_timing_info["duration"] / $segmentDuration); for ($i = 0; $i < $segment_cnt; $i++) { $mpd_timing[] = $pres_start + $i * $segmentDuration; @@ -54,7 +54,7 @@ $mpd_timing[] = $pres_start; } else { $segmentDuration = $duration / $timescale; - $segment_cnt = $period_timing_info[1] / $segmentDuration; + $segment_cnt = $period_timing_info["duration"] / $segmentDuration; for ($i = 0; $i < $segment_cnt; $i++) { $mpd_timing[] = $pres_start + $i * $segmentDuration; diff --git a/HbbTV_DVB/impl/representationValidation.php b/HbbTV_DVB/impl/representationValidation.php index c80bf33f..eaa876be 100644 --- a/HbbTV_DVB/impl/representationValidation.php +++ b/HbbTV_DVB/impl/representationValidation.php @@ -21,7 +21,7 @@ $this->segmentTimingCommon($xmlRepresentation); $this->bitrateReport($xmlRepresentation); $segmentDurationName = $this->segmentDurationChecks(); - if ($period_timing_info[1] !== '' && $period_timing_info[1] !== 0) { + if ($period_timing_info["duration"] !== '' && $period_timing_info["duration"] !== 0) { $checks = $this->segmentToPeriodDurationCheck($xmlRepresentation); $logger->test( "HbbTV-DVB DASH Validation Requirements", diff --git a/HbbTV_DVB/impl/segmentToPeriodDurationCheck.php b/HbbTV_DVB/impl/segmentToPeriodDurationCheck.php index ebe264eb..11e7a3b9 100644 --- a/HbbTV_DVB/impl/segmentToPeriodDurationCheck.php +++ b/HbbTV_DVB/impl/segmentToPeriodDurationCheck.php @@ -15,7 +15,7 @@ $totalSegmentDuration += $segmentDuration; } -$periodDuration = (float)$period_timing_info[1]; +$periodDuration = (float)$period_timing_info["duration"]; $drift = 0; if (round($periodDuration, 2) != 0) { diff --git a/Utils/impl/MPDHandler/computeDynamicIntervals.php b/Utils/impl/MPDHandler/computeDynamicIntervals.php index fdfc7a0b..5e63ace3 100644 --- a/Utils/impl/MPDHandler/computeDynamicIntervals.php +++ b/Utils/impl/MPDHandler/computeDynamicIntervals.php @@ -45,7 +45,7 @@ date_default_timezone_set("UTC"); //Set default timezone to UTC $now = time(); // Get actual time $AST = strtotime($AST); -$LST = $now - ($AST + $period_timing_info[0] - $pto - $availabilityTimeOffset - $segmentduration); +$LST = $now - ($AST + $period_timing_info["start"] - $pto - $availabilityTimeOffset - $segmentduration); $LSN = intval($LST / $segmentduration); $earliestsegment = $LSN - $buffercapacity * $percent; diff --git a/Utils/impl/MPDHandler/getDurationsForAllPeriods.php b/Utils/impl/MPDHandler/getDurationsForAllPeriods.php index cdaff4ff..7f9a0320 100644 --- a/Utils/impl/MPDHandler/getDurationsForAllPeriods.php +++ b/Utils/impl/MPDHandler/getDurationsForAllPeriods.php @@ -37,7 +37,7 @@ } } - if ($periodDuration != '') { + if ($periodDuration != '' && $periodDuration != null) { $duration = DASHIF\Utility\timeParsing($periodDuration); } else { if ($i != sizeof($periods) - 1) { diff --git a/Utils/impl/MPDHandler/getPeriodDurationInfo.php b/Utils/impl/MPDHandler/getPeriodDurationInfo.php index e2d36c51..a1e250ca 100644 --- a/Utils/impl/MPDHandler/getPeriodDurationInfo.php +++ b/Utils/impl/MPDHandler/getPeriodDurationInfo.php @@ -1,7 +1,11 @@ periodTimingInformation)) { $this->getDurationForAllPeriods(); } -return $this->periodTimingInformation[$period]; + +$period_timing_info = $this->periodTimingInformation[$period]; + +return $period_timing_info; diff --git a/Utils/segment_validation.php b/Utils/segment_validation.php index 8c3a5f2c..547ae292 100644 --- a/Utils/segment_validation.php +++ b/Utils/segment_validation.php @@ -280,7 +280,7 @@ function run_backend($configFile, $representationDirectory = "") $atomXmlString = file_get_contents("$sessionDirectory/atominfo.xml"); $STYPBeginPos = strpos($atomXmlString, "getSelectedPeriod()]['AdaptationSet']); +if (is_null($adaptationCount)) { + $adaptationCount = sizeof($mpdHandler->getFeatures()['Period'][$mpdHandler->getSelectedPeriod()]['AdaptationSet']); +} $chfdSwitchingSetFound = 0; $videoSelectionSetFound = 0; @@ -19,7 +21,10 @@ for ($adaptationIndex = 0; $adaptationIndex < $adaptationCount; $adaptationIndex++) { $switchingSetMediaProfiles = array(); $encryptedTracks = array(); - $location = $session->getAdaptationDir($mpdHandler->getSelectedPeriod(), $adaptationIndex); + if(is_null($periodIndex)) { + $periodIndex = $mpdHandler->getSelectedPeriod(); + } + $location = $session->getAdaptationDir($periodIndex, $adaptationIndex); $fileCount = 0; $files = DASHIF\rglob("$location/*.xml"); if ($files) { @@ -174,9 +179,10 @@ } -if ($presentationProfile != ""){ +if ($presentationProfile != "") { } $logger->message("Stream found to conform to a CMAF Presentation Profile: $presentationProfile"); +return $presentationProfile; diff --git a/CTAWAVE/impl/checkCMFHDBaselineConstraints.php b/CTAWAVE/impl/checkCMFHDBaselineConstraints.php index aacb9f2f..bfe51dc2 100644 --- a/CTAWAVE/impl/checkCMFHDBaselineConstraints.php +++ b/CTAWAVE/impl/checkCMFHDBaselineConstraints.php @@ -9,7 +9,7 @@ for ($i = 0; $i < $periodCount; $i++) { $adaptationCount = sizeof($MediaProfDatabase[$i]); $presentationProfile = $this->CTACheckPresentation($adaptationCount, $i); - array_push($presentationProfileArray, $presentationProfile); + $presentationProfileArray[] = $presentationProfile; } $logger->test( diff --git a/CTAWAVE/module.php b/CTAWAVE/module.php index 2ec88f41..8cd2d4d6 100644 --- a/CTAWAVE/module.php +++ b/CTAWAVE/module.php @@ -176,9 +176,9 @@ private function checkAudioChannelSplicePoint() return include 'impl/checkAudioChannelSplicePoint.php'; } - private function CTACheckPresentation() + private function CTACheckPresentation($adaptationCount = null, $periodIndex = null) { - include 'impl/CTACheckPresentation.php'; + return include 'impl/CTACheckPresentation.php'; } private function CTACheckSelectionSet() { From 9a218bc751ae28e95471e6c8a6fe99205f26a6a3 Mon Sep 17 00:00:00 2001 From: Phencys Date: Mon, 17 Apr 2023 10:50:40 +0200 Subject: [PATCH 4/9] Check for 'no errors' instead of incorrect previous check --- CMAF/impl/checkCMAFTracks.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMAF/impl/checkCMAFTracks.php b/CMAF/impl/checkCMAFTracks.php index 6c06d91c..22b03c34 100644 --- a/CMAF/impl/checkCMAFTracks.php +++ b/CMAF/impl/checkCMAFTracks.php @@ -34,7 +34,7 @@ $adaptationSet = $mpdHandler->getFeatures()['Period'][$mpdHandler->getSelectedPeriod()] ['AdaptationSet'][$mpdHandler->getSelectedAdaptationSet()]; -$errorInTrack = 0; +$noErrorInTrack = true; $id = $adaptationSet['Representation'][$mpdHandler->getSelectedAdaptationSet()]['id']; $moofBoxes = $xml->getElementsByTagName('moof'); $moofBoxesCount = $moofBoxes->length; @@ -100,7 +100,7 @@ $previousFragmentDecodeTime = $tfdtBoxes->item($j - 1)->getAttribute('baseMediaDecodeTime'); $currentFragmentDecodeTime = $tfdtBoxes->item($j)->getAttribute('baseMediaDecodeTime'); - $errorInTrack |= $logger->test( + $noErrorInTrack &= $logger->test( "CMAF", "Section 7.3.2.2", "Each CMAF Fragment in a CMAF Track SHALL have baseMediaDecodeTime equal to the sum of all prior " . @@ -110,7 +110,7 @@ "Representation $id Fragment $j valid", "Representation $id Fragment $j does not have a valid baseMediaDecodeTime" ); - $errorInTrack |= $logger->test( + $noErrorInTrack &= $logger->test( "CMAF", "Section 7.3.2.3", "CMAF Chunks in a CMAF Track SHALL NOT overlap or have gaps in decode time", @@ -178,7 +178,7 @@ "Section 7.3.2.2", "The concatenation of a CMAF Header and all CMAF Fragments in the CMAF Track in consecutive decode order " . "SHALL be a valid fragmented ISOBMFF file", - !$errorInTrack, + $noErrorInTrack, "FAIL", "Representation $id valid", "Representation $id not valid" From 74015b717973a79fe7f7e50201ef02a55089becd Mon Sep 17 00:00:00 2001 From: Phencys Date: Mon, 17 Apr 2023 10:50:55 +0200 Subject: [PATCH 5/9] More verbose FPS output --- CMAF/impl/checkCMAFTracks.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMAF/impl/checkCMAFTracks.php b/CMAF/impl/checkCMAFTracks.php index 22b03c34..78c10bff 100644 --- a/CMAF/impl/checkCMAFTracks.php +++ b/CMAF/impl/checkCMAFTracks.php @@ -370,8 +370,8 @@ "decoded and displayed when independently accessed", $numberOfUnitsInTick != null && $timeScale != null, "FAIL", - "FPS info found for representation / track $id", - "FPS info not found for representation / track $id", + "FPS info (num_ticks & timescale) found for representation / track $id", + "FPS info (num_ticks & timescale) not found for representation / track $id", ); } } From ece5862942c1c046551ba43ff739203de4cdc9d0 Mon Sep 17 00:00:00 2001 From: Phencys Date: Mon, 17 Apr 2023 10:51:11 +0200 Subject: [PATCH 6/9] rint message when it is relevant only --- CTAWAVE/impl/CTACheckPresentation.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CTAWAVE/impl/CTACheckPresentation.php b/CTAWAVE/impl/CTACheckPresentation.php index e9ec96c6..61115b63 100644 --- a/CTAWAVE/impl/CTACheckPresentation.php +++ b/CTAWAVE/impl/CTACheckPresentation.php @@ -179,10 +179,9 @@ } -if ($presentationProfile != "") { - +if ($presentationProfile != ""){ + $logger->message("Stream found to conform to a CMAF Presentation Profile: $presentationProfile"); } -$logger->message("Stream found to conform to a CMAF Presentation Profile: $presentationProfile"); return $presentationProfile; From a38ea06beacb1873b46a4b1b801927b93a9e8384 Mon Sep 17 00:00:00 2001 From: Phencys Date: Mon, 17 Apr 2023 11:13:01 +0200 Subject: [PATCH 7/9] Store presentationprofile instead of trying to recalculate it # Conflicts: # CTAWAVE/impl/checkCMFHDBaselineConstraints.php --- CTAWAVE/impl/CTACheckPresentation.php | 2 ++ CTAWAVE/impl/checkCMFHDBaselineConstraints.php | 16 +++------------- CTAWAVE/module.php | 1 + 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/CTAWAVE/impl/CTACheckPresentation.php b/CTAWAVE/impl/CTACheckPresentation.php index 61115b63..84c342f4 100644 --- a/CTAWAVE/impl/CTACheckPresentation.php +++ b/CTAWAVE/impl/CTACheckPresentation.php @@ -183,5 +183,7 @@ $logger->message("Stream found to conform to a CMAF Presentation Profile: $presentationProfile"); } +$this->presentationProfile = $presentationProfile; + return $presentationProfile; diff --git a/CTAWAVE/impl/checkCMFHDBaselineConstraints.php b/CTAWAVE/impl/checkCMFHDBaselineConstraints.php index bfe51dc2..96d9fec0 100644 --- a/CTAWAVE/impl/checkCMFHDBaselineConstraints.php +++ b/CTAWAVE/impl/checkCMFHDBaselineConstraints.php @@ -1,24 +1,14 @@ CTACheckPresentation($adaptationCount, $i); - $presentationProfileArray[] = $presentationProfile; -} +global $session, $logger; $logger->test( "WAVE Content Spec 2018Ed", "Section 6.2", "WAVE CMFHD Baseline Program Shall contain a sequence of one or more CMAF Presentations conforming to CMAF " . "CMFHD profile", - count(array_unique($presentationProfileArray)) === 1 && array_unique($presentationProfileArray)[0] == "CMFHD", + $this->presentationProfile == "CMFHD", "FAIL", "All CMAF Switching sets are CMFHD conformant", - "Not all CMAF Switching sets are CMFHD conformant" + "Not all CMAF Switching sets are CMFHD conformant, found $presentationProfile" ); diff --git a/CTAWAVE/module.php b/CTAWAVE/module.php index 8cd2d4d6..169461f1 100644 --- a/CTAWAVE/module.php +++ b/CTAWAVE/module.php @@ -7,6 +7,7 @@ class ModuleCTAWAVE extends ModuleInterface private $mediaProfileAttributesAudio; private $mediaProfileAttributesVideo; private $mediaProfileAttributesSubtitle; + private $presentationProfile; public function __construct() { From 5331210d379aa72fca9ee4ed95016f09bbe0c10e Mon Sep 17 00:00:00 2001 From: Phencys Date: Mon, 17 Apr 2023 10:53:12 +0200 Subject: [PATCH 8/9] Quality of life: add pass/warn/fail symbol on each test line --- Utils/moduleLogger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Utils/moduleLogger.php b/Utils/moduleLogger.php index dc44361d..cf5b9ef9 100644 --- a/Utils/moduleLogger.php +++ b/Utils/moduleLogger.php @@ -139,10 +139,10 @@ public function getHook() public function test($spec, $section, $test, $check, $fail_type, $msg_succ, $msg_fail) { if ($check) { - $this->addTestResult($spec, $section, $test, $msg_succ, "PASS"); + $this->addTestResult($spec, $section, $test, "✓ " . $msg_succ, "PASS"); return true; } else { - $this->addTestResult($spec, $section, $test, $msg_fail, $fail_type); + $this->addTestResult($spec, $section, $test, ($fail_type == "WARN" ? "! " : "✗ ") . $msg_fail, $fail_type); return false; } } From 04a58727a4adddda16f432e89368bc461e27fce0 Mon Sep 17 00:00:00 2001 From: Phencys Date: Mon, 17 Apr 2023 10:53:31 +0200 Subject: [PATCH 9/9] Quality of life: Changed wording of segment validation error log --- Utils/segment_validation.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Utils/segment_validation.php b/Utils/segment_validation.php index 547ae292..743c3c6a 100644 --- a/Utils/segment_validation.php +++ b/Utils/segment_validation.php @@ -545,6 +545,7 @@ function saveStdErrOutput($representationDirectory, $saveDetailedOutput = true) $currentModule = $logger->getCurrentModule(); $currentHook = $logger->getCurrentHook(); $logger->setModule("SEGMENT_VALIDATION"); + $logger->setHook("Segment Validation"); $content = file_get_contents("$representationDirectory/stderr.txt"); $contentArray = explode("\n", $content); @@ -553,7 +554,7 @@ function saveStdErrOutput($representationDirectory, $saveDetailedOutput = true) $logger->test( "Segment Validation", "Segment Validation", - "Check for content in error log", + "Segment validator output should not contain errors", true, "PASS", "Segment validation did not produce any output", @@ -582,7 +583,7 @@ function saveStdErrOutput($representationDirectory, $saveDetailedOutput = true) $logger->test( "Segment Validation", "Segment Validation", - "Check for content in error log", + "Segment validator output should not contain errors", $severity == "PASS", $severity, $msg, @@ -595,7 +596,7 @@ function saveStdErrOutput($representationDirectory, $saveDetailedOutput = true) $logger->test( "Segment Validation", "Segment Validation", - "Check for content in error log", + "Segment validator output should not contain errors", $commonSeverity == "PASS", $commonSeverity, "Segment validation did not produce any errors",