summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-03-26 12:42:21 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-04-01 14:15:52 +0200
commitd5fc16a6a87a24360312b812a560e7a3664e3791 (patch)
tree6c6fa53c3d75454a1527c36999baed97a98c2b69
parent64977ed7ae1e437910ca837ccb282e07d9200249 (diff)
avcodec/qtrleenc: Use keyframe when no previous frame is available
If keeping a reference to an earlier frame failed, the next frame must be an I frame for lack of reference frame. This commit implements this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r--libavcodec/qtrleenc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/qtrleenc.c b/libavcodec/qtrleenc.c
index 8b0edf7b3d..0f5bedcdcd 100644
--- a/libavcodec/qtrleenc.c
+++ b/libavcodec/qtrleenc.c
@@ -369,7 +369,8 @@ static int qtrle_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
if ((ret = ff_alloc_packet2(avctx, pkt, s->max_buf_size, 0)) < 0)
return ret;
- if (avctx->gop_size == 0 || (s->avctx->frame_number % avctx->gop_size) == 0) {
+ if (avctx->gop_size == 0 || !s->previous_frame->data[0] ||
+ (s->avctx->frame_number % avctx->gop_size) == 0) {
/* I-Frame */
s->key_frame = 1;
} else {