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 0E8CE40E84 for ; Mon, 11 Apr 2022 06:44:31 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 686FB68B37A; Mon, 11 Apr 2022 09:44:28 +0300 (EEST) Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E010B68B226 for ; Mon, 11 Apr 2022 09:44:21 +0300 (EEST) Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-2ebf4b91212so55742907b3.8 for ; Sun, 10 Apr 2022 23:44:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=mtMVfsg8opyQlr7fJhfZrNKb16FmfwuSEmNYgpHeKJU=; b=kGgtDTHJHgNoKJZjbn/mq4lZyUNvrMiznllICYiJfrc1z1Rnotv/O6Z00oMjaOSdw1 53Al95gk+VZ1+eC462ij2by+nED0R8iMvDENgYXnR7HRAnKGfPaQ07zqvapjnO0lN0ct BFAm2x5yjnQ2UV0o70VPpGlloQ7oRUn4HzODgHAhhX1IGCfon9O94Jfue1zrXzCXsBzN mO/Meb1BB1Rs1Yk0Pd1C6vwNwLe21mHks1VeDtV+EoEUyT2nULNJiDEYLfPx88hMZLuT 3f1CINGaC3wBEr39RtKOEpoA6guqsS2qYWuhvaWmXL1N/cg9PpuotJNspcxsAVVp8+1h xucg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=mtMVfsg8opyQlr7fJhfZrNKb16FmfwuSEmNYgpHeKJU=; b=jmwCD1IbB/nyHfouLt/TSr/tU0qasThMqkR04rkREO+3sCGvpckREtb71SoahR0QVP siMMSUfghlMMUwov+G84Sp5z7g7NoAyJcLEmzFnc4VHSci7ROSQ24t1MjifL+oz/Wqe9 t0nI2bYBtSsGrLia27mUlYVnpXMbBxNbszhi+3dSP8SWoPdXr1dUoEKks0la+S4MbDZN NeOMz3avr+9EHKrdYDPwEIKlLr+08rsZATZ6PVqfVqXsjrXbHoWiTibJO/1w3R6CTTkH Mbrg9kthK6euaM2jJJraz+ATJv858YU4O1aADWSPx6wLk/v+jgm3Zc678HSQvov2ffv1 gUXA== X-Gm-Message-State: AOAM530+3Sk4eSO7axArcg274vvs3UHDFu5H24NHz/Y+65FGufYWWBJH X5acjLHsQLlEl8XlVRj0Q6BY9NIkET7nHqTImM/8HT6c X-Google-Smtp-Source: ABdhPJzzhvqnM6M46WFMX4Fg4tJDMVlugPjutv2NJRIK2bJyZbrNJKv/ZvsOYb32DViBllop0zo/ghKf1Sv/WhDSNrM= X-Received: by 2002:a81:78c9:0:b0:2eb:469b:e788 with SMTP id t192-20020a8178c9000000b002eb469be788mr23863197ywc.34.1649659460416; Sun, 10 Apr 2022 23:44:20 -0700 (PDT) MIME-Version: 1.0 References: <8fd28808-07f8-9458-b032-8792c67a38fd@gmail.com> In-Reply-To: <8fd28808-07f8-9458-b032-8792c67a38fd@gmail.com> From: Paul B Mahol Date: Mon, 11 Apr 2022 08:46:36 +0200 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH v2 1/2] doc/examples/transcode_aac: Don't ignore last encoded frame 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-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: On Tue, Mar 22, 2022 at 6:47 PM Andreas Unterweger wrote: > The last encoded frame is now fetched on EOF. It was previously left in > the encoder and caused a "1 frame left in queue" warning. > > Signed-off-by: Andreas Unterweger > --- > doc/examples/transcode_aac.c | 22 +++++++++++----------- > 1 file changed, 11 insertions(+), 11 deletions(-) > > diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c > index 9102e55f16..c9b93f6439 100644 > --- a/doc/examples/transcode_aac.c > +++ b/doc/examples/transcode_aac.c > @@ -377,6 +377,8 @@ static int decode_audio_frame(AVFrame *frame, > if (error < 0) > return error; > > + *data_present = 0; > + *finished = 0; > /* Read one audio frame from the input file into a temporary packet. > */ > if ((error = av_read_frame(input_format_context, input_packet)) < 0) > { > /* If we are at the end of the file, flush the decoder below. */ > @@ -555,7 +557,7 @@ static int read_decode_convert_and_store(AVAudioFifo > *fifo, > AVFrame *input_frame = NULL; > /* Temporary storage for the converted input samples. */ > uint8_t **converted_input_samples = NULL; > - int data_present = 0; > + int data_present; > int ret = AVERROR_EXIT; > > /* Initialize temporary storage for one input frame. */ > @@ -675,18 +677,17 @@ static int encode_audio_frame(AVFrame *frame, > frame->pts = pts; > pts += frame->nb_samples; > } > - > + > + *data_present = 0; > /* Send the audio frame stored in the temporary packet to the > encoder. > * The output audio stream encoder is used to do this. */ > error = avcodec_send_frame(output_codec_context, frame); > - /* The encoder signals that it has nothing more to encode. */ > - if (error == AVERROR_EOF) { > - error = 0; > - goto cleanup; > - } else if (error < 0) { > - fprintf(stderr, "Could not send packet for encoding (error > '%s')\n", > - av_err2str(error)); > - goto cleanup; > + /* Check for errors, but proceed with fetching encoded samples if the > + * encoder signals that it has nothing more to encode. */ > + if (error < 0 && error != AVERROR_EOF) { > + fprintf(stderr, "Could not send packet for encoding (error '%s')\n", > + av_err2str(error)); > + goto cleanup; > } > > /* Receive one encoded frame from the encoder. */ > @@ -857,7 +858,6 @@ int main(int argc, char **argv) > int data_written; > /* Flush the encoder as it may have delayed frames. */ > do { > - data_written = 0; > if (encode_audio_frame(NULL, output_format_context, > output_codec_context, > &data_written)) > goto cleanup; > -- > 2.30.2 > > LGTM. can someone apply this? > _______________________________________________ > 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". > _______________________________________________ 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".