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(-)
@@ -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