diff mbox series

[FFmpeg-devel] avcodec/mediacodecenc: enable B frames only with -strict experimental

Message ID tencent_C46F95C42915EEAF054D93116849F3E9F305@qq.com
State New
Headers show
Series [FFmpeg-devel] avcodec/mediacodecenc: enable B frames only with -strict experimental | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Zhao Zhili Jan. 5, 2023, 4:58 p.m. UTC
From: Zhao Zhili <zhilizhao@tencent.com>

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
---
 libavcodec/mediacodecenc.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Tomas Härdin Jan. 5, 2023, 5:11 p.m. UTC | #1
fre 2023-01-06 klockan 00:58 +0800 skrev Zhao Zhili:
> From: Zhao Zhili <zhilizhao@tencent.com>
> 
> Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
> ---
>  libavcodec/mediacodecenc.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c
> index 4c1809093c..7a498f039e 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,
> +                    "Enable B frames will produce packets with no
> DTS. "

Enabling

Also did you get my e-mail? I have some patches coming hopefully later
today

/Tomas
diff mbox series

Patch

diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c
index 4c1809093c..7a498f039e 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,
+                    "Enable 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;