avcodec/openh264enc.c: generate IDR frame in response to I frame pict_type
authorValery Kot <valery.kot@4cinsights.com>
Fri, 16 Mar 2018 13:50:34 +0000 (14:50 +0100)
committerJames Almer <jamrial@gmail.com>
Thu, 5 Apr 2018 18:59:18 +0000 (15:59 -0300)
Signed-off-by: Valery Kot <valery.kot@gmail.com>
libavcodec/libopenh264enc.c

index fdadb10..83c3f0c 100644 (file)
@@ -246,6 +246,10 @@ static int svc_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
     sp.iPicWidth  = avctx->width;
     sp.iPicHeight = avctx->height;
 
+    if (frame->pict_type == AV_PICTURE_TYPE_I) {
+        (*s->encoder)->ForceIntraFrame(s->encoder, true);
+    }
+
     encoded = (*s->encoder)->EncodeFrame(s->encoder, &sp, &fbi);
     if (encoded != cmResultSuccess) {
         av_log(avctx, AV_LOG_ERROR, "EncodeFrame failed\n");