aboutsummaryrefslogtreecommitdiffstats
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-02 21:40:07 +0200
commit6614f33a0b3862753f743253afdb8e1944e26167 (patch)
tree8c4cb8712a9560522584f3ef639dfd1aabc32633
parent67e401e3cb0bf8d3a6f13828d9905be75cf969fd (diff)
downloadffmpeg-6614f33a0b3862753f743253afdb8e1944e26167.tar.gz
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> (cherry picked from commit d5fc16a6a87a24360312b812a560e7a3664e3791)
-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 {