From patchwork Thu Feb 15 00:54:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 7600 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.150.1 with SMTP id c1csp1475076jai; Wed, 14 Feb 2018 16:54:29 -0800 (PST) X-Google-Smtp-Source: AH8x226l9KVjmp9s03oQuMg92WVgmb/zHrA60b6GTKLSpLny3XpuCNkJUyxde72ZYZMuKz3PH2rT X-Received: by 10.28.184.131 with SMTP id i125mr689184wmf.44.1518656068995; Wed, 14 Feb 2018 16:54:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518656068; cv=none; d=google.com; s=arc-20160816; b=MCH6NBRblnhkaXElDaNOljbaNfMIXqkBE2v3zsf1q3DnIOJQELyNS4S29/r5L0G+gF 6B94dSeXbSOT4qBF2kRuEa7XtdXHi7B48sD+vMveSpbBYotnRYExpv5T57erStrWxUDO G2SwcuKLuJW3lH1QX+Lm8YkvZ3tYI/L3nWEVt5nroBeM4qzllnJZPztGZ9S8ipRKAl/K 5pZHipRGFpwkZ0UBvylXIalJeALw1i/AhvREbihMgDzSGhyKd9fSqd9l1uJSseGcPyVr dSVgunGV0DVXqrvgUfVeBBy+F1Q80qXIJBMLXZBSwUcCIHDSrrMmxeWkCcnHma7Ej6fQ woJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:user-agent :in-reply-to:mime-version:references:message-id:to:from:date :delivered-to:arc-authentication-results; bh=RpO9tOCEOpMANGrhufeSnhT8RBibdckZElZIUmSSLmc=; b=xrLg+MAQ3boi1MmVJcjn+U2WsbtGs7/w6VizLYVEucUsINId8RVgt2KZBfnVhKQhea dv8FYOpuqREHM6JELpbBghjljJsA3AzP02bJoFRSd48tq8ihlXaAV8Oh88kQP0U5yPTy QL7tuHJ/Qeo1+SYIJgZ1ark0e1vccQzvy6lnXnB7ohFRGLon2ganSW59jNbMJHThLWUR y88MkcsidgVUa3o8wGB1NDcYpaoQTfst6/nmIO6n5CgffwP9e8Fk4llxVsABdWRlafir 0RcUSALSAA2R3Gq6lAwFKYSZhD29FXOkAr1KApEkoCTrNtMp2woTLJcJvJXLO7hwdvpC P4MQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id u35si3387452wrf.463.2018.02.14.16.54.27; Wed, 14 Feb 2018 16:54:28 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4F2D068A1BC; Thu, 15 Feb 2018 02:54:14 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BA047689CB8 for ; Thu, 15 Feb 2018 02:54:07 +0200 (EET) X-Originating-IP: 213.47.41.20 Received: from localhost (213-47-41-20.cable.dynamic.surfer.at [213.47.41.20]) (Authenticated sender: michael@niedermayer.cc) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 7225017209F for ; Thu, 15 Feb 2018 01:54:18 +0100 (CET) Date: Thu, 15 Feb 2018 01:54:17 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20180215005417.GH23018@michaelspb> References: <20180214141142.GA25160@pluto.informatik.privat> MIME-Version: 1.0 In-Reply-To: <20180214141142.GA25160@pluto.informatik.privat> User-Agent: Mutt/1.5.24 (2015-08-30) Subject: Re: [FFmpeg-devel] [PATCH v2] avformat/pcm: decrease delay when reading PCM streams. 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" On Wed, Feb 14, 2018 at 03:11:54PM +0100, Philipp M. Scholl wrote: > Hi there, > > thanks for the feedback. I made the following changes to the patch: > > - hard-code to 40ms delay. Wasn't really sure what a good value is. But given > that the is mainly for encoding low-rate sensor data in audio streams, > together with a video recording, 40ms should be fine in most cases. > > - fix issue when sample rate is smaller (<100, now 25). > > - use ff_log2 for calculating a power of two read size. A power of two to make > efficient use of I/O buffers. > > - remove the superfluous check for multiple input streams. PCM decoders are > always single-streams, right?! > > - remove cosmetic changes, and remove readsize hunk :) > > any comments? > > cheers, > -phil > > The blocksize of the PCM decoder is hard-coded. This creates > unnecessary delay when reading low-rate (<100Hz) streams. This creates > issues when multiplexing multiple streams, since other inputs are only > opened/read after a low-rate input block was completely read. > > This patch decreases the blocksize for low-rate inputs, so > approximately a block is read every 40ms. This decreases the startup > delay when multiplexing inputs with different rates. > > Signed-off-by: Philipp M. Scholl > --- > libavformat/pcm.c | 14 ++++++++--- > tests/ref/seek/acodec-pcm-f32be | 54 ++++++++++++++++++++--------------------- > tests/ref/seek/acodec-pcm-f64be | 54 ++++++++++++++++++++--------------------- > tests/ref/seek/lavf-alaw | 44 ++++++++++++++++----------------- > tests/ref/seek/lavf-au | 30 +++++++++++------------ > tests/ref/seek/lavf-mov | 44 ++++++++++++++++----------------- > tests/ref/seek/lavf-mulaw | 44 ++++++++++++++++----------------- > tests/ref/seek/lavf-voc | 22 ++++++++--------- > 8 files changed, 157 insertions(+), 149 deletions(-) breaks fate [...] > --- a/tests/ref/seek/lavf-alaw > +++ b/tests/ref/seek/lavf-alaw > @@ -1,53 +1,53 @@ > -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 1024 > +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 128 > ret: 0 st:-1 flags:0 ts:-1.000000 > -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 1024 > +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 128 > ret: 0 st:-1 flags:1 ts: 1.894167 > -ret: 0 st: 0 flags:1 dts: 1.894150 pts: 1.894150 pos: 41766 size: 1024 > +ret: 0 st: 0 flags:1 dts: 1.894150 pts: 1.894150 pos: 41766 size: 128 > ret: 0 st: 0 flags:0 ts: 0.788345 > -ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 17383 size: 1024 > +ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 17383 size: 128 > ret: 0 st: 0 flags:1 ts:-0.317506 > -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 1024 > +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 128 > ret: 0 st:-1 flags:0 ts: 2.576668 > ret:-EOF --- ./tests/ref/seek/lavf-alaw 2018-02-15 01:43:47.387759133 +0100 +++ tests/data/fate/seek-lavf-alaw 2018-02-15 01:49:09.979762980 +0100 @@ -1,53 +1,53 @@ -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 128 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 512 ret: 0 st:-1 flags:0 ts:-1.000000 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 128 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 512 ret: 0 st:-1 flags:1 ts: 1.894167 -ret: 0 st: 0 flags:1 dts: 1.894150 pts: 1.894150 pos: 41766 size: 128 +ret: 0 st: 0 flags:1 dts: 1.894150 pts: 1.894150 pos: 41766 size: 512 ret: 0 st: 0 flags:0 ts: 0.788345 -ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 17383 size: 128 +ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 17383 size: 512 ret: 0 st: 0 flags:1 ts:-0.317506 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 128 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 512 ret: 0 st:-1 flags:0 ts: 2.576668 ret:-EOF [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Opposition brings concord. Out of discord comes the fairest harmony. -- Heraclitus