From patchwork Sun Aug 9 10:56:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 21548 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 AB5E144B8C8 for ; Sun, 9 Aug 2020 13:57:08 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 992FE68AA89; Sun, 9 Aug 2020 13:57:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9EFB768A383 for ; Sun, 9 Aug 2020 13:57:01 +0300 (EEST) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 079Av0jL031364 for ; Sun, 9 Aug 2020 12:57:01 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id 9CB8CE1DC8; Sun, 9 Aug 2020 12:57:00 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Sun, 9 Aug 2020 12:56:52 +0200 Message-Id: <20200809105653.93859-1-george@nsup.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Sun, 09 Aug 2020 12:57:01 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 1/2] lavfi/avf_concat: add some doxy. 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" The semantic of delta_pts is not obvious. Signed-off-by: Nicolas George --- libavfilter/avf_concat.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libavfilter/avf_concat.c b/libavfilter/avf_concat.c index 28bd5407ad..246628498a 100644 --- a/libavfilter/avf_concat.c +++ b/libavfilter/avf_concat.c @@ -224,6 +224,12 @@ static void close_input(AVFilterContext *ctx, unsigned in_no) ctx->input_pads[in_no].name, cat->nb_in_active); } +/** + * Compute the delta_ts of the next segment. + * + * If everything starts at 0 as expected, it is the timestamp where the + * next segment begins in the output. + */ static void find_next_delta_ts(AVFilterContext *ctx, int64_t *seg_delta) { ConcatContext *cat = ctx->priv; @@ -238,6 +244,14 @@ static void find_next_delta_ts(AVFilterContext *ctx, int64_t *seg_delta) *seg_delta = pts; } +/** + * Send silence to pad audio streams to the duration of video streams + * + * @param ctx codec context + * @param in_no input number + * @param out_no output number + * @param seg_delta segment delta, i.e. output timestamp to reach. + */ static int send_silence(AVFilterContext *ctx, unsigned in_no, unsigned out_no, int64_t seg_delta) { From patchwork Sun Aug 9 10:56:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 21549 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 D7C5E44B8C8 for ; Sun, 9 Aug 2020 13:57:09 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C225368AB1D; Sun, 9 Aug 2020 13:57:09 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 54FC768A383 for ; Sun, 9 Aug 2020 13:57:02 +0300 (EEST) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 079Av1G8031377 for ; Sun, 9 Aug 2020 12:57:01 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id 7831AE1DC8; Sun, 9 Aug 2020 12:57:01 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Sun, 9 Aug 2020 12:56:53 +0200 Message-Id: <20200809105653.93859-2-george@nsup.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200809105653.93859-1-george@nsup.org> References: <20200809105653.93859-1-george@nsup.org> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Sun, 09 Aug 2020 12:57:01 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 2/2] lavfi/avf_concat: check input timestamp. 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" If an input has an undefined timestamp, the computation for silence at stitches can overflow. Partial fix for trac ticket #8843. Signed-off-by: Nicolas George --- libavfilter/avf_concat.c | 4 ++++ 1 file changed, 4 insertions(+) "Partial fix" means it does not segfault and exits with an error instead. The actual problem in this ticket is amix sending a frame with no PTS. diff --git a/libavfilter/avf_concat.c b/libavfilter/avf_concat.c index 246628498a..f376f72754 100644 --- a/libavfilter/avf_concat.c +++ b/libavfilter/avf_concat.c @@ -179,6 +179,10 @@ static int push_frame(AVFilterContext *ctx, unsigned in_no, AVFrame *buf) AVFilterLink *outlink = ctx->outputs[out_no]; struct concat_in *in = &cat->in[in_no]; + if (buf->pts == AV_NOPTS_VALUE) { + av_log(ctx, AV_LOG_ERROR, "Frame without timestamp on input %d\n", in_no); + return AVERROR(EINVAL); + } buf->pts = av_rescale_q(buf->pts, inlink->time_base, outlink->time_base); in->pts = buf->pts; in->nb_frames++;