From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 4ED1240B08 for ; Wed, 6 Apr 2022 11:20:39 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 64A7A68B264; Wed, 6 Apr 2022 14:20:37 +0300 (EEST) Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 987A868B23D for ; Wed, 6 Apr 2022 14:20:30 +0300 (EEST) Received: by mail-oi1-f178.google.com with SMTP id e189so2030353oia.8 for ; Wed, 06 Apr 2022 04:20:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=WqzOtT9iuQpEC0yNRkENIHy/LBZe2AX5hDK5wMVpRWM=; b=XDqhIpRlqhNh+3ER6MoZLgxWnjS14T+bdDBnrqNarvnSKsy5oR5n9/mv55fY4AhlTA kNY0JfBrRO95br7xDMj6v55061y1Kozm8zxIHw9KoxUoI4P2cDurVCvqfj/+6g6CFJXB Spd3r/wvuE3X7lKORYCMBlQ9JJNzB8qwZvVJ11MroMaj7Vz43PZ/YdnMik3wsXEMp4KY lrFj1izNTezRYCbvDhJTzvrU1khTgOpckSGeFoGUh5xpNdxdQrHwqUxLfou3KGHDq/yi wpIqCgW67BPbWAILDoUfN05zLofL/alyYOkJmu8ChywoDCqdoDhrjgfytiQNAiPGIz36 TNUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=WqzOtT9iuQpEC0yNRkENIHy/LBZe2AX5hDK5wMVpRWM=; b=j3F0KrMZbmkRZZ6ZQIudyjb2HaXtZXNkz/pgwbVyEPH6npDmrcgc6OdYbllY0lg8C6 EsNBZNTj1KxV9Dmn02TnbHB1cUU0fXpifhkPUapLsxDUAxyDjhGtBRjRu0TT0c7/mo5h nVScjxBaKI3KwprZw+eVa8xUnbd28VWNRPEP8q32Fo53tLFdfZZ3ahWil2qM4wY3AnDq 4KRosd2kcXQeJfb+RJuIZYJTtAf3aY2wAaw7s1wGbN/iFH69dAKTe4p8nvkgmhup5I8I fewGMbPaE3nXOvx2t29VS9YuXSIVVTaV9O0MLatSc7IWFSZxwJyjSTnWJd2T0pDXLdoN IDdQ== X-Gm-Message-State: AOAM530t7PQoJKGFKUOgqtymp8YBhrDJFrn0zpuBHFyOhjdHjKmS6KaG Jw5tIWUqtyvZsJoe2FE/jkjoY3KMHSRPHQ== X-Google-Smtp-Source: ABdhPJx8y1egoR8d5dMghkqZL44oWnvxZZ0xCx46Lh5WY0ZlN38mWaeWecL79I6nMBqUJsrIjFJQfQ== X-Received: by 2002:aca:4043:0:b0:2ef:f455:7ac9 with SMTP id n64-20020aca4043000000b002eff4557ac9mr3369234oia.71.1649244028644; Wed, 06 Apr 2022 04:20:28 -0700 (PDT) Received: from [192.168.0.12] ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id t15-20020a056808158f00b002e331356c87sm6244829oiw.39.2022.04.06.04.20.27 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Apr 2022 04:20:28 -0700 (PDT) Message-ID: Date: Wed, 6 Apr 2022 08:20:26 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20220404113037.13070-1-anton@khirnov.net> <20220404113037.13070-4-anton@khirnov.net> From: James Almer In-Reply-To: <20220404113037.13070-4-anton@khirnov.net> Subject: Re: [FFmpeg-devel] [PATCH 03/49] fftools/ffmpeg: stop using OutputStream.frame_number for streamcopy X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 4/4/2022 8:29 AM, Anton Khirnov wrote: > This field is currently used by checks > - skipping packets before the first keyframe > - skipping packets before start time > to test whether any packets have been output already. But since > frame_number is incremented after the bitstream filters are applied > (which may involve delay), this use is incorrect. The keyframe check > works around this by adding an extra flag, the start-time check does > not. > > Simplify both checks by replacing the seen_kf flag with a flag tracking > whether any packets have been output by do_streamcopy(). > --- > fftools/ffmpeg.c | 10 +++++----- > fftools/ffmpeg.h | 2 +- > 2 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c > index 13be32f0cf..29b01f9d93 100644 > --- a/fftools/ffmpeg.c > +++ b/fftools/ffmpeg.c > @@ -894,8 +894,6 @@ static void output_packet(OutputFile *of, AVPacket *pkt, > > /* apply the output bitstream filters */ > if (ost->bsf_ctx) { > - if (pkt->flags & AV_PKT_FLAG_KEY) > - ost->seen_kf = 1; > ret = av_bsf_send_packet(ost->bsf_ctx, eof ? NULL : pkt); > if (ret < 0) > goto finish; > @@ -2043,11 +2041,11 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p > return; > } > > - if ((!ost->frame_number && !(pkt->flags & AV_PKT_FLAG_KEY)) && > - !ost->copy_initial_nonkeyframes && !ost->seen_kf) > + if (!ost->streamcopy_started && !(pkt->flags & AV_PKT_FLAG_KEY) && > + !ost->copy_initial_nonkeyframes) > return; > > - if (!ost->frame_number && !ost->copy_prior_start) { > + if (!ost->streamcopy_started && !ost->copy_prior_start) { > int64_t comp_start = start_time; > if (copy_ts && f->start_time != AV_NOPTS_VALUE) > comp_start = FFMAX(start_time, f->start_time + f->ts_offset); > @@ -2101,6 +2099,8 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p > ost->sync_opts += opkt->duration; > > output_packet(of, opkt, ost, 0); > + > + ost->streamcopy_started = 1; > } > > int guess_input_channel_layout(InputStream *ist) > diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h > index 1e14bf9fa9..04369df139 100644 > --- a/fftools/ffmpeg.h > +++ b/fftools/ffmpeg.h > @@ -536,7 +536,7 @@ typedef struct OutputStream { > int inputs_done; > > const char *attachment_filename; > - int seen_kf; > + int streamcopy_started; > int copy_initial_nonkeyframes; > int copy_prior_start; > char *disposition; fate-ffmpeg-setts-bsf, which depends on this code, still passes, so lgtm. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".