From patchwork Mon Sep 23 16:41:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Zhao X-Patchwork-Id: 15231 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 D4BB744A7BB for ; Mon, 23 Sep 2019 19:41:23 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B3C7C689CC6; Mon, 23 Sep 2019 19:41:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7C78E689821 for ; Mon, 23 Sep 2019 19:41:17 +0300 (EEST) Received: by mail-pf1-f195.google.com with SMTP id v4so4834384pff.6 for ; Mon, 23 Sep 2019 09:41:17 -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; bh=PvpiqJoWjOLozmk5PRRsZ85ddVVlUqMyCSVnV9+3cFA=; b=o+yxkvEX3Dq2xv/T3VYZW52ViRyLqK1IjkYgbOk+ipEOpenrw9M+M2LSUo+mHpTRVy VPgijXotWU2rTISlB2LUB15Yv1RnL9eFjTA0VZ75GD3ehGpFhlol1pDxwIH9A/EE7CMc /Z53Wv7pg+MxgSV8vrDZc5DyxWfLHLKmUjOXexylYK4laSASQ8DwSdIEWcl43ihoN0nD j3OdtN/XcJRvESomnppJNJl5rNaC82H4COofvxuxThpefZF86QNCzPhxPU5frpqBDR6L ISBG3mq/xBRfbnLXvouDYXVa+JJ+fEEjiEYcBE2xoZfdymJovpE/zqI780An05c5gUkc nCiQ== 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; bh=PvpiqJoWjOLozmk5PRRsZ85ddVVlUqMyCSVnV9+3cFA=; b=arY8mXSP+lAjsplhzhjmz56kP9gQK17fVDMp8Lf3/n+gAP/XTnYowvF/RAbReJWfk/ V8OK7cm7rBid3RFb2eKBlWXBwjtZBEX47je/mgyUMx9MXelne5Fm3+AnCeYNXmlW26yB F48+YG/k/UfqOyHIWXMlhGEw3utO8q7VTLd28nfAxo6TpE7YCBqgH963Q/YLzuljDUPL 0HQ/H9nhcv84VQOPGz+tpGzcO/I7unY9CG8NQ28/wHVooGICjDX4B16Xj1W97XdXnCAa Um3jVQHKMAsVQPWlMj4VY6ZTgBQb/XAYyj00+JP6pwcTa0P4BYumxHy/I81x7pzU6Qje Azpg== X-Gm-Message-State: APjAAAXU+uOL17OG2jp8vMJL04bSkIa+A0uALlnWhRuC3h/en16bNhYy YJkZlXBGaHfSk3yleCTTTaEKWvsp X-Google-Smtp-Source: APXvYqyW/fKC2KpqKExK+Xy9TRXX4eQOpM5FMhuR9ePYpDAX+JVtVsdhergLzSni6NHo8ssfpkS6vg== X-Received: by 2002:a65:6799:: with SMTP id e25mr830770pgr.271.1569256875682; Mon, 23 Sep 2019 09:41:15 -0700 (PDT) Received: from localhost.localdomain ([47.90.47.25]) by smtp.gmail.com with ESMTPSA id q13sm25091240pjq.0.2019.09.23.09.41.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Sep 2019 09:41:15 -0700 (PDT) From: Jun Zhao To: ffmpeg-devel@ffmpeg.org Date: Tue, 24 Sep 2019 00:41:11 +0800 Message-Id: <1569256871-4807-1-git-send-email-mypopydev@gmail.com> X-Mailer: git-send-email 1.7.1 Subject: [FFmpeg-devel] [PATCH V1] lavf/dashdec: drop unnecessary check before ff_format_io_close 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: Jun Zhao MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Jun Zhao ff_format_io_close will check the AVIOContext pointer pb, so drop the unnecessary check before ff_format_io_close. Signed-off-by: Jun Zhao --- libavformat/dashdec.c | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 8c0a9b0..5a49e15 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -363,8 +363,7 @@ static void free_representation(struct representation *pls) free_fragment(&pls->init_section); av_freep(&pls->init_sec_buf); av_freep(&pls->pb.buffer); - if (pls->input) - ff_format_io_close(pls->parent, &pls->input); + ff_format_io_close(pls->parent, &pls->input); if (pls->ctx) { pls->ctx->pb = NULL; avformat_close_input(&pls->ctx); @@ -2182,8 +2181,7 @@ static void recheck_discard_flags(AVFormatContext *s, struct representation **p, av_log(s, AV_LOG_INFO, "Now receiving stream_index %d\n", pls->stream_index); } else if (!needed && pls->ctx) { close_demux_for_component(pls); - if (pls->input) - ff_format_io_close(pls->parent, &pls->input); + ff_format_io_close(pls->parent, &pls->input); av_log(s, AV_LOG_INFO, "No longer receiving stream_index %d\n", pls->stream_index); } } @@ -2244,8 +2242,7 @@ static int dash_read_packet(AVFormatContext *s, AVPacket *pkt) if (cur->is_restart_needed) { cur->cur_seg_offset = 0; cur->init_sec_buf_read_offset = 0; - if (cur->input) - ff_format_io_close(cur->parent, &cur->input); + ff_format_io_close(cur->parent, &cur->input); ret = reopen_demux_for_component(s, cur); cur->is_restart_needed = 0; } @@ -2283,8 +2280,7 @@ static int dash_seek(AVFormatContext *s, struct representation *pls, int64_t see return av_seek_frame(pls->ctx, -1, seek_pos_msec * 1000, flags); } - if (pls->input) - ff_format_io_close(pls->parent, &pls->input); + ff_format_io_close(pls->parent, &pls->input); // find the nearest fragment if (pls->n_timelines > 0 && pls->fragment_timescale > 0) {