Message ID | b032d120-1267-4740-0fe2-db0bec339cc0@gmail.com |
---|---|
State | Accepted |
Commit | b53b3a4f6abcc97d4cdcc1f025ef803fcfab18c6 |
Headers | show |
On 09/01/17 00:10, Jun Zhao wrote: > V2: rephrasing based on Moritz Barsnick's comments > > From f9e62cc90b546643419e394c09b93e901d517997 Mon Sep 17 00:00:00 2001 > From: Jun Zhao <mypopydev@gmail.com> > Date: Sun, 8 Jan 2017 11:01:32 +0800 > Subject: [PATCH v2] lavc/vaapi_encode_h264: disable B frame in baseline > profile. > > disable B frames when enabling baseline/constrined baseline profile, > it's base on H.264 spec Annex A.2.1. > > Signed-off-by: Jun Zhao <jun.zhao@intel.com> > Signed-off-by: Yi A Wang <yi.a.wang@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..00d8e6a 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 " > + "doesn't support encoding with B frames, disabling them.\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 " > + "doesn't support encoding with B frames, disabling them.\n"); > + } > break; > case FF_PROFILE_H264_MAIN: > ctx->va_profile = VAProfileH264Main; > -- > 2.1.4 LGTM, tested, applied with minor language fixup in the commit message. Thanks, - Mark
diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c index 69cc483..00d8e6a 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 " + "doesn't support encoding with B frames, disabling them.\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 " + "doesn't support encoding with B frames, disabling them.\n"); + } break; case FF_PROFILE_H264_MAIN: ctx->va_profile = VAProfileH264Main;