diff mbox series

[FFmpeg-devel] mfenc: Fix setting has_b_frames for max_b_frames == 1

Message ID 20200520211257.4542-1-martin@martin.st
State Accepted
Headers show
Series [FFmpeg-devel] mfenc: Fix setting has_b_frames for max_b_frames == 1 | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Martin Storsjö May 20, 2020, 9:12 p.m. UTC
This was a mistake in my own additions in
050b72ab5ef318605b305aa6cb920e8b52f1002e.
---
 libavcodec/mfenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

James Almer May 22, 2020, 5:41 p.m. UTC | #1
On 5/20/2020 6:12 PM, Martin Storsjö wrote:
> This was a mistake in my own additions in
> 050b72ab5ef318605b305aa6cb920e8b52f1002e.
> ---
>  libavcodec/mfenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/mfenc.c b/libavcodec/mfenc.c
> index dd8188dae3..e62ae4019a 100644
> --- a/libavcodec/mfenc.c
> +++ b/libavcodec/mfenc.c
> @@ -714,7 +714,7 @@ static int mf_encv_output_adjust(AVCodecContext *avctx, IMFMediaType *type)
>          // "scenario" to "camera_record" sets it in CFR mode (where the default
>          // is VFR), which makes the encoder avoid dropping frames.
>          ICodecAPI_SetValue(c->codec_api, &ff_CODECAPI_AVEncMPVDefaultBPictureCount, FF_VAL_VT_UI4(avctx->max_b_frames));
> -        avctx->has_b_frames = avctx->max_b_frames > 1 ? 1 : 0;
> +        avctx->has_b_frames = avctx->max_b_frames > 0 ? 1 : 0;

Can be simplified into "avctx->has_b_frames = avctx->max_b_frames > 0;"

>  
>          ICodecAPI_SetValue(c->codec_api, &ff_CODECAPI_AVEncH264CABACEnable, FF_VAL_VT_BOOL(1));

LGTM either way.
diff mbox series

Patch

diff --git a/libavcodec/mfenc.c b/libavcodec/mfenc.c
index dd8188dae3..e62ae4019a 100644
--- a/libavcodec/mfenc.c
+++ b/libavcodec/mfenc.c
@@ -714,7 +714,7 @@  static int mf_encv_output_adjust(AVCodecContext *avctx, IMFMediaType *type)
         // "scenario" to "camera_record" sets it in CFR mode (where the default
         // is VFR), which makes the encoder avoid dropping frames.
         ICodecAPI_SetValue(c->codec_api, &ff_CODECAPI_AVEncMPVDefaultBPictureCount, FF_VAL_VT_UI4(avctx->max_b_frames));
-        avctx->has_b_frames = avctx->max_b_frames > 1 ? 1 : 0;
+        avctx->has_b_frames = avctx->max_b_frames > 0 ? 1 : 0;
 
         ICodecAPI_SetValue(c->codec_api, &ff_CODECAPI_AVEncH264CABACEnable, FF_VAL_VT_BOOL(1));