[FFmpeg-devel] [PATCH] lavc/vaapi_encode_h264: disable B frame in baseline profile

Jun Zhao mypopydev at gmail.com
Fri Dec 16 04:21:25 EET 2016


From a4b410e02ac4864c7d82b15474a65ed42a84da6a Mon Sep 17 00:00:00 2001
From: Jun Zhao <jun.zhao at intel.com>
Date: Fri, 16 Dec 2016 09:49:57 +0800
Subject: [PATCH] lavc/vaapi_encode_h264: disable B frame in baseline profile.

disable B frames when usd baseline/constrined baseline profile,
it's base on H.264 spec Annex A.2.1.

Signed-off-by: Jun Zhao <jun.zhao at intel.com>
Signed-off-by: Yi A Wang <yi.a.wang at intel.com>
---
 libavcodec/vaapi_encode_h264.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index 69cc483..075f800 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -1190,9 +1190,19 @@ static av_cold int vaapi_encode_h264_init(AVCodecContext *avctx)
     switch (avctx->profile) {
     case FF_PROFILE_H264_CONSTRAINED_BASELINE:
         ctx->va_profile = VAProfileH264ConstrainedBaseline;
+        if (avctx->max_b_frames != 0) {
+            avctx->max_b_frames = 0;
+            av_log(avctx, AV_LOG_WARNING, "H.264 constrained baseline "
+                   "profile don't support encode B frame.\n");
+        }
         break;
     case FF_PROFILE_H264_BASELINE:
         ctx->va_profile = VAProfileH264Baseline;
+        if (avctx->max_b_frames != 0) {
+            avctx->max_b_frames = 0;
+            av_log(avctx, AV_LOG_WARNING, "H.264 baseline "
+                   "profile don't support encode B frame.\n");
+        }
         break;
     case FF_PROFILE_H264_MAIN:
         ctx->va_profile = VAProfileH264Main;
-- 
2.9.3



More information about the ffmpeg-devel mailing list