* [FFmpeg-devel] [PATCH v2 1/2] doc/examples/transcode_aac: Don't ignore last encoded frame
@ 2022-03-22 17:47 Andreas Unterweger
2022-04-06 5:59 ` Andreas Unterweger
2022-04-11 6:46 ` Paul B Mahol
0 siblings, 2 replies; 7+ messages in thread
From: Andreas Unterweger @ 2022-03-22 17:47 UTC (permalink / raw)
To: ffmpeg-devel
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 <dustsigns@gmail.com>
---
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
_______________________________________________
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".
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 1/2] doc/examples/transcode_aac: Don't ignore last encoded frame
2022-03-22 17:47 [FFmpeg-devel] [PATCH v2 1/2] doc/examples/transcode_aac: Don't ignore last encoded frame Andreas Unterweger
@ 2022-04-06 5:59 ` Andreas Unterweger
2022-04-11 6:46 ` Paul B Mahol
1 sibling, 0 replies; 7+ messages in thread
From: Andreas Unterweger @ 2022-04-06 5:59 UTC (permalink / raw)
To: ffmpeg-devel
Am 22.03.2022 um 18:47 schrieb Andreas Unterweger:
> 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 <dustsigns@gmail.com>
> ---
> 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;
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".
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 1/2] doc/examples/transcode_aac: Don't ignore last encoded frame
2022-03-22 17:47 [FFmpeg-devel] [PATCH v2 1/2] doc/examples/transcode_aac: Don't ignore last encoded frame Andreas Unterweger
2022-04-06 5:59 ` Andreas Unterweger
@ 2022-04-11 6:46 ` Paul B Mahol
2022-04-11 7:30 ` Gyan Doshi
2022-04-24 12:36 ` Andreas Unterweger
1 sibling, 2 replies; 7+ messages in thread
From: Paul B Mahol @ 2022-04-11 6:46 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Tue, Mar 22, 2022 at 6:47 PM Andreas Unterweger <dustsigns@gmail.com>
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 <dustsigns@gmail.com>
> ---
> 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".
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 1/2] doc/examples/transcode_aac: Don't ignore last encoded frame
2022-04-11 6:46 ` Paul B Mahol
@ 2022-04-11 7:30 ` Gyan Doshi
2022-04-24 12:36 ` Andreas Unterweger
1 sibling, 0 replies; 7+ messages in thread
From: Gyan Doshi @ 2022-04-11 7:30 UTC (permalink / raw)
To: ffmpeg-devel
On 2022-04-11 12:16 pm, Paul B Mahol wrote:
> On Tue, Mar 22, 2022 at 6:47 PM Andreas Unterweger <dustsigns@gmail.com>
> 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 <dustsigns@gmail.com>
>> ---
>> 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?
Patch does not apply. May need to be manually rebased.
Regards,
Gyan
_______________________________________________
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".
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 1/2] doc/examples/transcode_aac: Don't ignore last encoded frame
2022-04-11 6:46 ` Paul B Mahol
2022-04-11 7:30 ` Gyan Doshi
@ 2022-04-24 12:36 ` Andreas Unterweger
2022-04-24 12:38 ` James Almer
1 sibling, 1 reply; 7+ messages in thread
From: Andreas Unterweger @ 2022-04-24 12:36 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Am 11.04.2022 um 08:46 schrieb Paul B Mahol:
> On Tue, Mar 22, 2022 at 6:47 PM Andreas Unterweger <dustsigns@gmail.com>
> 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 <dustsigns@gmail.com>
>> ---
>> 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".
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 1/2] doc/examples/transcode_aac: Don't ignore last encoded frame
2022-04-24 12:36 ` Andreas Unterweger
@ 2022-04-24 12:38 ` James Almer
2022-04-24 12:40 ` Andreas Unterweger
0 siblings, 1 reply; 7+ messages in thread
From: James Almer @ 2022-04-24 12:38 UTC (permalink / raw)
To: ffmpeg-devel
On 4/24/2022 9:36 AM, Andreas Unterweger wrote:
> Am 11.04.2022 um 08:46 schrieb Paul B Mahol:
>> On Tue, Mar 22, 2022 at 6:47 PM Andreas Unterweger <dustsigns@gmail.com>
>> 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 <dustsigns@gmail.com>
>>> ---
>>> 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
See the reply about the patch no longer applying.
_______________________________________________
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".
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 1/2] doc/examples/transcode_aac: Don't ignore last encoded frame
2022-04-24 12:38 ` James Almer
@ 2022-04-24 12:40 ` Andreas Unterweger
0 siblings, 0 replies; 7+ messages in thread
From: Andreas Unterweger @ 2022-04-24 12:40 UTC (permalink / raw)
To: ffmpeg-devel
Am 24.04.2022 um 14:38 schrieb James Almer:
> On 4/24/2022 9:36 AM, Andreas Unterweger wrote:
>> Am 11.04.2022 um 08:46 schrieb Paul B Mahol:
>>> On Tue, Mar 22, 2022 at 6:47 PM Andreas Unterweger <dustsigns@gmail.com>
>>> 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 <dustsigns@gmail.com>
>>>> ---
>>>> 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
>
> See the reply about the patch no longer applying.
I did already rebase the patch in v2. There have been no changes to the file since.
> _______________________________________________
> 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".
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-04-24 12:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-22 17:47 [FFmpeg-devel] [PATCH v2 1/2] doc/examples/transcode_aac: Don't ignore last encoded frame Andreas Unterweger
2022-04-06 5:59 ` Andreas Unterweger
2022-04-11 6:46 ` Paul B Mahol
2022-04-11 7:30 ` Gyan Doshi
2022-04-24 12:36 ` Andreas Unterweger
2022-04-24 12:38 ` James Almer
2022-04-24 12:40 ` Andreas Unterweger
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git