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 A79D242609 for ; Sun, 24 Apr 2022 12:36:49 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5849868B177; Sun, 24 Apr 2022 15:36:48 +0300 (EEST) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A721868AD9E for ; Sun, 24 Apr 2022 15:36:42 +0300 (EEST) Received: by mail-wm1-f44.google.com with SMTP id m15-20020a7bca4f000000b0038fdc1394b1so10891520wml.2 for ; Sun, 24 Apr 2022 05:36:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=1OGz45kRIZgErWQwlNLERFBYSFKrXTyHvBQ++uQxQLU=; b=U7/SIEPKtg6zEHWVO148PcTB5bz9fTDccQyNIbOxNbLNKQqyjNvr5kO+RHhOKr2ot2 CohKaPL7hJRUX54iJD/xaANWgJl6g9y8nxV1WFdPZQAwV4bdOKWCWxPzy45SSjT5DSOq ahId4FB5qoSfQ6TihMvhyhehTRFCGpghaNhM8WPQOXc2yobXpuPqjn4jjZbfn6nLcnR6 gbSnRDI1AOCoOlYC8apfpLDA+If2An/QCj+ScDM+ZFdV5JUWuLxdljIzGVG/dalDZm6b nl0xID7k9cQWCKY7o9SD/ybyFFzIsvqIatfcFhuEWeR9w7v+2Hng+DtXi5+mB4enBOCc yN4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=1OGz45kRIZgErWQwlNLERFBYSFKrXTyHvBQ++uQxQLU=; b=z4icdaUYlPlN7CczXFUnspDLEotsKAxJQaxlah0bOoQKg18nx2W8laPHx/GHF4SbZ6 C69zYZOSbkjGsgo3ZBMtI42lJoWktL/rmaN/XoNgjIQ3hh+PMxCsFM/t3pPTozk4idKD 7ngb8QddP1ZuZTJrHm08eGnanoxFzjd3UF2LgbJYRHuc/2OGZt9BnzdLxCH/RIAc3mQ5 LrBVczvoTB0svoxVLv3DZdIZhgxQrYMV6mSXZdzW0dAHSGiUSFOsvd4K20qKUw36vdol qSCsJgaZMiYHl1X0f6WdR6taUjQfAtLB0U5NmZrK1ItVg7g9Yw+IGMSJglM+mnjE4Bcd yh9g== X-Gm-Message-State: AOAM532GhvlsfzdbUBk6eNz91nGSVmDAxDgKWpnlKRmOY9it1WSGGxof GMWAIUZLKjuSosEnf/jj0F8lD3AjxAQ= X-Google-Smtp-Source: ABdhPJwXD7k9FMkgx/F8zU6ECgT1jdHU3/fVHzE23IHRGFSMghTYTTLmpFsBYh9Hrc9LPVJRU2PUWQ== X-Received: by 2002:a05:600c:4f43:b0:393:e9f2:1266 with SMTP id m3-20020a05600c4f4300b00393e9f21266mr2419235wmq.83.1650803802061; Sun, 24 Apr 2022 05:36:42 -0700 (PDT) Received: from ?IPV6:2001:871:242:2cae:2599:1b58:4847:a60? ([2001:871:242:2cae:2599:1b58:4847:a60]) by smtp.gmail.com with ESMTPSA id k11-20020adfc70b000000b0020ad82e3ec8sm1696313wrg.62.2022.04.24.05.36.40 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 24 Apr 2022 05:36:41 -0700 (PDT) Message-ID: <174f7322-a47f-ed8d-20e4-a4dff973bfac@gmail.com> Date: Sun, 24 Apr 2022 14:36:39 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Content-Language: de-AT To: FFmpeg development discussions and patches References: <8fd28808-07f8-9458-b032-8792c67a38fd@gmail.com> From: Andreas Unterweger In-Reply-To: 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-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: Am 11.04.2022 um 08:46 schrieb Paul B Mahol: > 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? Ping again > > >> _______________________________________________ >> 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". > _______________________________________________ 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".