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 8CB4D422AD for ; Wed, 2 Mar 2022 07:21:51 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5277D68B1D0; Wed, 2 Mar 2022 09:21:49 +0200 (EET) Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8BC2E68A54D for ; Wed, 2 Mar 2022 09:21:42 +0200 (EET) Received: by mail-lf1-f44.google.com with SMTP id j7so1207816lfu.6 for ; Tue, 01 Mar 2022 23:21:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=Wocscil4mIPiTCpxpdESS3UFwqHC2LZJZAVRLFofyGc=; b=M9j+D81B5GTWIm/kAxf+0ealyfNZNnsGm5HsL2m36D3TlF8jzdmjekDQIIAxClY0VM 1F5JASeS0/xhJJrxUsp/zgqFaLYw96WM4h9K1vGBP3Pv8nc7E0azYOlKrb9mKBTgGBvt ktNpTlQnpoIrkTEN7+IDB6qoi1S4ptDBseE/0UZTZ/CmWSl64oi5AXQxnMaJWKJk5Inh 98V5Wh8quY+Jh+p51NuIj8s6/usYNs5Apf3MEYHShUX7+ENyIQGek2fzXYCV35h5vnDe 7pJRYpxyYWEKN5Rj/4Sd2qwAXJ0fDzcXVLzzo+vDBRG1VS3hxGGmL6SbqgPTreOisAhI qRaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Wocscil4mIPiTCpxpdESS3UFwqHC2LZJZAVRLFofyGc=; b=pxPey+NzNSrWV7wx8sca6/w3s0tVsyyj4ZrtjuIgXVRf7CDAI4GWwK/TmcCwOC2Q21 PG4Ju+makt8b9PgFb3mgixiIMJIQsugWnr7qJw//PNCLDcpIC28aDHSLoup2ap7ARY3p v6OAWec8ig6o0RVuHgvDDaTnKv08v8wcgSdxFxV8gsSb0O2iGaYdESd0chM+71plYb8C XorgDdLCMfj7mekXrpNC2dJandfwqziWc3BKvs70ZgYnkAAJUDdB5OFCHdLFOYgjrh9Z CpUSiMdDUrxmnV3kRd0K4SO9LTjdYLiNh8IsQPBZOBZaqsInICK7g1YhTEhilLznS38q lscA== X-Gm-Message-State: AOAM532Su4pjQBzD0NuTTUFNMA9Tton31/psXlu7wkU61jJDZuNc9GW4 1km5Hi4K7lL3cOWm0hfRPVZQizzSGBXCuzSQv+iBHLYTHRU= X-Google-Smtp-Source: ABdhPJwp39mRljLVGqVo4woIDTV+0rg28/VnCCQaGRS4S6FUgwZUUTzAO8QeeblXObnpuFl07PW1uXc3XfAP4qrMMsY= X-Received: by 2002:a05:6512:1398:b0:445:bcef:e4fd with SMTP id p24-20020a056512139800b00445bcefe4fdmr825503lfa.398.1646205701749; Tue, 01 Mar 2022 23:21:41 -0800 (PST) MIME-Version: 1.0 From: Andreas Unterweger Date: Wed, 2 Mar 2022 08:21:31 +0100 Message-ID: To: FFmpeg development discussions and patches 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 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; > 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".