@@ -773,6 +773,14 @@ validate_authenticity(signed_video_t *self, bu_list_item_t *sei)
773
773
// Collect statistics from the bu_list. This is used to validate the GOP and provide additional
774
774
// information to the user.
775
775
bool has_valid_bu = bu_list_get_stats (self -> bu_list , sei , & num_invalid , & num_missed );
776
+ // Stats may be collected across multiple GOPs, therefore, remove previous stats
777
+ // when deciding upon validation result.
778
+ num_invalid -= validation_flags -> num_invalid ;
779
+ // TODO: Workaround for special cases where intermediate GOPs are verified without SEI.
780
+ if (num_invalid < 0 ) {
781
+ num_invalid = 0 ;
782
+ }
783
+ validation_flags -> num_invalid += num_invalid ;
776
784
DEBUG_LOG ("Number of invalid Bitstream Units = %d." , num_invalid );
777
785
DEBUG_LOG ("Number of missed Bitstream Units = %d." , num_missed );
778
786
// Update the counted Bitstream Units part of this validation, since it may have changed.
@@ -1240,6 +1248,10 @@ maybe_validate_gop(signed_video_t *self, bu_info_t *bu)
1240
1248
validation_flags -> has_auth_result = true;
1241
1249
// All statistics but pending BUs have already been collected.
1242
1250
latest -> number_of_pending_picture_nalus = bu_list_num_pending_items (bu_list );
1251
+ DEBUG_LOG ("Validated GOP as %s" , kAuthResultValidStr [latest -> authenticity ]);
1252
+ DEBUG_LOG ("Expected Bitstream Units = %d" , latest -> number_of_expected_picture_nalus );
1253
+ DEBUG_LOG ("Received Bitstream Units = %d" , latest -> number_of_received_picture_nalus );
1254
+ DEBUG_LOG (" Pending Bitstream Units = %d" , latest -> number_of_pending_picture_nalus );
1243
1255
}
1244
1256
if (latest -> authenticity == SV_AUTH_RESULT_NOT_SIGNED ) {
1245
1257
// Only report "stream is unsigned" in the accumulated report.
@@ -1265,16 +1277,6 @@ maybe_validate_gop(signed_video_t *self, bu_info_t *bu)
1265
1277
// Re-compute number of pending BUs.
1266
1278
latest -> number_of_pending_picture_nalus = bu_list_num_pending_items (bu_list );
1267
1279
}
1268
-
1269
- if (!validation_flags -> waiting_for_signature ) {
1270
- // All statistics but pending BUs have already been collected.
1271
- DEBUG_LOG ("Validated GOP as %s" , kAuthResultValidStr [latest -> authenticity ]);
1272
- DEBUG_LOG (
1273
- "Expected number of Bitstream Units = %d" , latest -> number_of_expected_picture_nalus );
1274
- DEBUG_LOG (
1275
- "Received number of Bitstream Units = %d" , latest -> number_of_received_picture_nalus );
1276
- DEBUG_LOG ("Number of pending Bitstream Units = %d" , latest -> number_of_pending_picture_nalus );
1277
- }
1278
1280
SV_CATCH ()
1279
1281
SV_DONE (status )
1280
1282
0 commit comments