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 BDCCE422C5 for ; Wed, 2 Mar 2022 11:53:59 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A813C68B29A; Wed, 2 Mar 2022 13:53:56 +0200 (EET) Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A1F2268B262 for ; Wed, 2 Mar 2022 13:53:50 +0200 (EET) Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-2d07ae0b1c0so14343127b3.2 for ; Wed, 02 Mar 2022 03:53:50 -0800 (PST) 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=r3cnXlNXpDnrvyjRAvkz0t87CJu3ahad9gGvS3EQqxk=; b=ipeY1l+4I1B4BRbZXpa4iXANCn+ZOc0ab3v9bnTdFwKa8WVPulzur1CDxWf56u3Uf6 NCNbU692xHRWrjsAyc1pTvsIkhkGgS92fyKye9qrA9wHi8pyBRU/vy8larGcBtYV40i3 KK0ZnPhPVC3HVS4mdDZ1IgVd34RnwdQagy4QpTJe9gjsafHKo36FWGpMLkbfqiA9I7WZ TXI5g7iSYWE4URlcSgIfhzsA1pAHyxnUV6vLlusqVjDpSyH84OPLtCRdDfZ0He0xjHAK uu54ZSTJb7qfjoUeQMUz2ZaJCrKeiXY+69V3zjPyckj2T/jV00tZfJZc9+EhaZR/lLht fpHw== 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=r3cnXlNXpDnrvyjRAvkz0t87CJu3ahad9gGvS3EQqxk=; b=Z5Q/jMgVw0HWvXFNWyD+geYfL1Wqc269HDfiYi2TGTketrCoF3uDiI0XuCwAyyDM5p EnuPkkdqVcwqgDMJ4zZWykGIVzlqlSXx74F7wZ1uoPHC2tg6agh41DlwDngJ/UgLHNi0 Hp8BBRyEljkpW36gTLlKi2rbzzt6riM1JZPXeItpB84VAAmOzvG8ux7DGupFfjSVQAWt c7NTf4W4ytzPsviF2oLNejdyKIjsWQ6k+2x7QZmupXoV0ATtqT+pJ5evefwFdIPK0R8S 0brAVpwzzSwZLNHqoT28egH+70LFOE04jP6z/Idnt+Ehm63c/eRF1MGABECqrik5c5cg BC9A== X-Gm-Message-State: AOAM533HQg7CPL3dI7JBGuybxpDCwGVCvZbaF7Nw8w2Kg9HIalkFC4t3 PjwPyifbK/srVBuxufBi7GcVEgWNt5RVUZwsXV06GNWWPCs= X-Google-Smtp-Source: ABdhPJx/oiNRl6BQm8sTt7fYCTj1klWtgTCfniB+RuXhOE/boBAFcZbSAAWm/VhpROWNDC5dEjGmTyMV0TASIaj8EJo= X-Received: by 2002:a0d:ddd6:0:b0:2d6:8c55:7ba0 with SMTP id g205-20020a0dddd6000000b002d68c557ba0mr29224402ywe.177.1646222029306; Wed, 02 Mar 2022 03:53:49 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Paul B Mahol Date: Wed, 2 Mar 2022 12:55:28 +0100 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH 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 Wed, Mar 2, 2022 at 8:22 AM Andreas Unterweger wrote: > > On 23.02.2022 15:58 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 1cf6317e27..a09690fe45 100644 > > --- a/doc/examples/transcode_aac.c > > +++ b/doc/examples/transcode_aac.c > > @@ -381,6 +381,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. > */ > > @@ -559,7 +561,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. */ > > @@ -679,18 +681,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. */ > > @@ -861,7 +862,6 @@ int main(int argc, char **argv) > > int data_written; > > /* Flush the encoder as it may have delayed frames. */ > > do { > > - data_written = 0; > why this is removed ? > > if (encode_audio_frame(NULL, output_format_context, > > output_codec_context, > &data_written)) > > goto cleanup; > > -- > > 2.30.2 > > > > Ping > _______________________________________________ > 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".