From patchwork Sun Apr 5 00:01:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Eugen Hoyos X-Patchwork-Id: 18655 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 8FF86448E16 for ; Sun, 5 Apr 2020 03:02:07 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 73ABE68B53A; Sun, 5 Apr 2020 03:02:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-il1-f174.google.com (mail-il1-f174.google.com [209.85.166.174]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3FECA68B527 for ; Sun, 5 Apr 2020 03:02:01 +0300 (EEST) Received: by mail-il1-f174.google.com with SMTP id f16so11195163ilj.9 for ; Sat, 04 Apr 2020 17:02:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=OqrpA7mlqmI8itLTsMcSa7tjy1Gc9Gpd+duvHXv20vI=; b=jKHoJDSmJBKW3K1+ygF4wvIdajJHiaUpdeP5iQ+0ZbwOznStCZtQfOjxv+1JXlq14E bIa//S88J2lanq3d8wpw9CTu3IwieywLEs4CAHG7m9QecV+7DL8+B9gQmbAPTtdd6jXv PZr6lwU93I4duq/4Mroc6kd6Ok6MGZqCh6gqQFirpEJV/GyrkFTUfU4ANnJbqMN5cDvA Iva1JGdEOY/EWcfqCDf13hVDFoHAlAACfc5WLHOo+XovC6Ec/qj0p5J1HWxJcOd6fVCx E8sY8+kKIE+DelNNWwrluparvTNtJ4/VWeg+0DWY/muP0ELG5ejgvABALTzde+EOFojT CU3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=OqrpA7mlqmI8itLTsMcSa7tjy1Gc9Gpd+duvHXv20vI=; b=EJzwLQmjnX5naYL707qgVSeZLht78+oLFvPbofZyyRg6oF2SbZsL1WFshLLG5+d8Ro H1D4uYp2HPbHi4Sv/jPfu16EANnJDJBLryLeoAtUncbFANKNxDMoHm3eREdnpZS2nVJ2 CbKcG71i+qBq9A4OC0e6DebQlh912qfIw7hEknBIke/E70Qzqjm7L9HMP1uO1NHUu6hW gwBAGLZoMOmeLKyZ6gKyY/bs0prodacErr5OljYMDH8WZ/N/pGsScQs5lwvy+28glulm hG0tkhyF6IMO2/Rdq+/oNKM61CuLPCD2fjGfW8p1QskmmRTpN6M2EC9Zc6MPuvzhXt7r G63A== X-Gm-Message-State: AGi0PuY4anPcpFpRBdM/z0o/iuqJlF764AISVg6cdIxLQHEDl4bo2xXu yMBLK0Kbiz+8huHAxvTjW+SFsTXhGi+pdkalUEV5XQ== X-Google-Smtp-Source: APiQypJ6rvHqNDqTspXNRYvLxymhpcUE/Grditu+ayUvX1ImxlLLSqVttqvHozVyde2G9OuvXsXBXOvtEtAaP6+xBBI= X-Received: by 2002:a92:890b:: with SMTP id n11mr14918815ild.54.1586044919575; Sat, 04 Apr 2020 17:01:59 -0700 (PDT) MIME-Version: 1.0 From: Carl Eugen Hoyos Date: Sun, 5 Apr 2020 02:01:48 +0200 Message-ID: To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH]lavc/amrwb: Output silence for frames marked as broken X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Hi! Attached patch makes the output of the file in ticket #7113 very similar to the reference decoder. Please comment, Carl Eugen From a10e9983e0724f736850b37d3732161a6cff2d6a Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos 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