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 E7CB0410E3 for ; Mon, 12 Dec 2022 11:37:47 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A94F468BCCD; Mon, 12 Dec 2022 13:37:44 +0200 (EET) Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 045CB689AFC for ; Mon, 12 Dec 2022 13:37:37 +0200 (EET) Received: by mail-oi1-f175.google.com with SMTP id r11so10898502oie.13 for ; Mon, 12 Dec 2022 03:37:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=h25ifEeK3IxgXZ+qLZWfIgdMH97l2GM1kWvzyZ3MvJM=; b=hqEefrvS86d9Op5Aweq1NjN21nygvVSH/5X0eQQfmJdvu0LNfnpK+YbxnhMQzI6vJW 2sncHCqz2RGA9aREg1D9oLeFUceuffjK64sMq575jNFgDS6A1RIbndBEkObD7n2OwcAT TZ1+OfECL1oeo1Tly141Dg3MrOvNi1mK3b4m88Um8+yM2DrUJVBN84lJxxvhhRhcV1vS 4b4ncHVB5tQFInJiPD9JKBi6AGoCwfWrBNHXvXI7qyj8qwFXipLyctCk1QGEXXSIxYYD pX2PKbOyKl2aRB0YeAlCJoeLLjsvRg9DBgM09fnEKlvMclWLcdptVskYrEige2JnokIT 9TSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=h25ifEeK3IxgXZ+qLZWfIgdMH97l2GM1kWvzyZ3MvJM=; b=zGpgCmXC28wremRDXi62jneyEI9NxM9YqNCLcR/49DiXRu4Vro8UEQqUpSlsYoYjX9 iG1FVg2SIPWuat4okiKniEJ2RNbyRnQB3iRljv+sOmqOx3MGr+WWqrOgpTCFqg4APukF q/H5R0Ymb/H/bvDRaVF66gBwxS9wzIin63MhIKCtFOF6pujq4EVpNxxL5iYK/n6teQfO u/V3FyYHLwUdIDVKlWNNSmIRaJ2URSPrOveb6okAU8jyoSluUtAEdOcuRJauba2JN6XQ SJbCJ7Dmx2I/nVqRiwUInnbOEuLfxu4NJ1x2sgl0xQakdTxEZW65NOhKr4DmSBDwhVWr RBfA== X-Gm-Message-State: ANoB5pmJk2iL/fKuO73L5a8qv0JF7h/Xs1c+iE/xJ4I82uYvPpejTTDV fsAq8fDL45wNILbNdPOSOGexlRC1YFI= X-Google-Smtp-Source: AA0mqf7YJfhVyLZoEBUv8yajXJ2ZQCPUEIRxQxFP0BX7pqMqOgyiKnIu/W8CILpw79UbNmrJ/GOWlg== X-Received: by 2002:a05:6808:1705:b0:35a:7043:ee4d with SMTP id bc5-20020a056808170500b0035a7043ee4dmr8942284oib.0.1670845055924; Mon, 12 Dec 2022 03:37:35 -0800 (PST) Received: from [192.168.0.11] (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id v15-20020a9d4e8f000000b00660fe564e12sm3895743otk.58.2022.12.12.03.37.34 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Dec 2022 03:37:35 -0800 (PST) Message-ID: <6f941db6-4538-a65c-26a9-2e3a1baec9e1@gmail.com> Date: Mon, 12 Dec 2022 08:37:45 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Content-Language: en-US From: James Almer To: ffmpeg-devel@ffmpeg.org References: <20221204215227.4186-1-jamrial@gmail.com> <20221204215227.4186-5-jamrial@gmail.com> In-Reply-To: <20221204215227.4186-5-jamrial@gmail.com> Subject: Re: [FFmpeg-devel] [PATCH 5/5] avcodec/mpeg4videodec: duplicate the last decoded frame when the last coded frame was skipped 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 12/4/2022 6:52 PM, James Almer wrote: > This ensures the video stream duration is not lost after decoding. > > Signed-off-by: James Almer > --- > libavcodec/h263dec.c | 13 +++++++++++++ > libavcodec/mpegvideo.h | 1 + > 2 files changed, 14 insertions(+) > > diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c > index ac7a8521e5..0a2d7487a8 100644 > --- a/libavcodec/h263dec.c > +++ b/libavcodec/h263dec.c > @@ -430,6 +430,18 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict, > return ret; > s->next_picture_ptr = NULL; > > + *got_frame = 1; > + } else if (s->skipped_last_frame && s->current_picture_ptr) { > + /* Output the last picture we decoded again if the stream ended with > + * an NVOP */ > + if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0) > + return ret; > + /* Copy props from the last input packet. Otherwise, props from the last > + * returned picture would be reused */ > + if ((ret = ff_decode_frame_props(avctx, pict)) < 0) > + return ret; > + s->current_picture_ptr = NULL; > + > *got_frame = 1; > } > > @@ -500,6 +512,7 @@ retry: > s->extradata_parsed = 1; > } > ret = ff_mpeg4_decode_picture_header(avctx->priv_data, &s->gb, 0, 0); > + s->skipped_last_frame = (ret == FRAME_SKIPPED); > } else if (CONFIG_H263I_DECODER && s->codec_id == AV_CODEC_ID_H263I) { > ret = ff_intel_h263_decode_picture_header(s); > } else if (CONFIG_FLV_DECODER && s->h263_flv) { > diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h > index 6440b906b1..42275953b9 100644 > --- a/libavcodec/mpegvideo.h > +++ b/libavcodec/mpegvideo.h > @@ -175,6 +175,7 @@ typedef struct MpegEncContext { > Picture *last_picture_ptr; ///< pointer to the previous picture. > Picture *next_picture_ptr; ///< pointer to the next picture (for bidir pred) > Picture *current_picture_ptr; ///< pointer to the current picture > + int skipped_last_frame; > int last_dc[3]; ///< last DC values for MPEG-1 > int16_t *dc_val_base; > int16_t *dc_val[3]; ///< used for MPEG-4 DC prediction, all 3 arrays must be continuous Will apply. _______________________________________________ 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".