@@ -53,7 +53,7 @@ function process_MPD($parseSegments = false)
5353 ## If only MPD validation is requested or inferred, stop
5454 ## If any error is found in the MPD validation process, stop
5555 ## If no error is found, then proceed with segment validation below
56- // $valid_mpd = validate_MPD();
56+ // $valid_mpd = validate_MPD();
5757
5858
5959
@@ -64,14 +64,14 @@ function process_MPD($parseSegments = false)
6464 }
6565
6666 if (!$ parseSegments ) {
67- fwrite (STDERR ,($ parseSegments ? "DO " : "DO NOT " ) . "parse segments \n" );
67+ fwrite (STDERR , ($ parseSegments ? "DO " : "DO NOT " ) . "parse segments \n" );
6868 return ;
6969 }
7070
7171 //------------------------------------------------------------------------//
7272 ## Perform Segment Validation for each representation in each adaptation set within the current period
7373 if (!checkBeforeSegmentValidation ()) {
74- return ;
74+ return ;
7575 }
7676 if ($ mpd_features ['type ' ] !== 'dynamic ' ) {
7777 $ current_period = 0 ;
@@ -108,16 +108,23 @@ function processAdaptationSetOfCurrentPeriod($period, $ResultXML, $segment_urls)
108108
109109 global $ modules ;
110110
111+ global $ logger ;
111112
112113 $ adaptation_sets = $ period ['AdaptationSet ' ];
113114 while ($ current_adaptation_set < sizeof ($ adaptation_sets )) {
115+ if ($ logger ->getModuleVerdict ("HEALTH " ) == "FAIL " ) {
116+ break ;
117+ }
114118 $ adaptation_set = $ adaptation_sets [$ current_adaptation_set ];
115119 $ representations = $ adaptation_set ['Representation ' ];
116120
117121 $ adaptationDirectory = $ session ->getAdaptationDir ($ current_period , $ current_adaptation_set );
118122
119123
120124 while ($ current_representation < sizeof ($ representations )) {
125+ if ($ logger ->getModuleVerdict ("HEALTH " ) == "FAIL " ) {
126+ break ;
127+ }
121128 $ representation = $ representations [$ current_representation ];
122129 $ segment_url = $ segment_urls [$ current_adaptation_set ][$ current_representation ];
123130
@@ -131,7 +138,12 @@ function processAdaptationSetOfCurrentPeriod($period, $ResultXML, $segment_urls)
131138 }
132139 }
133140
141+ $ logger ->setModule ("HEALTH " );
134142 validate_segment ($ adaptationDirectory , $ representationDirectory , $ period , $ adaptation_set , $ representation , $ segment_url , $ is_subtitle_rep );
143+ $ logger ->write ();
144+ if ($ logger ->getModuleVerdict ("HEALTH " ) == "FAIL " ) {
145+ break ;
146+ }
135147
136148 foreach ($ modules as $ module ) {
137149 if ($ module ->isEnabled ()) {
@@ -141,6 +153,9 @@ function processAdaptationSetOfCurrentPeriod($period, $ResultXML, $segment_urls)
141153
142154 $ current_representation ++;
143155 }
156+ if ($ logger ->getModuleVerdict ("HEALTH " ) == "FAIL " ) {
157+ break ;
158+ }
144159
145160 ## Representations in current Adaptation Set finished
146161 crossRepresentationProcess ();
@@ -155,10 +170,12 @@ function processAdaptationSetOfCurrentPeriod($period, $ResultXML, $segment_urls)
155170 $ current_adaptation_set ++;
156171 }
157172
173+ if ($ logger ->getModuleVerdict ("HEALTH " ) != "FAIL " ) {
158174 ## Adaptation Sets in current Period finished
159- foreach ($ modules as $ module ) {
160- if ($ module ->isEnabled ()) {
161- $ module ->hookAdaptationSet ();
175+ foreach ($ modules as $ module ) {
176+ if ($ module ->isEnabled ()) {
177+ $ module ->hookAdaptationSet ();
178+ }
162179 }
163180 }
164181 //err_file_op(2);
0 commit comments