From patchwork Tue Jan 12 13:20:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Liu X-Patchwork-Id: 24917 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 53C50448EE0 for ; Tue, 12 Jan 2021 15:20:51 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 208AE68AC45; Tue, 12 Jan 2021 15:20:51 +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 7AF8C68AB98 for ; Tue, 12 Jan 2021 15:20:44 +0200 (EET) X-QQ-mid: bizesmtp2t1610457616tu2d19rsy Received: from localhost (unknown [103.107.216.233]) by esmtp6.qq.com (ESMTP) with id ; Tue, 12 Jan 2021 21:20:07 +0800 (CST) X-QQ-SSF: 01100000002000Z0Z000B00A0020000 X-QQ-FEAT: M9Hp9qAmGp7PJSnI1XGehn8WHR75HI0rHg+dNghs/HkzhbsHLEFu/zrESyplM w9Gb570AInqtb2M5XdDTkY5iR/I3JXlxaeceW9tahn1PlRJr5Fl/ghV6os4cQXUtU5ikMxX iwH05DvHqKfUtL3Xk0DK+5ZZUZvcxpdKQYLN/KesGdvS2P1dZmTOHn6UMeTBiLCNqzZkdoT CTXGw2UKlypOjzwezRUbWXD8jW0i4ie0hloW0ZjAkdAWDtxtMP6sPnEcJvTonKbTMuDkIGq XykO1h9uiWBTo21aDAygG6F1zERyTeSqq008SKGBoYmFhu X-QQ-GoodBg: 0 X-QQ-CSender: lq@chinaffmpeg.org From: liuqi05 To: ffmpeg-devel@ffmpeg.org Date: Tue, 12 Jan 2021 21:20:02 +0800 Message-Id: <20210112132004.23534-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 1/3] 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 fix ticket: 9062 Signed-off-by: liuqi05 --- libavformat/dashdec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 693fc7372b..5f9b9ba882 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -1992,7 +1992,10 @@ 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 Tue Jan 12 13:20:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Liu X-Patchwork-Id: 24919 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 5CFDD448EE0 for ; Tue, 12 Jan 2021 15:20:56 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3AEFA68AC9C; Tue, 12 Jan 2021 15:20:56 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbgau2.qq.com (smtpbgau2.qq.com [54.206.34.216]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9E7C568AB55 for ; Tue, 12 Jan 2021 15:20:53 +0200 (EET) X-QQ-mid: bizesmtp25t1610457622t93kv7af Received: from localhost (unknown [103.107.216.233]) by esmtp6.qq.com (ESMTP) with id ; Tue, 12 Jan 2021 21:20:21 +0800 (CST) X-QQ-SSF: 01100000002000Z0Z000B00A0020000 X-QQ-FEAT: GQHegz42qyvFXUZxihYy7+Cg4TG7wudq5WYg6bQVgLI1seSfgEabIN0u+SIK+ CJnmusZ3RUWu51NNIVFXWjdkpP4E9+vxoMv9rs6MIv7orTelfwYPYNyEaNgAu/apwEDBKm7 cF5+dL4DUWJ6HYxeKfPxreuskHf88+cgaDxHTTdaXC/DKhykbATsU21l2Xx226D1ZR1Y/nB mG/PI9Du95CS2uqX5riapulINVvsG38bb/ODDu3dOyfLKD9lqzTLfv1Suy6uprmfux5BV+l KtNET3YAFTidMl4aDyESReqakUZzvoJNBw3leyjmaaMYxc X-QQ-GoodBg: 0 X-QQ-CSender: lq@chinaffmpeg.org From: liuqi05 To: ffmpeg-devel@ffmpeg.org Date: Tue, 12 Jan 2021 21:20:03 +0800 Message-Id: <20210112132004.23534-2-liuqi05@kuaishou.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20210112132004.23534-1-liuqi05@kuaishou.com> References: <20210112132004.23534-1-liuqi05@kuaishou.com> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybgforeign:qybgforeign5 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH 2/3] avformat/dashdec: fix code style in is_common_init_section_exist 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" make the code block short when it too long. Signed-off-by: liuqi05 --- libavformat/dashdec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 5f9b9ba882..85b5f147e8 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -1995,7 +1995,9 @@ static int is_common_init_section_exist(struct representation **pls, int n_pls) 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) { + 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 Tue Jan 12 13:20:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Liu X-Patchwork-Id: 24918 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 696B2448EE0 for ; Tue, 12 Jan 2021 15:20:52 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 521D768AC4D; Tue, 12 Jan 2021 15:20:52 +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 7868968A9BB for ; Tue, 12 Jan 2021 15:20:44 +0200 (EET) X-QQ-mid: bizesmtp20t1610457627tvgoua05 Received: from localhost (unknown [103.107.216.233]) by esmtp6.qq.com (ESMTP) with id ; Tue, 12 Jan 2021 21:20:26 +0800 (CST) X-QQ-SSF: 01100000002000Z0Z000B00A0020000 X-QQ-FEAT: HtUBBCnXkj7td+zkzWfpiZuWEN9lNYqSnt4Gs23CfKQ4aD3DviI3M3GtbwD3v rIS6N303iYaV2iC5tuyLvCSS+tS1+EZBU7wJpLv+QQFeC3XX7hbGxRtD/G1R5HL+Us0IRKM Ppcha2pDFOplL8eK3o0ZZlN0ty4l26Fim6CrBq+ambvHshLveCKXEs11K20D1ksE0m3DQgd m0WAIQ/XnngCADoaW5xgUhdMqqKi72W2IXxNRqH3ic3RVszZrkAzNa7cHteeZGxI7nkGp4P SN3r5pmdlvD8RNqdAEuaCjSkKdkrwCnqNNeq5r/Ld5/UyO X-QQ-GoodBg: 0 X-QQ-CSender: lq@chinaffmpeg.org From: liuqi05 To: ffmpeg-devel@ffmpeg.org Date: Tue, 12 Jan 2021 21:20:04 +0800 Message-Id: <20210112132004.23534-3-liuqi05@kuaishou.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20210112132004.23534-1-liuqi05@kuaishou.com> References: <20210112132004.23534-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 3/3] 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 85b5f147e8..e0a89ebc07 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;