diff mbox series

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

Message ID CAB0OVGqXFeZGVbhJrF0b-ceRRdNAxzDGnXwuN=BA_ypkes33gQ@mail.gmail.com
State Superseded
Headers show
Series [FFmpeg-devel] 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, 12:01 a.m. UTC
Hi!

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

Please comment, Carl Eugen

Comments

Carl Eugen Hoyos April 5, 2020, 3:37 p.m. UTC | #1
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
diff mbox series

Patch

From a10e9983e0724f736850b37d3732161a6cff2d6a Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Sun, 5 Apr 2020 01:59:21 +0200
Subject: [PATCH] lavc/amrwb: 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 b488a5d3c7..00d22186b1 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 || ctx->fr_cur_mode > MODE_SID)
+        av_log(avctx, AV_LOG_ERROR, "Encountered a bad or corrupted frame\n");
+
+    if (ctx->fr_cur_mode == NO_DATA || !ctx->fr_quality) {
         for (i = 0; i < frame->nb_samples; i++)
             buf_out[i] = 0.f;
         *got_frame_ptr = 1;
@@ -1140,9 +1143,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