From 373eb170f1428a011552e6cc72d404aba2b9d8b5 Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Mon, 8 Feb 2021 16:31:58 +0100 Subject: [PATCH] gif2webp: don't store loop-count if there's only 1 frame BUG=webp:504 Change-Id: Iacea11a861096ae950379c872d9840bdbec42a21 --- examples/gif2webp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/gif2webp.c b/examples/gif2webp.c index a9f5936c..78d84c62 100644 --- a/examples/gif2webp.c +++ b/examples/gif2webp.c @@ -465,8 +465,10 @@ int main(int argc, const char* argv[]) { fprintf(stderr, "%s\n", WebPAnimEncoderGetError(enc)); goto End; } - - if (!loop_compatibility) { + // If there's only one frame, we don't need to handle loop count. + if (frame_number == 1) { + loop_count = 0; + } else if (!loop_compatibility) { if (!stored_loop_count) { // if no loop-count element is seen, the default is '1' (loop-once) // and we need to signal it explicitly in WebP. Note however that