aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhao Zhili <zhilizhao@tencent.com>2023-01-07 00:07:05 +0800
committerZhao Zhili <zhilizhao@tencent.com>2023-01-09 19:21:57 +0800
commita598be44dff810b41c07547cc897b60b8fed9f9e (patch)
tree362ecf5cbe448be34df8d5834d860ea82236437a
parentfcd557a2c2174d89cb85630ef06c160027d52fa3 (diff)
downloadffmpeg-a598be44dff810b41c07547cc897b60b8fed9f9e.tar.gz
avcodec/mediacodecenc: enable B frames only with -strict experimental
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
-rw-r--r--libavcodec/mediacodecenc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c
index 4c1809093c..a92a8dc5a9 100644
--- a/libavcodec/mediacodecenc.c
+++ b/libavcodec/mediacodecenc.c
@@ -276,8 +276,16 @@ static av_cold int mediacodec_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_DEBUG, "set level to 0x%x\n", s->level);
ff_AMediaFormat_setInt32(format, "level", s->level);
}
- if (avctx->max_b_frames > 0)
+ if (avctx->max_b_frames > 0) {
+ if (avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Enabling B frames will produce packets with no DTS. "
+ "Use -strict experimental to use it anyway.\n");
+ ret = AVERROR(EINVAL);
+ goto bailout;
+ }
ff_AMediaFormat_setInt32(format, "max-bframes", avctx->max_b_frames);
+ }
if (s->pts_as_dts == -1)
s->pts_as_dts = avctx->max_b_frames <= 0;