[FFmpeg-devel] [PATCH] avcodec/openh264enc.c: generate IDR frame in response to I frame pict_type

Valery Kot valery.kot at gmail.com
Fri Mar 16 16:04:59 EET 2018


On Wed, Mar 14, 2018 at 2:12 PM, Moritz Barsnick <barsnick at gmx.net> wrote:
>
> On Mon, Mar 12, 2018 at 14:38:21 -0800, Lou Logan wrote:
>
> > But you don't necessarily need to make a new patch to address the
> > minor whitespace issue. You can wait for other comments and include
> > it with any other requested changes.
>
> Another whitespace nit:
>
> >  if (frame->pict_type==AV_PICTURE_TYPE_I) {
>
> Please use single spaces around operators, i.e.
>   if (frame->pict_type == AV_PICTURE_TYPE_I) {
>
> Moritz

Attached is an updated patch incorporating all feedback - only
formatting for now.

Friendly ping to maintainers to review and pull the patch.

Valery
-------------- next part --------------
From 8334dfcea924ac687783d2ad7685ad143a2f1a26 Mon Sep 17 00:00:00 2001
From: vkot <valery.kot at 4cinsights.com>
Date: Fri, 16 Mar 2018 14:50:34 +0100
Subject: [PATCH v2] avcodec/openh264enc.c: generate IDR frame in response to I
 frame pict_type

Signed-off-by: vkot <valery.kot at gmail.com>
---
 libavcodec/libopenh264enc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index fdadb101f5..83c3f0ce20 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -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");
-- 
2.15.1.windows.2



More information about the ffmpeg-devel mailing list