From patchwork Mon Jan 18 06:22:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Liu X-Patchwork-Id: 25005 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 C72F44491C6 for ; Mon, 18 Jan 2021 08:22:35 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9659368079F; Mon, 18 Jan 2021 08:22:35 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpproxy21.qq.com (smtpbg704.qq.com [203.205.195.105]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0C9D2680109 for ; Mon, 18 Jan 2021 08:22:28 +0200 (EET) X-QQ-mid: bizesmtp17t1610950930tynuam1j Received: from localhost (unknown [103.107.216.232]) by esmtp6.qq.com (ESMTP) with id ; Mon, 18 Jan 2021 14:22:09 +0800 (CST) X-QQ-SSF: 01100000002000Z0Z000B00A0020000 X-QQ-FEAT: n4FWwWpTo56Vq4O7F1+dc3Qtv2s+DLUmRqCAlZWxOSWRNLsWczQssvLFsMviC 0n1ZaTgDawOHfFCwKJe5PheHbPDwIs01WLpAegZqRs5lze0/Vsqh6dVhAOXChTlcgZJ+nO9 HgHjXn4whmB2Onvcpm1TPq3z3sjgqG4dq+9A4b+AqHCVqgWQYCWAwrutjz1EB9/iQUJqDIj M5EOjj78RV8J4NoSbuOZ2UaIX5oiiXhewQrGk4e4F298t4/DMg2nPepT/mOt9ahpQU71TID Wn5cOIlUXaDo2bVDaXhgmGERNzARZ8qhUiU+o/Vp9EHtwth3zxbgrwUtc= X-QQ-GoodBg: 0 X-QQ-CSender: lq@chinaffmpeg.org From: liuqi05 To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Jan 2021 14:22:07 +0800 Message-Id: <20210118062208.85568-1-liuqi05@kuaishou.com> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybgforeign:qybgforeign7 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH v2 1/2] avformat/dashdec: check init_section before use it. 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: liuqi05 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" because there have no Initialization in SegmentTemplate, so it will have no init_section for init segment file. but in the is_common_init_section_exist function it will be used for check to url, url_offset and size, so check init_section before use init_section. And fix code style in is_common_init_section_exist, make the code block short when it too long. fix ticket: 9062 Signed-off-by: liuqi05 --- libavformat/dashdec.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 693fc7372b..9262e9c0a4 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -1992,7 +1992,12 @@ static int is_common_init_section_exist(struct representation **pls, int n_pls) url_offset = first_init_section->url_offset; size = pls[0]->init_section->size; for (i=0;iinit_section->url,url) || pls[i]->init_section->url_offset != url_offset || pls[i]->init_section->size != size) { + if (!pls[i]->init_section) + continue; + + if (av_strcasecmp(pls[i]->init_section->url, url) || + pls[i]->init_section->url_offset != url_offset || + pls[i]->init_section->size != size) { return 0; } } From patchwork Mon Jan 18 06:22:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Liu X-Patchwork-Id: 25006 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 ED43144ABEB for ; Mon, 18 Jan 2021 08:46:44 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BEDB8680C53; Mon, 18 Jan 2021 08:46:44 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpproxy21.qq.com (smtpbg702.qq.com [203.205.195.102]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C1B1A6800C9 for ; Mon, 18 Jan 2021 08:46:37 +0200 (EET) X-QQ-mid: bizesmtp13t1610952380tdx4fmil Received: from localhost (unknown [103.107.216.232]) by esmtp6.qq.com (ESMTP) with id ; Mon, 18 Jan 2021 14:46:19 +0800 (CST) X-QQ-SSF: 01100000002000Z0Z000B00A0020000 X-QQ-FEAT: 89a1Jj4rqi+yBBEbW+e1JAdi4+62+cblngaaxxtz6BXhPpklAhKwuXnJVKamL yCrQNc2Z65zLf80r+iHYUPSm7YZ6inRSXFP9WQhoxUvs8cMLiDz7e9ZUL2dHl8n1jWRK5qf k9CCjqxgiLMc+sonAcKh3o5LXCci1tPNHM6Gn+Z4kQ1EutQknvCigCpmCVE9WABBRmN/9Bl Bf8Uu7UgX7b221rhHTAT0v97uDTuWxQNDIBhHAxCJiZeXYRYvSDlvnQRDPF+sFLja9MyRKV HYAfk4EN643hmpcz29CyK+n2eIfh3bDnuHKlGlmdx7rYMwthqAS7ouW6xis9kPUKcYbg== X-QQ-GoodBg: 0 X-QQ-CSender: lq@chinaffmpeg.org From: liuqi05 To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Jan 2021 14:22:08 +0800 Message-Id: <20210118062208.85568-2-liuqi05@kuaishou.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20210118062208.85568-1-liuqi05@kuaishou.com> References: <20210118062208.85568-1-liuqi05@kuaishou.com> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybgforeign:qybgforeign6 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH v2 2/2] avformat/dashdec: rename variable name for more readable 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: liuqi05 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Rename is_init_section_common_audio to is_init_section_common_subtitle for is_common_init_section_exist(c->subtitles, c->n_subtitles). Because it is checked to subtitles, not audio. Signed-off-by: liuqi05 --- libavformat/dashdec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 9262e9c0a4..3fd657c06b 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -155,6 +155,7 @@ typedef struct DASHContext { /* Flags for init section*/ int is_init_section_common_video; int is_init_section_common_audio; + int is_init_section_common_subtitle; } DASHContext; @@ -2084,11 +2085,11 @@ static int dash_read_header(AVFormatContext *s) } if (c->n_subtitles) - c->is_init_section_common_audio = is_common_init_section_exist(c->subtitles, c->n_subtitles); + c->is_init_section_common_subtitle = is_common_init_section_exist(c->subtitles, c->n_subtitles); for (i = 0; i < c->n_subtitles; i++) { rep = c->subtitles[i]; - if (i > 0 && c->is_init_section_common_audio) { + if (i > 0 && c->is_init_section_common_subtitle) { ret = copy_init_section(rep, c->subtitles[0]); if (ret < 0) goto fail;