@@ -632,6 +632,8 @@ signed_video_add_nalu_part_for_signing_with_timestamp(signed_video_t *self,
632632 }
633633 bu_info .hashable_data_size = bu_data_size ;
634634 }
635+ // Only completed primary slices, unless FH, can trigger actions.
636+ bool is_actionable = bu_info .is_primary_slice && bu_info .is_last_bu_part && !bu_info .is_fh ;
635637
636638 status = SV_UNKNOWN_FAILURE ;
637639 SV_TRY ()
@@ -642,24 +644,23 @@ signed_video_add_nalu_part_for_signing_with_timestamp(signed_video_t *self,
642644 // Note that |recurrence| is counted in frames and not in BUs, hence we only increment the
643645 // counter for primary slices. Frame counting is updated at the end of a frame, hence
644646 // shall be ignored for FH.
645- if (bu_info . is_primary_slice && bu_info . is_last_bu_part && ! bu_info . is_fh ) {
647+ if (is_actionable ) {
646648 if ((self -> frame_count % self -> recurrence ) == 0 ) {
647649 self -> has_recurrent_data = true;
648650 }
649651 self -> frame_count ++ ; // It is ok for this variable to wrap around
650652 }
651653
652654 // Determine if a SEI should be generated.
653- bool new_gop = (bu_info .is_first_bu_in_gop && bu_info .is_last_bu_part );
654- // Do not trigger on FH.
655- new_gop &= !bu_info .is_fh ;
655+ // Check for a new GOP.
656+ bool new_gop = bu_info .is_first_bu_in_gop && is_actionable ;
656657 // Trigger signing if number of frames exceeds the limit for a partial GOP.
657658 bool trigger_signing = ((self -> max_signing_frames > 0 ) &&
658659 (gop_info -> num_frames_in_partial_gop >= self -> max_signing_frames ));
659660 // Only trigger if this Bitstream Unit is hashable, hence will be added to the hash
660661 // list. Also, trigger on a primary slice. Otherwise two slices belonging to the same
661662 // frame will be part of different SEIs.
662- trigger_signing &= bu_info .is_hashable && bu_info . is_primary_slice ;
663+ trigger_signing &= bu_info .is_hashable && is_actionable ;
663664 gop_info -> triggered_partial_gop = false;
664665 // Depending on the input Bitstream Unit, different actions are taken. If the input is
665666 // an I-frame there is a transition to a new GOP. That triggers generating a SEI. If
@@ -709,7 +710,7 @@ signed_video_add_nalu_part_for_signing_with_timestamp(signed_video_t *self,
709710 }
710711 SV_THROW (sv_hash_and_add (self , & bu_info ));
711712 // Increment frame counter after the incoming Bitstream Unit has been processed.
712- if (bu_info . is_primary_slice && bu_info . is_last_bu_part ) {
713+ if (is_actionable ) {
713714 gop_info -> num_frames_in_partial_gop ++ ;
714715 }
715716
@@ -1089,7 +1090,7 @@ signed_video_set_hash_algo(signed_video_t *self, const char *name_or_oid)
10891090}
10901091
10911092SignedVideoReturnCode
1092- signed_viedo_set_max_signing_frames (signed_video_t * self , unsigned max_signing_frames )
1093+ signed_video_set_max_signing_frames (signed_video_t * self , unsigned max_signing_frames )
10931094{
10941095 if (!self ) {
10951096 return SV_INVALID_PARAMETER ;
0 commit comments