From patchwork Sat Sep 19 16:36:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22498 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 03D374493ED for ; Sat, 19 Sep 2020 19:39:36 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1120768B90C; Sat, 19 Sep 2020 19:37:38 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 405DD68B846 for ; Sat, 19 Sep 2020 19:37:30 +0300 (EEST) Received: by mail-wr1-f65.google.com with SMTP id c18so8582425wrm.9 for ; Sat, 19 Sep 2020 09:37:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PVosB0XA8OroF3hBINJ13trGicM4jr+Fo4djKaF75hk=; b=Q6Knr8JuA0GcWQ3TKXkAF1e4UDSnO59rC0HsPSsX8qt7yfm5Ckhydm/i2xsz7Yab5V AxBoJrHuogIjtyP271XpNREhdsAj2C8CrPI3aQ+KYLGm0PigWFG1nzBSaEoN0RurywSk aD2S2NXOe7pNXZZ+ULjvPuSk73QXJukiPUINd+Q4SnTmoy9bse2QDGGtZp/45DWXLXE4 cPJ/I6KRxmHTPZ+Ob2HVKmVTYKHKwzi4YYz3aQIGcCwza5nLujh4gxP/2t7qzXdZgJ84 DE6nlIlxSQKQ/VoBRmaMPkBOcRiZ0N6S+J62TTkdrzl3BFkb5CGZ82Y2e539nr3biNV3 vbdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PVosB0XA8OroF3hBINJ13trGicM4jr+Fo4djKaF75hk=; b=YC3scvh/mBEEdRdoZkH6fsVGsX62yAXfCFLtfKnOSwzBU346rnmv7qV1vuOgZG5HxI xvOjJhjsk7zR6HMtY6HXOzAgUWaJHWqSyn3vOuLOFVq39DeerB9zmua0MaucoF3XqcmE tsf3lDV6vU3lMAloGSzPfKZ8Nv6+Zs6r70b50CKZElBhBImP6C53++jM4+idTFnBm5d1 Lzf1q9dA493rPx8olq1ehGaGO9H15wpWB6llVIoalg+uKAcR/JtySKhZMb2xkmeQlrCF R1EbqIfKIimYF89Da4g5w+s/8M37fIdiZa8ItOM0E2Y6rdxh1Jh1u81aJTw6iyLT139u k7yw== X-Gm-Message-State: AOAM532Rz6xTNMethO/CprwDIdRe7sLhJfoJ5rcI29vsyj/p5D9Ttuee GEvpEK0S7D1ghyRJVGZrenubb9NJj/8= X-Google-Smtp-Source: ABdhPJw+w2NO+shrbaheURwPGIP3jZRaqPvtCn2ngQG5genMrLbtDhJNEBxWExU4O3zL0HPA5LTlaQ== X-Received: by 2002:a5d:46cf:: with SMTP id g15mr44227476wrs.107.1600533449148; Sat, 19 Sep 2020 09:37:29 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1fb0f.dynamic.kabel-deutschland.de. [188.193.251.15]) by smtp.gmail.com with ESMTPSA id d5sm12451137wrb.28.2020.09.19.09.37.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Sep 2020 09:37:28 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 19 Sep 2020 18:36:05 +0200 Message-Id: <20200919163610.1099233-16-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200919163610.1099233-1-andreas.rheinhardt@gmail.com> References: <20200919163610.1099233-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 16/21] avformat/dashdec: Remove redundant checks 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This commit removes two always-true checks as well as a dead default case of a switch. The check when parsing manifests is always true, because we now jump to the cleaning code in case the format of the representation is unknown. The default case of the switch is dead, because the type of the representation is already checked at the beginning of parse_manifest_representation(). The check when reading the header is dead, because we error out if an error happened before. Signed-off-by: Andreas Rheinhardt --- libavformat/dashdec.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index e1554d077b..d75ff92a7b 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -1049,7 +1049,6 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, goto free; } - if (rep) { if (rep->fragment_duration > 0 && !rep->fragment_timescale) rep->fragment_timescale = 1; rep->bandwidth = rep_bandwidth_val ? atoi(rep_bandwidth_val) : 0; @@ -1071,13 +1070,9 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, case AVMEDIA_TYPE_SUBTITLE: ret = av_dynarray_add_nofree(&c->subtitles, &c->n_subtitles, rep); break; - default: - av_log(s, AV_LOG_WARNING, "Unsupported the stream type %d\n", type); - break; } if (ret < 0) goto free; - } } end: @@ -2042,6 +2037,7 @@ static int dash_read_header(AVFormatContext *s) { DASHContext *c = s->priv_data; struct representation *rep; + AVProgram *program; int ret = 0; int stream_index = 0; int i; @@ -2123,8 +2119,6 @@ static int dash_read_header(AVFormatContext *s) } /* Create a program */ - if (!ret) { - AVProgram *program; program = av_new_program(s, 0); if (!program) { ret = AVERROR(ENOMEM); @@ -2164,7 +2158,6 @@ static int dash_read_header(AVFormatContext *s) av_freep(&rep->lang); } } - } return 0; fail: