ffmpeg: update rkmppdec patches

This commit is contained in:
Jonas Karlman 2018-11-04 10:34:18 +01:00
parent e38d131824
commit a622fff814
2 changed files with 33 additions and 17 deletions

View File

@ -1,25 +1,44 @@
From 277118ae73eab2ddad116bf923b9553db3a871d0 Mon Sep 17 00:00:00 2001
From 35e9805c3dfc636d1a3130411c5c210c091776ee Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Sun, 9 Sep 2018 12:37:29 +0200
Subject: [PATCH] rkmppdec: continue on errinfo frame
---
libavcodec/rkmppdec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
libavcodec/rkmppdec.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libavcodec/rkmppdec.c b/libavcodec/rkmppdec.c
index c00f08c70b..7c246db0d1 100644
index c00f08c70b..72be832141 100644
--- a/libavcodec/rkmppdec.c
+++ b/libavcodec/rkmppdec.c
@@ -386,7 +386,7 @@ static int rkmpp_retrieve_frame(AVCodecContext *avctx, AVFrame *frame)
@@ -49,6 +49,7 @@ typedef struct {
char first_packet;
char eos_reached;
+ int errors;
AVBufferRef *frames_ref;
AVBufferRef *device_ref;
@@ -386,12 +387,13 @@ static int rkmpp_retrieve_frame(AVCodecContext *avctx, AVFrame *frame)
goto fail;
} else if (mpp_frame_get_errinfo(mppframe)) {
av_log(avctx, AV_LOG_ERROR, "Received a errinfo frame.\n");
- ret = AVERROR_UNKNOWN;
+ ret = AVERROR(EAGAIN);
+ ret = (decoder->errors++ > 100) ? AVERROR_UNKNOWN : AVERROR(EAGAIN);
goto fail;
}
--
2.18.0
// here we should have a valid frame
av_log(avctx, AV_LOG_DEBUG, "Received a frame.\n");
+ decoder->errors = 0;
// setup general frame fields
frame->format = AV_PIX_FMT_DRM_PRIME;
@@ -544,6 +546,7 @@ static void rkmpp_flush(AVCodecContext *avctx)
ret = decoder->mpi->reset(decoder->ctx);
if (ret == MPP_OK) {
decoder->first_packet = 1;
+ decoder->errors = 0;
} else
av_log(avctx, AV_LOG_ERROR, "Failed to reset MPI (code = %d)\n", ret);
}

View File

@ -1,4 +1,4 @@
From 944f3bc90fb402b11f2419e5877a1f8395ba7e6a Mon Sep 17 00:00:00 2001
From 7ddf0485e54d624d11aaa0234e7bf4b9b8393ae3 Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Wed, 12 Sep 2018 22:29:22 +0200
Subject: [PATCH] rkmppdec: enable mpeg2
@ -47,10 +47,10 @@ index 4d4ef530e4..07e1216333 100644
extern AVCodec ff_mpeg2_mediacodec_decoder;
extern AVCodec ff_msa1_decoder;
diff --git a/libavcodec/rkmppdec.c b/libavcodec/rkmppdec.c
index 7c246db0d1..cf41f8895a 100644
index 72be832141..48016bc681 100644
--- a/libavcodec/rkmppdec.c
+++ b/libavcodec/rkmppdec.c
@@ -69,6 +69,7 @@ static MppCodingType rkmpp_get_codingtype(AVCodecContext *avctx)
@@ -70,6 +70,7 @@ static MppCodingType rkmpp_get_codingtype(AVCodecContext *avctx)
switch (avctx->codec_id) {
case AV_CODEC_ID_H264: return MPP_VIDEO_CodingAVC;
case AV_CODEC_ID_HEVC: return MPP_VIDEO_CodingHEVC;
@ -58,7 +58,7 @@ index 7c246db0d1..cf41f8895a 100644
case AV_CODEC_ID_VP8: return MPP_VIDEO_CodingVP8;
case AV_CODEC_ID_VP9: return MPP_VIDEO_CodingVP9;
default: return MPP_VIDEO_CodingUnused;
@@ -403,6 +404,12 @@ static int rkmpp_retrieve_frame(AVCodecContext *avctx, AVFrame *frame)
@@ -405,6 +406,12 @@ static int rkmpp_retrieve_frame(AVCodecContext *avctx, AVFrame *frame)
frame->color_trc = mpp_frame_get_color_trc(mppframe);
frame->colorspace = mpp_frame_get_colorspace(mppframe);
@ -71,13 +71,10 @@ index 7c246db0d1..cf41f8895a 100644
mode = mpp_frame_get_mode(mppframe);
frame->interlaced_frame = ((mode & MPP_FRAME_FLAG_FIELD_ORDER_MASK) == MPP_FRAME_FLAG_DEINTERLACED);
frame->top_field_first = ((mode & MPP_FRAME_FLAG_FIELD_ORDER_MASK) == MPP_FRAME_FLAG_TOP_FIRST);
@@ -582,5 +589,6 @@ static const AVCodecHWConfigInternal *rkmpp_hw_configs[] = {
@@ -585,5 +592,6 @@ static const AVCodecHWConfigInternal *rkmpp_hw_configs[] = {
RKMPP_DEC(h264, AV_CODEC_ID_H264, "h264_mp4toannexb")
RKMPP_DEC(hevc, AV_CODEC_ID_HEVC, "hevc_mp4toannexb")
+RKMPP_DEC(mpeg2, AV_CODEC_ID_MPEG2VIDEO, NULL)
RKMPP_DEC(vp8, AV_CODEC_ID_VP8, NULL)
RKMPP_DEC(vp9, AV_CODEC_ID_VP9, NULL)
--
2.18.0