From patchwork Fri Oct 27 21:36:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Johansen X-Patchwork-Id: 44399 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dd83:b0:15d:8365:d4b8 with SMTP id kw3csp130467pzb; Fri, 27 Oct 2023 14:37:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF6hQoCCypN7YuECWqSg71zrPMeoaBzdTWiKkK4Y1jsHgodpKEk1w1SU4r1jpQLIrMRJrft X-Received: by 2002:a17:907:3dac:b0:9ad:eb9c:dd00 with SMTP id he44-20020a1709073dac00b009adeb9cdd00mr3288311ejc.12.1698442620341; Fri, 27 Oct 2023 14:37:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698442620; cv=none; d=google.com; s=arc-20160816; b=yH/oFJ3spy82cLGyuRKeukYGDhzAoNwU+iksYWU5SPrhzD3kbPa2kE3hyyfVKZaWYg Au+eTDWuvtxBS+WW+fyEs+Ckj9cKwqrPe9k/BhfM6n1oIjP/7bzt5IiTUgMsDZ1VGSdv 1Eb4ZrKY5rhzo/LBVTtyIHPP066Dduixvi+qdL1Kxqt8jvnJrhmM44lJcQqO6yOCtiZQ /0IGSYOSJhHII7w34VykKTRfsxeJbAlZfZ/ZJ2UTWT4EVtarjF0zhI0KXbIB987Uj0mO jhwOuJXFF/oL1eAJnWJ9Iyys4oq2wQAOANWRTfADnaEg9KvtPLJd/AtaA1YIXEkyhiS1 n7Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=2J0OH9Qn5rYFHbNO/iXU5gLczogPtOfKiIH5fJSsZY4=; fh=BNczk7MtTFTHa4uMdKY29AxmcfAa404kNGyDf0xbsP0=; b=t6xk4xjcJ1XK/VCu2FdFQ4jKSdRZf2qhJ5X7i/qbcqlslse51wrZHm7GqzhdBPP5wl +qWUikCAwuBSOfp/mNIyi23kXp/9yjyXfATElY5lqz8hijLCLuK8RC1Hg9thAk6QRYc6 sVy/fmbwZ4NIYU3Tpx11pdCgC1vNF2cHv1q0q91DvPgZktyjk+Go15K/jKAtSgRbm89m AW76V9P+4YypS0RmGjM+QJ6FCiPDXLgBEPw0quvwY9xm2Xr4hU2a18gsmyGd3nUTeO86 r7kMThHBx1u0ABSjpCr6dMaEoyu3w9u6ZgrZHVHU5dBfZhjcTOcOVB6O4kOO2osdkVHM bZlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=OJBTLyrW; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id wt13-20020a170906ee8d00b0098dd7716952si1109324ejb.527.2023.10.27.14.36.59; Fri, 27 Oct 2023 14:37:00 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=OJBTLyrW; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 895D168CA89; Sat, 28 Oct 2023 00:36:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1BE1868C987 for ; Sat, 28 Oct 2023 00:36:50 +0300 (EEST) Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1c9d3a21f7aso21828275ad.2 for ; Fri, 27 Oct 2023 14:36:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698442608; x=1699047408; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Ra0vv8mjkQPDGlUHSoWkF+ZodySYfOvbW3m4FhrYaSg=; b=OJBTLyrW8GaldJH0bydECelo3KV77ond29Ff8IuTW86CG4HhcuA3V6QhApIjGt+z88 QbifHJq9EVMwPmYId+Op/08JC0S+BgUWJzMUtx6IYKxIkYzBBTT74+UXjxAWRGq1nkZl 5hHoks3pawPcviOnmcUim9aJd/W+1D3ehCfdT++0QNVeke3sOTSccr/zMwIo4YiEDEAS OsKz2dTF+D/u50wmxB3SZz8C7Kffcou5+S3RNzXRmetNGhkNvhTOlQ7wrMPSswMEn5js GAMs+/1QOQfJ/w/7NOIv3QnGPKfS1KVHuu0wbqMW7n+Kc0eCxmRC4etjXjsv1yhvRJUu KBPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698442608; x=1699047408; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Ra0vv8mjkQPDGlUHSoWkF+ZodySYfOvbW3m4FhrYaSg=; b=WgPKpneAZ5/qm9ER4FUOeN5Ow08Oy3b9TpfWN7XaO+D41F3tIoKVtfTOVV+IsrB9S9 t77DNQTZTrPWvPJOc3umcJ0B+hbdXznoXl8rfUCQPuVLp4okeW+qI5t01woZs9BHyNfN /wo67AxCIWeXPSxsgTF/+5VSyu0/OoPWchyuxsoMIyWTCVoI6v/3gyOar7K4YjBgdueA pqYae/PN1w3qy082Ba7P5xOq4Bt2Nz/is9SOpBSE/xJuTLZxa9MmaOvQNjwh1mNNI9RI BoYY3H5IHtagpxOIBb9z5lJr4RFZcd2t681BhXnLflLCDWRopZp9tDiHUDg5rnPq+0Li 5JHw== X-Gm-Message-State: AOJu0YwmfoUfZmt/CVSzaSg4RZiiPoFWUtIwS6v+47utmnjGuuFZ/eVN ZZlq3Xb0zY0b4wVTz/MXPnXMztGEDR0PJQ== X-Received: by 2002:a17:903:1104:b0:1c9:bca2:d653 with SMTP id n4-20020a170903110400b001c9bca2d653mr4934399plh.11.1698442607727; Fri, 27 Oct 2023 14:36:47 -0700 (PDT) Received: from localhost.localdomain ([2605:a601:a98f:6200:38e9:cf78:99f0:f758]) by smtp.gmail.com with ESMTPSA id i11-20020a170902c94b00b001c3a8b135ebsm1990293pla.282.2023.10.27.14.36.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 14:36:47 -0700 (PDT) From: Dave Johansen To: ffmpeg-devel@ffmpeg.org Date: Fri, 27 Oct 2023 15:36:44 -0600 Message-Id: <20231027213644.48259-1-davejohansen@gmail.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/hlsenc: Move lrint outside of loop 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 Cc: Dave Johansen Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: /RVwCNXKRb9d --- libavformat/hlsenc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 4ef84c05c1..e59a38b497 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -1538,7 +1538,7 @@ static int hls_window(AVFormatContext *s, int last, VariantStream *vs) { HLSContext *hls = s->priv_data; HLSSegment *en; - int target_duration = 0; + double target_duration = 0; int ret = 0; char temp_filename[MAX_URL_SIZE]; char temp_vtt_filename[MAX_URL_SIZE]; @@ -1589,12 +1589,12 @@ static int hls_window(AVFormatContext *s, int last, VariantStream *vs) for (en = vs->segments; en; en = en->next) { if (target_duration <= en->duration) - target_duration = lrint(en->duration); + target_duration = en->duration; } vs->discontinuity_set = 0; ff_hls_write_playlist_header(byterange_mode ? hls->m3u8_out : vs->out, hls->version, hls->allowcache, - target_duration, sequence, hls->pl_type, hls->flags & HLS_I_FRAMES_ONLY); + lrint(target_duration), sequence, hls->pl_type, hls->flags & HLS_I_FRAMES_ONLY); if ((hls->flags & HLS_DISCONT_START) && sequence==hls->start_sequence && vs->discontinuity_set==0) { avio_printf(byterange_mode ? hls->m3u8_out : vs->out, "#EXT-X-DISCONTINUITY\n"); @@ -1643,7 +1643,7 @@ static int hls_window(AVFormatContext *s, int last, VariantStream *vs) goto fail; } ff_hls_write_playlist_header(hls->sub_m3u8_out, hls->version, hls->allowcache, - target_duration, sequence, PLAYLIST_TYPE_NONE, 0); + lrint(target_duration), sequence, PLAYLIST_TYPE_NONE, 0); for (en = vs->segments; en; en = en->next) { ret = ff_hls_write_file_entry(hls->sub_m3u8_out, 0, byterange_mode, en->duration, 0, en->size, en->pos,