Skip to content

Commit

Permalink
Only sanity check available SEIs if deprecated API (#251)
Browse files Browse the repository at this point in the history
If SEIs are available, but could not be fetched with the
signed_video_get_sei(...) API, since it would otherwise break the
H.26x standard, make sure to override the sanity check.

Co-authored-by: bjornvolcker <[email protected]>
  • Loading branch information
bjornvolcker and bjornvolcker authored Nov 4, 2024
1 parent 9f24423 commit 8716e64
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/src/signed_video_h26x_sign.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,10 @@ prepare_for_nalus_to_prepend(signed_video_t *self)
// proceed. But if there are vital SEI-nalus waiting to be pulled we return an error message
// (SV_NOT_SUPPORTED).

SV_THROW_IF_WITH_MSG(
self->num_of_completed_seis > 0, SV_NOT_SUPPORTED, "There are remaining SEIs.");
if (!self->avoid_checking_available_seis) {
SV_THROW_IF_WITH_MSG(
self->num_of_completed_seis > 0, SV_NOT_SUPPORTED, "There are remaining SEIs.");
}
SV_CATCH()
SV_DONE(status)

Expand Down Expand Up @@ -652,6 +654,9 @@ signed_video_get_sei(signed_video_t *self,
// Only display a SEI if the |peek_nalu| is a primary picture NAL Unit.
if (!((nalu_info.nalu_type == NALU_TYPE_I || nalu_info.nalu_type == NALU_TYPE_P) &&
nalu_info.is_primary_slice)) {
// Flip the sanity check flag since there are pending SEIs, which could not be fetched without
// breaking the H.26x standard.
self->avoid_checking_available_seis = true;
return SV_OK;
}
}
Expand Down
4 changes: 4 additions & 0 deletions lib/src/signed_video_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ struct _signed_video_t {
// unnecessary.
bool gop_hash_off; // Flag indicating if the GENERAL TAG doesn't include GOP hash.
// TODO: |gop_hash_off| will be deprecated when the feature is fully integrated.
// TODO: Remove this flag when the deprecated API get_nalus_to_prepend have been removed.
bool avoid_checking_available_seis; // Temporary flag to avoid checking for available SEIs when
// peek NAL Units are used when getting SEIs, since they
// might be postponed.

// For signing plugin
void *plugin_handle;
Expand Down

0 comments on commit 8716e64

Please sign in to comment.