fixup! lavc/rkmppdec: refactor RKMPP decoders and extend codecs

EOS frame may contain valid data. Check frame buf to determine it.

```
[hevc_rkmpp @ 0xaaab1462eb20] Received a 'EOS' frame
[hevc_rkmpp @ 0xaaab1462eb20] Received a frame
[hevc_rkmpp @ 0xaaab1462eb20] Received a 'EOS' frame
[hevc_rkmpp @ 0xaaab1462eb20] Decoder is at EOF
[vist#0:0/hevc @ 0xaaab1463e380] Decoder returned EOF, finishing
[vist#0:0/hevc @ 0xaaab1463e380] Terminating decoder thread
```

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
This commit is contained in:
nyanmisaka 2024-02-05 00:31:57 +08:00
parent 28b4194646
commit 6b13265d70
2 changed files with 6 additions and 6 deletions

View file

@ -665,9 +665,12 @@ static int rkmpp_get_frame(AVCodecContext *avctx, AVFrame *frame, int timeout)
}
if (mpp_frame_get_eos(mpp_frame)) {
av_log(avctx, AV_LOG_DEBUG, "Received a 'EOS' frame\n");
r->eof = 1;
ret = AVERROR_EOF;
goto exit;
/* EOS frame may contain valid data */
if (!mpp_frame_get_buffer(mpp_frame)) {
r->eof = 1;
ret = AVERROR_EOF;
goto exit;
}
}
if (mpp_frame_get_discard(mpp_frame)) {
av_log(avctx, AV_LOG_DEBUG, "Received a 'discard' frame\n");
@ -929,7 +932,6 @@ static void rkmpp_decode_flush(AVCodecContext *avctx)
r->queue_size = 0;
av_packet_unref(&r->last_pkt);
av_frame_unref(&r->last_frame);
} else
av_log(avctx, AV_LOG_ERROR, "Failed to reset MPP context: %d\n", ret);
}

View file

@ -54,8 +54,6 @@ typedef struct RKMPPDecContext {
AVBufferRef *hwframe;
AVPacket last_pkt;
AVFrame last_frame;
int eof;
int info_change;
int errinfo_cnt;