Fix build with latest rockchip-mpp version 20171218
References ---------- https://trac.ffmpeg.org/ticket/6834 http://git.videolan.org/?p=ffmpeg.git;a=commit;h=c6f84106366c6f243a8b07dbffcc7880009aa904 Also important -------------- http://git.videolan.org/?p=ffmpeg.git;a=commit;h=2ca65fc7b74444edd51d5803a2c1e05a801a6023
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
# Generated by mksrcinfo v8
|
# Generated by mksrcinfo v8
|
||||||
# Fri Dec 22 22:17:41 UTC 2017
|
# Sun Jan 7 02:25:28 UTC 2018
|
||||||
pkgbase = ffmpeg-full
|
pkgbase = ffmpeg-full
|
||||||
pkgdesc = Record, convert and stream audio and video (all possible features including nvenc, qsv and libfdk-aac)
|
pkgdesc = Record, convert and stream audio and video (all possible features including nvenc, qsv and libfdk-aac)
|
||||||
pkgver = 3.4.1
|
pkgver = 3.4.1
|
||||||
pkgrel = 1
|
pkgrel = 2
|
||||||
url = http://www.ffmpeg.org/
|
url = http://www.ffmpeg.org/
|
||||||
arch = i686
|
arch = i686
|
||||||
arch = x86_64
|
arch = x86_64
|
||||||
@@ -119,8 +119,12 @@ pkgbase = ffmpeg-full
|
|||||||
conflicts = ffmpeg-semifull-git
|
conflicts = ffmpeg-semifull-git
|
||||||
conflicts = ffmpeg-qsv-git
|
conflicts = ffmpeg-qsv-git
|
||||||
source = https://ffmpeg.org/releases/ffmpeg-3.4.1.tar.xz
|
source = https://ffmpeg.org/releases/ffmpeg-3.4.1.tar.xz
|
||||||
|
source = ffmpeg-full-rkmpp-build-fix.patch
|
||||||
|
source = ffmpeg-full-rkmpp-remove-stream-start.patch
|
||||||
source = LICENSE
|
source = LICENSE
|
||||||
sha256sums = 5a77278a63741efa74e26bf197b9bb09ac6381b9757391b922407210f0f991c0
|
sha256sums = 5a77278a63741efa74e26bf197b9bb09ac6381b9757391b922407210f0f991c0
|
||||||
|
sha256sums = 142923fd02851343bfbfd31b201ba014dced8a8c8898373c72d71d30d59f5851
|
||||||
|
sha256sums = cac8577126c3e49f8c915fa289f3f5aa624dc55f897b8b7a5613191bcfa9c097
|
||||||
sha256sums = 04a7176400907fd7db0d69116b99de49e582a6e176b3bfb36a03e50a4cb26a36
|
sha256sums = 04a7176400907fd7db0d69116b99de49e582a6e176b3bfb36a03e50a4cb26a36
|
||||||
depends_x86_64 = cuda
|
depends_x86_64 = cuda
|
||||||
depends_x86_64 = nvidia-utils
|
depends_x86_64 = nvidia-utils
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
pkgname=ffmpeg-full
|
pkgname=ffmpeg-full
|
||||||
_srcname=ffmpeg
|
_srcname=ffmpeg
|
||||||
pkgver=3.4.1
|
pkgver=3.4.1
|
||||||
pkgrel=1
|
pkgrel=2
|
||||||
pkgdesc='Record, convert and stream audio and video (all possible features including nvenc, qsv and libfdk-aac)'
|
pkgdesc='Record, convert and stream audio and video (all possible features including nvenc, qsv and libfdk-aac)'
|
||||||
arch=('i686' 'x86_64')
|
arch=('i686' 'x86_64')
|
||||||
url='http://www.ffmpeg.org/'
|
url='http://www.ffmpeg.org/'
|
||||||
@@ -51,10 +51,21 @@ conflicts=(
|
|||||||
'ffmpeg-git' 'ffmpeg-full-git' 'ffmpeg-semifull-git' 'ffmpeg-qsv-git'
|
'ffmpeg-git' 'ffmpeg-full-git' 'ffmpeg-semifull-git' 'ffmpeg-qsv-git'
|
||||||
)
|
)
|
||||||
source=("https://ffmpeg.org/releases/ffmpeg-${pkgver}.tar.xz"
|
source=("https://ffmpeg.org/releases/ffmpeg-${pkgver}.tar.xz"
|
||||||
|
'ffmpeg-full-rkmpp-build-fix.patch'
|
||||||
|
'ffmpeg-full-rkmpp-remove-stream-start.patch'
|
||||||
'LICENSE')
|
'LICENSE')
|
||||||
sha256sums=('5a77278a63741efa74e26bf197b9bb09ac6381b9757391b922407210f0f991c0'
|
sha256sums=('5a77278a63741efa74e26bf197b9bb09ac6381b9757391b922407210f0f991c0'
|
||||||
|
'142923fd02851343bfbfd31b201ba014dced8a8c8898373c72d71d30d59f5851'
|
||||||
|
'cac8577126c3e49f8c915fa289f3f5aa624dc55f897b8b7a5613191bcfa9c097'
|
||||||
'04a7176400907fd7db0d69116b99de49e582a6e176b3bfb36a03e50a4cb26a36')
|
'04a7176400907fd7db0d69116b99de49e582a6e176b3bfb36a03e50a4cb26a36')
|
||||||
|
|
||||||
|
prepare() {
|
||||||
|
cd "${_srcname}-${pkgver}"
|
||||||
|
|
||||||
|
patch -Np1 -i "${srcdir}/ffmpeg-full-rkmpp-build-fix.patch"
|
||||||
|
patch -Np1 -i "${srcdir}/ffmpeg-full-rkmpp-remove-stream-start.patch"
|
||||||
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
cd "${_srcname}-${pkgver}"
|
cd "${_srcname}-${pkgver}"
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
From: LongChair <longchair@hotmail.com>
|
||||||
|
Date: Sat, 6 Jan 2018 08:36:58 +0000 (+0100)
|
||||||
|
Subject: avcodec/rkmpp : Fix broken build due to missing control operation
|
||||||
|
X-Git-Url: http://git.videolan.org/?p=ffmpeg.git;a=commitdiff_plain;h=c6f84106366c6f243a8b07dbffcc7880009aa904
|
||||||
|
|
||||||
|
avcodec/rkmpp : Fix broken build due to missing control operation
|
||||||
|
|
||||||
|
This patch is taking care of https://trac.ffmpeg.org/ticket/6834.
|
||||||
|
It seems that one of the control operations that was available to get
|
||||||
|
the free decoders input slots was removed.
|
||||||
|
|
||||||
|
There is another control operation to retrieve the used slots. Given
|
||||||
|
that the input slot count is hardcoded to 4 in mpp at this point,
|
||||||
|
replacing the old control operation by the other one.
|
||||||
|
|
||||||
|
This was tested on Rockchip ROCK64.
|
||||||
|
|
||||||
|
Signed-off-by: wm4 <nfxjfg@googlemail.com>
|
||||||
|
---
|
||||||
|
|
||||||
|
diff -Naurp a/configure b/configure
|
||||||
|
--- a/configure 2017-12-10 19:35:18.000000000 -0200
|
||||||
|
+++ b/configure 2018-01-06 23:27:24.057673297 -0200
|
||||||
|
@@ -6077,10 +6077,8 @@ enabled openssl && { use_pkg_c
|
||||||
|
check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
|
||||||
|
check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
|
||||||
|
die "ERROR: openssl not found"; }
|
||||||
|
-enabled rkmpp && { { require_pkg_config rockchip_mpp rockchip_mpp rockchip/rk_mpi.h mpp_create ||
|
||||||
|
- die "ERROR : Rockchip MPP was not found."; } &&
|
||||||
|
- { check_func_headers rockchip/rk_mpi_cmd.h "MPP_DEC_GET_FREE_PACKET_SLOT_COUNT" ||
|
||||||
|
- die "ERROR: Rockchip MPP is outdated, please get a more recent one."; } &&
|
||||||
|
+enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create &&
|
||||||
|
+ require_pkg_config rockchip_mpp "rockchip_mpp >= 1.3.7" rockchip/rk_mpi.h mpp_create &&
|
||||||
|
{ enabled libdrm ||
|
||||||
|
die "ERROR: rkmpp requires --enable-libdrm"; }
|
||||||
|
}
|
||||||
|
diff --git a/libavcodec/rkmppdec.c b/libavcodec/rkmppdec.c
|
||||||
|
index c57a6ded38..946b827918 100644
|
||||||
|
--- a/libavcodec/rkmppdec.c
|
||||||
|
+++ b/libavcodec/rkmppdec.c
|
||||||
|
@@ -40,6 +40,7 @@
|
||||||
|
|
||||||
|
#define RECEIVE_FRAME_TIMEOUT 100
|
||||||
|
#define FRAMEGROUP_MAX_FRAMES 16
|
||||||
|
+#define INPUT_MAX_PACKETS 4
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
MppCtx ctx;
|
||||||
|
@@ -515,16 +516,17 @@ static int rkmpp_receive_frame(AVCodecContext *avctx, AVFrame *frame)
|
||||||
|
RKMPPDecoder *decoder = (RKMPPDecoder *)rk_context->decoder_ref->data;
|
||||||
|
int ret = MPP_NOK;
|
||||||
|
AVPacket pkt = {0};
|
||||||
|
- RK_S32 freeslots;
|
||||||
|
+ RK_S32 usedslots, freeslots;
|
||||||
|
|
||||||
|
if (!decoder->eos_reached) {
|
||||||
|
// we get the available slots in decoder
|
||||||
|
- ret = decoder->mpi->control(decoder->ctx, MPP_DEC_GET_FREE_PACKET_SLOT_COUNT, &freeslots);
|
||||||
|
+ ret = decoder->mpi->control(decoder->ctx, MPP_DEC_GET_STREAM_COUNT, &usedslots);
|
||||||
|
if (ret != MPP_OK) {
|
||||||
|
- av_log(avctx, AV_LOG_ERROR, "Failed to get decoder free slots (code = %d).\n", ret);
|
||||||
|
+ av_log(avctx, AV_LOG_ERROR, "Failed to get decoder used slots (code = %d).\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ freeslots = INPUT_MAX_PACKETS - usedslots;
|
||||||
|
if (freeslots > 0) {
|
||||||
|
ret = ff_decode_get_packet(avctx, &pkt);
|
||||||
|
if (ret < 0 && ret != AVERROR_EOF) {
|
||||||
|
@@ -541,7 +543,7 @@ static int rkmpp_receive_frame(AVCodecContext *avctx, AVFrame *frame)
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure we keep decoder full
|
||||||
|
- if (freeslots > 1 && decoder->first_frame)
|
||||||
|
+ if (freeslots > 1)
|
||||||
|
return AVERROR(EAGAIN);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
From: LongChair <longchair@hotmail.com>
|
||||||
|
Date: Tue, 2 Jan 2018 11:38:01 +0000 (+0100)
|
||||||
|
Subject: avcodec/rkmpp : remove stream start retries before first frame.
|
||||||
|
X-Git-Url: http://git.videolan.org/?p=ffmpeg.git;a=commitdiff_plain;h=2ca65fc7b74444edd51d5803a2c1e05a801a6023
|
||||||
|
|
||||||
|
avcodec/rkmpp : remove stream start retries before first frame.
|
||||||
|
|
||||||
|
those were needed because of some odd mpp behavior that seems to have
|
||||||
|
been fixed.
|
||||||
|
|
||||||
|
Makes the code cleaner.
|
||||||
|
|
||||||
|
Signed-off-by: wm4 <nfxjfg@googlemail.com>
|
||||||
|
---
|
||||||
|
|
||||||
|
diff --git a/libavcodec/rkmppdec.c b/libavcodec/rkmppdec.c
|
||||||
|
index 946b827918..143d05bd51 100644
|
||||||
|
--- a/libavcodec/rkmppdec.c
|
||||||
|
+++ b/libavcodec/rkmppdec.c
|
||||||
|
@@ -47,7 +47,6 @@ typedef struct {
|
||||||
|
MppApi *mpi;
|
||||||
|
MppBufferGroup frame_group;
|
||||||
|
|
||||||
|
- char first_frame;
|
||||||
|
char first_packet;
|
||||||
|
char eos_reached;
|
||||||
|
|
||||||
|
@@ -329,28 +328,14 @@ static int rkmpp_retrieve_frame(AVCodecContext *avctx, AVFrame *frame)
|
||||||
|
MppBuffer buffer = NULL;
|
||||||
|
AVDRMFrameDescriptor *desc = NULL;
|
||||||
|
AVDRMLayerDescriptor *layer = NULL;
|
||||||
|
- int retrycount = 0;
|
||||||
|
int mode;
|
||||||
|
MppFrameFormat mppformat;
|
||||||
|
uint32_t drmformat;
|
||||||
|
|
||||||
|
- // on start of decoding, MPP can return -1, which is supposed to be expected
|
||||||
|
- // this is due to some internal MPP init which is not completed, that will
|
||||||
|
- // only happen in the first few frames queries, but should not be interpreted
|
||||||
|
- // as an error, Therefore we need to retry a couple times when we get -1
|
||||||
|
- // in order to let it time to complete it's init, then we sleep a bit between retries.
|
||||||
|
-retry_get_frame:
|
||||||
|
ret = decoder->mpi->decode_get_frame(decoder->ctx, &mppframe);
|
||||||
|
- if (ret != MPP_OK && ret != MPP_ERR_TIMEOUT && !decoder->first_frame) {
|
||||||
|
- if (retrycount < 5) {
|
||||||
|
- av_log(avctx, AV_LOG_DEBUG, "Failed to get a frame, retrying (code = %d, retrycount = %d)\n", ret, retrycount);
|
||||||
|
- usleep(10000);
|
||||||
|
- retrycount++;
|
||||||
|
- goto retry_get_frame;
|
||||||
|
- } else {
|
||||||
|
- av_log(avctx, AV_LOG_ERROR, "Failed to get a frame from MPP (code = %d)\n", ret);
|
||||||
|
- goto fail;
|
||||||
|
- }
|
||||||
|
+ if (ret != MPP_OK && ret != MPP_ERR_TIMEOUT) {
|
||||||
|
+ av_log(avctx, AV_LOG_ERROR, "Failed to get a frame from MPP (code = %d)\n", ret);
|
||||||
|
+ goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mppframe) {
|
||||||
|
@@ -366,7 +351,6 @@ retry_get_frame:
|
||||||
|
avctx->height = mpp_frame_get_height(mppframe);
|
||||||
|
|
||||||
|
decoder->mpi->control(decoder->ctx, MPP_DEC_SET_INFO_CHANGE_READY, NULL);
|
||||||
|
- decoder->first_frame = 1;
|
||||||
|
|
||||||
|
av_buffer_unref(&decoder->frames_ref);
|
||||||
|
|
||||||
|
@@ -480,7 +464,6 @@ retry_get_frame:
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
- decoder->first_frame = 0;
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "Failed to retrieve the frame buffer, frame is dropped (code = %d)\n", ret);
|
||||||
|
@@ -560,7 +543,6 @@ static void rkmpp_flush(AVCodecContext *avctx)
|
||||||
|
|
||||||
|
ret = decoder->mpi->reset(decoder->ctx);
|
||||||
|
if (ret == MPP_OK) {
|
||||||
|
- decoder->first_frame = 1;
|
||||||
|
decoder->first_packet = 1;
|
||||||
|
} else
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "Failed to reset MPI (code = %d)\n", ret);
|
||||||
Reference in New Issue
Block a user