diff mbox series

[FFmpeg-devel,v2] lavc/amrwb: Output silence for frames marked as broken

Message ID CAB0OVGqmO79uka3wjVOdKi6=0zNHHc+XH=jiXSkSQq7t3Cb03A@mail.gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,v2] lavc/amrwb: Output silence for frames marked as broken | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Carl Eugen Hoyos April 5, 2020, 3:37 p.m. UTC
Am So., 5. Apr. 2020 um 02:01 Uhr schrieb Carl Eugen Hoyos <ceffmpeg@gmail.com>:

> Attached patch makes the output of the file in ticket #7113 very
> similar to the reference decoder.

New patch attached.

Carl Eugen

Comments

Anton Khirnov April 6, 2020, 8:42 a.m. UTC | #1
Quoting Carl Eugen Hoyos (2020-04-05 17:37:15)
> Am So., 5. Apr. 2020 um 02:01 Uhr schrieb Carl Eugen Hoyos <ceffmpeg@gmail.com>:
> 
> > Attached patch makes the output of the file in ticket #7113 very
> > similar to the reference decoder.
> 
> New patch attached.

You could say how is this patch different and why. It seems that
handling ctx->fr_cur_mode > MODE_SID is now gone for no obvious reason.
Carl Eugen Hoyos April 6, 2020, 1:32 p.m. UTC | #2
Am Mo., 6. Apr. 2020 um 10:42 Uhr schrieb Anton Khirnov <anton@khirnov.net>:
>
> Quoting Carl Eugen Hoyos (2020-04-05 17:37:15)
> > Am So., 5. Apr. 2020 um 02:01 Uhr schrieb Carl Eugen Hoyos <ceffmpeg@gmail.com>:
> >
> > > Attached patch makes the output of the file in ticket #7113 very
> > > similar to the reference decoder.
> >
> > New patch attached.
>
> You could say how is this patch different and why.

The source file has changed, the original patch did not
apply anymore.

> It seems that handling ctx->fr_cur_mode > MODE_SID
> is now gone for no obvious reason.

The condition is dead code in current FFmpeg, if the
condition is moved, two error messages are shown for
every invalid (but not corrupt) frame isntead of one
which seems unneeded (but not worth mentioning)
to me.

Carl Eugen
Anton Khirnov April 7, 2020, 2:04 p.m. UTC | #3
Quoting Carl Eugen Hoyos (2020-04-06 15:32:43)
> Am Mo., 6. Apr. 2020 um 10:42 Uhr schrieb Anton Khirnov <anton@khirnov.net>:
> >
> > Quoting Carl Eugen Hoyos (2020-04-05 17:37:15)
> > > Am So., 5. Apr. 2020 um 02:01 Uhr schrieb Carl Eugen Hoyos <ceffmpeg@gmail.com>:
> > >
> > > > Attached patch makes the output of the file in ticket #7113 very
> > > > similar to the reference decoder.
> > >
> > > New patch attached.
> >
> > You could say how is this patch different and why.
> 
> The source file has changed, the original patch did not
> apply anymore.
> 
> > It seems that handling ctx->fr_cur_mode > MODE_SID
> > is now gone for no obvious reason.
> 
> The condition is dead code in current FFmpeg, if the
> condition is moved, two error messages are shown for
> every invalid (but not corrupt) frame isntead of one
> which seems unneeded (but not worth mentioning)
> to me.

Okay then.
Carl Eugen Hoyos April 11, 2020, 12:19 p.m. UTC | #4
Am Di., 7. Apr. 2020 um 16:05 Uhr schrieb Anton Khirnov <anton@khirnov.net>:
>
> Quoting Carl Eugen Hoyos (2020-04-06 15:32:43)
> > Am Mo., 6. Apr. 2020 um 10:42 Uhr schrieb Anton Khirnov <anton@khirnov.net>:
> > >
> > > Quoting Carl Eugen Hoyos (2020-04-05 17:37:15)
> > > > Am So., 5. Apr. 2020 um 02:01 Uhr schrieb Carl Eugen Hoyos <ceffmpeg@gmail.com>:
> > > >
> > > > > Attached patch makes the output of the file in ticket #7113 very
> > > > > similar to the reference decoder.
> > > >
> > > > New patch attached.
> > >
> > > You could say how is this patch different and why.
> >
> > The source file has changed, the original patch did not
> > apply anymore.
> >
> > > It seems that handling ctx->fr_cur_mode > MODE_SID
> > > is now gone for no obvious reason.
> >
> > The condition is dead code in current FFmpeg, if the
> > condition is moved, two error messages are shown for
> > every invalid (but not corrupt) frame isntead of one
> > which seems unneeded (but not worth mentioning)
> > to me.
>
> Okay then.

Patch split and applied.

Carl Eugen
diff mbox series

Patch

From c5c63dd531aac11f0c927c09a66d2bcff6ea5356 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Sun, 5 Apr 2020 17:35:38 +0200
Subject: [PATCH] lavc/amrwbdec: Output silence for frames marked as corrupt.

Fixes ticket #7113.
---
 libavcodec/amrwbdec.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c
index 5943bfc84e..7d357a2685 100644
--- a/libavcodec/amrwbdec.c
+++ b/libavcodec/amrwbdec.c
@@ -1121,7 +1121,10 @@  static int amrwb_decode_frame(AVCodecContext *avctx, void *data,
     header_size      = decode_mime_header(ctx, buf);
     expected_fr_size = ((cf_sizes_wb[ctx->fr_cur_mode] + 7) >> 3) + 1;
 
-    if (ctx->fr_cur_mode == NO_DATA) {
+    if (!ctx->fr_quality)
+        av_log(avctx, AV_LOG_ERROR, "Encountered a bad or corrupted frame\n");
+
+    if (ctx->fr_cur_mode == NO_DATA || !ctx->fr_quality) {
         av_samples_set_silence(&frame->data[0], 0, frame->nb_samples, 1, AV_SAMPLE_FMT_FLT);
         *got_frame_ptr = 1;
         return expected_fr_size;
@@ -1139,9 +1142,6 @@  static int amrwb_decode_frame(AVCodecContext *avctx, void *data,
         return AVERROR_INVALIDDATA;
     }
 
-    if (!ctx->fr_quality || ctx->fr_cur_mode > MODE_SID)
-        av_log(avctx, AV_LOG_ERROR, "Encountered a bad or corrupted frame\n");
-
     if (ctx->fr_cur_mode == MODE_SID) { /* Comfort noise frame */
         avpriv_request_sample(avctx, "SID mode");
         return AVERROR_PATCHWELCOME;
-- 
2.24.1