From: Limin Wang <[email protected]>
Signed-off-by: Limin Wang <[email protected]>
---
libavcodec/h264_metadata_bsf.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c
index d96a50dbf7..a320589530 100644
--- a/libavcodec/h264_metadata_bsf.c
+++ b/libavcodec/h264_metadata_bsf.c
@@ -279,7 +279,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket
*pkt)
{
H264MetadataContext *ctx = bsf->priv_data;
CodedBitstreamFragment *au = &ctx->access_unit;
- int err, i, j, has_sps;
+ int err, i, j, has_sps, has_keyframe = 0;
H264RawAUD aud;
err = ff_bsf_get_packet_ref(bsf, pkt);
@@ -359,11 +359,13 @@ static int h264_metadata_filter(AVBSFContext *bsf,
AVPacket *pkt)
goto fail;
has_sps = 1;
}
+ if (au->units[i].type == H264_NAL_IDR_SLICE)
+ has_keyframe = 1;
}
// Only insert the SEI in access units containing SPSs, and also
// unconditionally in the first access unit we ever see.
- if (ctx->sei_user_data && (has_sps || !ctx->done_first_au)) {
+ if (ctx->sei_user_data && (has_sps || !ctx->done_first_au ||
has_keyframe)) {
H264RawSEIPayload payload = {
.payload_type = H264_SEI_TYPE_USER_DATA_UNREGISTERED,
};
--
2.21.0
_______________________________________________
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".