From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 6FC0C49A78 for ; Thu, 28 Mar 2024 00:57:22 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 58A4268D5E2; Thu, 28 Mar 2024 02:57:09 +0200 (EET) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4F9BD68D5B2 for ; Thu, 28 Mar 2024 02:57:01 +0200 (EET) Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-33eee0258abso206789f8f.3 for ; Wed, 27 Mar 2024 17:57:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711587420; x=1712192220; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vUeK4CPPgx4JDAqgbNCuj8pE/OryhU17eSH+uTFfXwc=; b=UNnGSUOtTPWFmsWyrIu1388olglxJ9l0jjAvcv/ORgNq9yLpaWshuSbC9VbGjzLBmS lYQS8TtGskBcNwLRI7yyo0RcdMzbgS+tvGeQKbcAypgl9Y9O/GqLolBS/L6W4XPwC3GZ LNr+84I9DNMH8gaf3qA2CQ3EaJtmI//nY3qzPTfKA3/jkWB58bzB1Tc2dfyhCBzIkcAb fVyXv+Uc2SgOWjzFqUjgkNuOiNWINyU/51V0ZkbURtPScfgUYWDbdtdMw2ivWGa6LnGP zda1af4ffa+geYC/A+JFD8vJH18jBuZNbABS0ADW7opzQNHu69p+0YQQbvmVaB4BGg9p Kx8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711587420; x=1712192220; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vUeK4CPPgx4JDAqgbNCuj8pE/OryhU17eSH+uTFfXwc=; b=BpvQizF3UnrSRukSiSEuDjkrLNu8lUD9E1ULeyzYsI3jWoL4zAvZHO+QVHK/qDm8U0 JTjWmGjqXHXPZTwpBSdY4d/45Z54zjn//Em6zdLxOwysYJQOXJOohI625F1c6yqANJ2q Y4hvpfiXQKe4IbnbvtkPjIUfHlwKgCoLACLE6VywiFmER+casaZ78oqfkYEY/+g3LYFj D5l0w8Ix2HMNkizQ04pZzJGHd/c77Ci8YB9sjlhS9Vfm7t+kAkxjCiqrVt+hTplwAeXj qivquzDduhjP4TzuQAApgfgHsGSlKxE3ypY9h7AEwRgF/BiSwyovv/C82Pb5aFRtxFbM Xb3g== X-Gm-Message-State: AOJu0Yxhk2cXYUJhc1nAQXvtYLHcfmWyBhnMznM2b97wnqWECqf8cSLO ZTbHE7qFefFjvA0HRk2jI2/p5RyTlLqQrtywy3AMbVHWWCtIEUvCSCx3L0NK X-Google-Smtp-Source: AGHT+IGZbPabWrTt6omh8+IrQW5K0tRv6hf/R0VTIJtxu6lVMbdkOP9oQQNR5BNgDGPwDNgAuDAs6Q== X-Received: by 2002:a05:6000:ac3:b0:33e:c4c3:6f with SMTP id di3-20020a0560000ac300b0033ec4c3006fmr1071584wrb.64.1711587420606; Wed, 27 Mar 2024 17:57:00 -0700 (PDT) Received: from localhost.localdomain (dynamic-078-055-195-187.78.55.pool.telefonica.de. [78.55.195.187]) by smtp.gmail.com with ESMTPSA id m28-20020a056000181c00b00341d186a2dbsm325529wrh.14.2024.03.27.17.56.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 17:57:00 -0700 (PDT) From: arch1t3cht To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 Mar 2024 02:56:38 +0100 Message-ID: <20240328015639.1425494-3-arch1t3cht@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240328015639.1425494-1-arch1t3cht@gmail.com> References: <20240328015639.1425494-1-arch1t3cht@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] avcodec/h264dec: Handle non-recovered frames when draining X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: arch1t3cht Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: When starting on a SEI recovery point close enough to the end of the stream that draining starts before the recovery point's frame is output, there can be non-recovered frames in the delayed picture buffer that would currently cause the decoder to fail to output a frame. This commit skips such frames and outputs the first recovered frame, if there exists one. Signed-off-by: arch1t3cht --- libavcodec/h264dec.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index 8503ea018a..68f47912e2 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -993,11 +993,13 @@ static int send_next_delayed_frame(H264Context *h, AVFrame *dst_frame, int *got_frame, int buf_index) { int ret, i, out_idx; - H264Picture *out = h->delayed_pic[0]; + H264Picture *out; h->cur_pic_ptr = NULL; h->first_field = 0; + while (h->delayed_pic[0]) { + out = h->delayed_pic[0]; out_idx = 0; for (i = 1; h->delayed_pic[i] && @@ -1020,6 +1022,9 @@ static int send_next_delayed_frame(H264Context *h, AVFrame *dst_frame, ret = finalize_frame(h, dst_frame, out, got_frame); if (ret < 0) return ret; + if (*got_frame) + break; + } } return buf_index; -- 2.44.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".