Commit c6f84106 authored by LongChair's avatar LongChair Committed by wm4

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: 's avatarwm4 <nfxjfg@googlemail.com>
parent 01735b48
...@@ -5993,10 +5993,8 @@ enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OP ...@@ -5993,10 +5993,8 @@ enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OP
check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 || 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 || check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
die "ERROR: openssl not found"; } die "ERROR: openssl not found"; }
enabled rkmpp && { { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create || enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create &&
die "ERROR : Rockchip MPP was not found."; } && require_pkg_config rockchip_mpp "rockchip_mpp >= 1.3.7" rockchip/rk_mpi.h mpp_create &&
{ 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 libdrm || { enabled libdrm ||
die "ERROR: rkmpp requires --enable-libdrm"; } die "ERROR: rkmpp requires --enable-libdrm"; }
} }
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#define RECEIVE_FRAME_TIMEOUT 100 #define RECEIVE_FRAME_TIMEOUT 100
#define FRAMEGROUP_MAX_FRAMES 16 #define FRAMEGROUP_MAX_FRAMES 16
#define INPUT_MAX_PACKETS 4
typedef struct { typedef struct {
MppCtx ctx; MppCtx ctx;
...@@ -515,16 +516,17 @@ static int rkmpp_receive_frame(AVCodecContext *avctx, AVFrame *frame) ...@@ -515,16 +516,17 @@ static int rkmpp_receive_frame(AVCodecContext *avctx, AVFrame *frame)
RKMPPDecoder *decoder = (RKMPPDecoder *)rk_context->decoder_ref->data; RKMPPDecoder *decoder = (RKMPPDecoder *)rk_context->decoder_ref->data;
int ret = MPP_NOK; int ret = MPP_NOK;
AVPacket pkt = {0}; AVPacket pkt = {0};
RK_S32 freeslots; RK_S32 usedslots, freeslots;
if (!decoder->eos_reached) { if (!decoder->eos_reached) {
// we get the available slots in decoder // 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) { 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; return ret;
} }
freeslots = INPUT_MAX_PACKETS - usedslots;
if (freeslots > 0) { if (freeslots > 0) {
ret = ff_decode_get_packet(avctx, &pkt); ret = ff_decode_get_packet(avctx, &pkt);
if (ret < 0 && ret != AVERROR_EOF) { if (ret < 0 && ret != AVERROR_EOF) {
...@@ -541,7 +543,7 @@ static int rkmpp_receive_frame(AVCodecContext *avctx, AVFrame *frame) ...@@ -541,7 +543,7 @@ static int rkmpp_receive_frame(AVCodecContext *avctx, AVFrame *frame)
} }
// make sure we keep decoder full // make sure we keep decoder full
if (freeslots > 1 && decoder->first_frame) if (freeslots > 1)
return AVERROR(EAGAIN); return AVERROR(EAGAIN);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment