| Message ID | 20190222195635.18530-1-jeebjp@gmail.com |
|---|---|
| State | New |
| Headers |
Return-Path: <ffmpeg-devel-bounces@ffmpeg.org> 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 7FECD447F35 for <patchwork@ffaux-bg.ffmpeg.org>; Fri, 22 Feb 2019 22:02:33 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5D153689D32; Fri, 22 Feb 2019 22:02:33 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C285F689C2E for <ffmpeg-devel@ffmpeg.org>; Fri, 22 Feb 2019 22:02:26 +0200 (EET) Received: by mail-lf1-f43.google.com with SMTP id q11so2651884lfd.3 for <ffmpeg-devel@ffmpeg.org>; Fri, 22 Feb 2019 12:02:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=yojgcKLJ5aO0OwkptQVPrtWzafoKcM1BZu7xhiNLck8=; b=K1Pw/+T5IMVLZEvlgOMJqeXMBkhZKm/Xxb6D4t0sewJx8aBQFwOMuEn+vNwswG2RWR Nqz7di2rLl7aYKVHleR4/zrMgCrHAEUrj9hRc8G5qZyXFtnuRAbfc/YBCx8OSD3gOPbw MWy3+oIfrdyn5Klpc8oPIf5bKbScoqyxVjRH4evhK6MlR4dEZLJBfmQYGx2e/soX2v6r cbryg2HuCpAytz4CbcwWVH8KrJMwTwy+jFI5m2PvGjaBYFxQYcnJDPi8tetBRHoeFVzQ 1fwBOh9BCt0f+RHUNIFrD8ZWS5KQZF0Qx6//rH3MX/RziJRWmw9W7AEkgibyMKZF207J UTsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=yojgcKLJ5aO0OwkptQVPrtWzafoKcM1BZu7xhiNLck8=; b=LIAyw1hD/CecaRyWK5ftsKz2kJQHg35UsKTeL6sQHAytfkpqXzltovokQ2BowWeM5y +I/O/yojQyA0whPBk9CuDHIr7T+4Fl+hg7ioach+5/ku9/Pn0HjqmjzFXOopp1/DUgfO z5dnqaunre6kFZPNNlSZrwLPGiouekfjzmPS3pexsO3xIgQz38LBPgZMu2gS3S923kpP IvEqVOQns3+8X3Uq09ZORQUt8qTQIsAle2OXbLiXP3uLKwQAc6DqPu6mDUkC13f42iQa 1+lnm9PesLgUXk0M4pPQNipMFgbqUfI5OuExLgYPtCISO901oWYByQYeK/enEMmbQUD3 gm6Q== X-Gm-Message-State: AHQUAuYwe4mM8cZ9ZITXwGkvZbCVl/hDFHMW1IsylAPuWQY03FaJQ9Zs qx+VXtDmg7zFSuO9+Bgzse18o2I5 X-Google-Smtp-Source: AHgI3IakJ50k6xPW58MdIiidzt3u3jsPygjjyMgwlBrKpYbk9aT7i2owriftrU3LjvufQlL+yVPTJw== X-Received: by 2002:a19:2d44:: with SMTP id t4mr3373435lft.90.1550865396669; Fri, 22 Feb 2019 11:56:36 -0800 (PST) Received: from localhost.localdomain (91-159-194-103.elisa-laajakaista.fi. [91.159.194.103]) by smtp.gmail.com with ESMTPSA id l72sm779503lfg.75.2019.02.22.11.56.35 for <ffmpeg-devel@ffmpeg.org> (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Feb 2019 11:56:35 -0800 (PST) From: =?UTF-8?q?Jan=20Ekstr=C3=B6m?= <jeebjp@gmail.com> To: ffmpeg-devel@ffmpeg.org Date: Fri, 22 Feb 2019 21:56:35 +0200 Message-Id: <20190222195635.18530-1-jeebjp@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] ffmpeg_filter: switch sub2video.end_pts initialization value to 0 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org> List-Unsubscribe: <http://ffmpeg.org/mailman/options/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe> List-Archive: <http://ffmpeg.org/pipermail/ffmpeg-devel/> List-Post: <mailto:ffmpeg-devel@ffmpeg.org> List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help> List-Subscribe: <http://ffmpeg.org/mailman/listinfo/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe> Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org> |
Commit Message
Jan Ekström
Feb. 22, 2019, 7:56 p.m. UTC
This seems to fix use cases where the sub2video output is the only input to a filter chain. Additionally, this is the value to which the structure's values would implicitly get initialized to. The ballooning buffering case would not get hit by this as the value of end_pts after (re-)initialization would be less than INT64_MAX, thus hitting the sub2video AVFrame initialization logic via sub2video_update in sub2video_heartbeat. --- fftools/ffmpeg_filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Fri, Feb 22, 2019 at 9:56 PM Jan Ekström <jeebjp@gmail.com> wrote: > > This seems to fix use cases where the sub2video output is the only > input to a filter chain. > > Additionally, this is the value to which the structure's values > would implicitly get initialized to. The ballooning buffering case > would not get hit by this as the value of end_pts after > (re-)initialization would be less than INT64_MAX, thus hitting the > sub2video AVFrame initialization logic via sub2video_update in > sub2video_heartbeat. > --- > fftools/ffmpeg_filter.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c > index 72838de1e2..536f9c9c46 100644 > --- a/fftools/ffmpeg_filter.c > +++ b/fftools/ffmpeg_filter.c > @@ -739,7 +739,7 @@ static int sub2video_prepare(InputStream *ist, InputFilter *ifilter) > if (!ist->sub2video.frame) > return AVERROR(ENOMEM); > ist->sub2video.last_pts = INT64_MIN; > - ist->sub2video.end_pts = INT64_MIN; > + ist->sub2video.end_pts = 0; > return 0; > } > > -- > 2.20.1 > An alternative for this would be to: 1. add a flag to sub2video structure that timestamp initialization is required, and set it as required during (re-)initializations. 2. pass heartbeat pts to sub2video_update 3. finally, in sub2video_update } else { pts = !ist->sub2video.timestamp_initialized ? heartbeat_pts : ist->sub2video.end_pts; end_pts = INT64_MAX; num_rects = 0; } and ist->sub2video.timestamp_initialized = 1; at the end. This way the sub2video logic would start with the first heartbeat's timestamp (often zero, but not always), as opposed to the initial value of end_pts. Jan
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 72838de1e2..536f9c9c46 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -739,7 +739,7 @@ static int sub2video_prepare(InputStream *ist, InputFilter *ifilter) if (!ist->sub2video.frame) return AVERROR(ENOMEM); ist->sub2video.last_pts = INT64_MIN; - ist->sub2video.end_pts = INT64_MIN; + ist->sub2video.end_pts = 0; return 0; }