[MPlayer-dev-eng] [PATCH] vd_ffmpeg: support receiving multiple frames in a row.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Jan 18 00:59:45 EET 2021


---
 libmpcodecs/vd_ffmpeg.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index 51fe6b1c9..3822cc27b 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -925,9 +925,12 @@ static mp_image_t *decode(sh_video_t *sh, void *data, int len, int flags){
         }
         ctx->palette_sent = 1;
     }
+    if (sh->ds->buffer_pos < len)
+        mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Bad stream state, please report as bug!\n");
     ret = avcodec_send_packet(avctx, !pkt.data && !pkt.size ? NULL : &pkt);
     if (ret == AVERROR(EAGAIN)) {
-        mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Too many frames buffered in decode, MPlayer cannot handle that yet!\n");
+        assert(sh->ds->buffer_pos >= len);
+        sh->ds->buffer_pos -= len;
         ret = 0;
     }
     if (ret >= 0 || ret == AVERROR_EOF) {
--
2.30.0



More information about the MPlayer-dev-eng mailing list