[FFmpeg-devel] [PATCH] lavc/vaapi_encode: Don't return error if the underlying driver doesn't support B frame

Haihao Xiang haihao.xiang at intel.com
Tue Feb 6 10:17:17 EET 2018


It is possible B frame is not supported for VAEntrypointEncSliceLP and
the underlying driver has advertised it, so it is better to disable B
frame instead of returning error for this case

Signed-off-by: Haihao Xiang <haihao.xiang at intel.com>
---
 libavcodec/vaapi_encode.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 550ea47991d..e371f5761ee 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -1094,10 +1094,9 @@ static av_cold int vaapi_encode_config_attributes(AVCodecContext *avctx)
                 goto fail;
             }
             if (avctx->max_b_frames > 0 && ref_l1 < 1) {
-                av_log(avctx, AV_LOG_ERROR, "B frames are not "
-                       "supported (%#x).\n", attr[i].value);
-                err = AVERROR(EINVAL);
-                goto fail;
+                av_log(avctx, AV_LOG_WARNING, "B frames are not "
+                       "supported (%#x) by the underlying driver.\n", attr[i].value);
+                avctx->max_b_frames = 0;
             }
         }
         break;
-- 
2.14.1



More information about the ffmpeg-devel mailing list