1616
1717class AudioMediaProfile extends AdaptationComponent
1818{
19- private TestCase $ profileCase ;
2019 private TestCase $ brandCase ;
2120 private TestCase $ caacCase ;
2221
@@ -26,87 +25,73 @@ public function __construct()
2625 self ::class,
2726 new ReporterContext (
2827 "Segments " ,
29- "LEGACY " ,
28+ "Edition 3 " ,
3029 "CMAF " ,
3130 []
3231 )
3332 );
3433
35- $ this ->profileCase = $ this ->reporter ->add (
36- section: 'Section 7.3.4.1 ' ,
37- test: "All CMAF audio tracks in a CMAF Switching Set SHALL conform to one CMAF Media Profile " ,
38- skipReason: 'No audio switching set found '
39- );
4034 $ this ->brandCase = $ this ->reporter ->add (
4135 section: 'Section A.3 ' ,
42- test: "If a CMAF brand is signalled, it SHALL correspond with the table " ,
36+ test: "The maximum encoding parameters [..as per the table..] SHALL not be exceeded " ,
4337 skipReason: 'No cmaf brands signalled '
4438 );
4539 $ this ->caacCase = $ this ->reporter ->add (
46- section: 'Section A.1.2/A.1.3/A.1.4 ' ,
40+ section: 'Section A.1.2 ' ,
4741 test: "Audio adaptation sets SHALL include at least one 'caac' representation " ,
48- skipReason: 'No audio track found with CMAF profile found '
42+ skipReason: 'No audio track found, or no CMFHD profile signalled '
4943 );
5044 }
5145
5246 //Public validation functions
5347 public function validateAdaptationSet (AdaptationSet $ adaptationSet ): void
5448 {
55- //TODO: Only if audio
56- $ signalledBrands = [] ;
57-
49+ if (! str_starts_with ( $ adaptationSet -> getTransientAttribute ( ' mimeType ' ), ' audio/ ' )) {
50+ return ;
51+ }
5852 $ segmentManager = app (SegmentManager::class);
5953
6054 $ hasCAAC = false ;
6155 foreach ($ adaptationSet ->allRepresentations () as $ representation ) {
6256 $ segmentList = $ segmentManager ->representationSegments ($ representation );
6357
64- $ highestBrand = '____ ' ; // Unknown;
6558 if (count ($ segmentList )) {
6659 if (in_array ('caac ' , $ segmentList [0 ]->getBrands ())) {
6760 $ hasCAAC = true ;
6861 }
69- $ highestBrand = $ this ->validateAndDetermineBrand ($ representation , $ segmentList [0 ]);
62+ $ this ->validateAndDetermineBrand ($ representation , $ segmentList [0 ]);
7063 }
71- $ signalledBrands [] = $ highestBrand ; // Unknown
7264 }
7365
74- $ this ->profileCase ->pathAdd (
75- result: count (array_unique ($ signalledBrands )) == 1 ,
76- severity: "FAIL " ,
77- path: $ adaptationSet ->path (),
78- pass_message: "All representations signal the same highest brand " ,
79- fail_message: "Not all representations signal the same highest brand "
80- );
66+ $ mpdCache = app (MPDCache::class);
8167
82- $ this ->caacCase ->pathAdd (
83- result: $ hasCAAC ,
84- severity: "FAIL " ,
85- path: $ adaptationSet ->path (),
86- pass_message: "At least one 'caac' track found " ,
87- fail_message: "No 'caac' tracks found "
88- );
68+ if ($ mpdCache ->hasProfile ("urn:mpeg:cmaf:presentation_profile:cmfhd:2016 " )) {
69+ $ this ->caacCase ->pathAdd (
70+ result: $ hasCAAC ,
71+ severity: "FAIL " ,
72+ path: $ adaptationSet ->path (),
73+ pass_message: "At least one 'caac' track found " ,
74+ fail_message: "No 'caac' tracks found "
75+ );
76+ }
8977 }
9078
9179 //Private helper functions
92- private function validateAndDetermineBrand (Representation $ representation , Segment $ segment ): string
80+ private function validateAndDetermineBrand (Representation $ representation , Segment $ segment ): void
9381 {
9482 $ sdType = $ segment ->getSampleDescriptor ();
9583
96- if ($ sdType ! = 'mp4a ' ) {
97- return ' ____ ' ;
84+ if ($ sdType = = 'mp4a ' ) {
85+ $ this -> validateAndDetermineBrandAAC ( $ representation , $ segment ) ;
9886 }
99- return $ this ->validateAndDetermineBrandAAC ($ representation , $ segment );
10087 }
10188
102- private function validateAndDetermineBrandAAC (Representation $ representation , Segment $ segment ): string
89+ private function validateAndDetermineBrandAAC (Representation $ representation , Segment $ segment ): void
10390 {
10491 $ brands = $ segment ->getBrands ();
10592
106- $ highestBrand = '____ ' ; //Unknown
10793
10894 if (in_array ('caac ' , $ brands )) {
109- $ highestBrand = 'caac ' ;
11095 $ this ->validateAACParameters (
11196 representation: $ representation ,
11297 segment: $ segment ,
@@ -116,10 +101,6 @@ private function validateAndDetermineBrandAAC(Representation $representation, Se
116101 allowedObjectTypes: ["2 " ,"5 " ,"29 " ]
117102 );
118103 }
119- if (in_array ('caaa ' , $ brands )) {
120- $ highestBrand = 'caaa ' ;
121- }
122- return $ highestBrand ;
123104 }
124105
125106 /**
@@ -154,7 +135,7 @@ private function validateAACParameters(
154135
155136 $ this ->brandCase ->pathAdd (
156137 path: $ representation ->path () . "-init " ,
157- result: in_array ($ aacConfiguration ['objectTypeIndication ' ], $ allowedObjectTypes ),
138+ result: in_array ($ aacConfiguration ['streamType ' ], $ allowedObjectTypes ),
158139 severity: "FAIL " ,
159140 pass_message: "Signalled brand $ brand conforms to allowed object types " ,
160141 fail_message: "Signalled brand $ brand does not conform to allowed object types " ,
0 commit comments