Skip to content

Commit 19cd646

Browse files
authored
Signing multiple GOPs can now handle incorrect P-frames (#458)
Corresponding tests have been activated.
1 parent 3f4a3e7 commit 19cd646

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

lib/src/sv_auth.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ extend_partial_gop(signed_video_t *self, const bu_list_item_t *sei)
353353

354354
// Mark the item and move to next.
355355
item->associated_sei = sei;
356+
self->tmp_num_in_partial_gop++;
356357
item = item->next;
357358
}
358359
}
@@ -412,7 +413,7 @@ verify_hashes_with_hash_list(signed_video_t *self,
412413
break;
413414
}
414415
// If this item is not Pending or not part of the GOP hash, move to the next one.
415-
if (item->tmp_validation_status != 'P' || !item->associated_sei) {
416+
if (item->tmp_validation_status != 'P' || (item->associated_sei != sei)) {
416417
DEBUG_LOG("Skipping non-pending Bitstream Unit");
417418
item = item->next;
418419
continue;
@@ -507,6 +508,16 @@ verify_hashes_with_hash_list(signed_video_t *self,
507508
bu_list_add_missing(bu_list, num_unused_expected_hashes, true, last_used_item, sei);
508509
}
509510

511+
// Remove SEI associations which were never used. This happens if there are missing BUs
512+
// within a partial GOP.
513+
while (item) {
514+
if (item->associated_sei == sei) {
515+
item->associated_sei = NULL;
516+
self->tmp_num_in_partial_gop--;
517+
}
518+
item = item->next;
519+
}
520+
510521
if (num_expected) *num_expected = num_expected_hashes;
511522
if (num_received) *num_received = num_verified_hashes;
512523

tests/check/check_signed_video_auth.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2913,8 +2913,6 @@ END_TEST
29132913

29142914
START_TEST(modify_one_p_frame_multiple_gops)
29152915
{
2916-
// Enable when validation can be made without dead lock.
2917-
return;
29182916
// Device side
29192917
struct sv_setting setting = settings[_i];
29202918
const unsigned signing_frequency = 3;
@@ -2951,8 +2949,6 @@ END_TEST
29512949

29522950
START_TEST(remove_one_p_frame_multiple_gops)
29532951
{
2954-
// Enable when validation can be made without dead lock.
2955-
return;
29562952
// Device side
29572953
struct sv_setting setting = settings[_i];
29582954
const unsigned signing_frequency = 3;
@@ -3002,8 +2998,6 @@ END_TEST
30022998

30032999
START_TEST(add_one_p_frame_multiple_gops)
30043000
{
3005-
// Enable when validation can be made without dead lock.
3006-
return;
30073001
// Device side
30083002
struct sv_setting setting = settings[_i];
30093003
const unsigned signing_frequency = 3;

0 commit comments

Comments
 (0)