From patchwork Thu Jun 24 12:58:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin LaFlamme X-Patchwork-Id: 28610 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2042:0:0:0:0 with SMTP id z2csp438211iod; Thu, 24 Jun 2021 05:58:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpBtL2zDRCsHaiFPsQsDwCFq7jb7Nbmee8y/X4fuzrApEgMqABarCk50C97sNq9i8iPIUB X-Received: by 2002:aa7:c9d8:: with SMTP id i24mr6980535edt.79.1624539520435; Thu, 24 Jun 2021 05:58:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624539520; cv=none; d=google.com; s=arc-20160816; b=dHis9jXSoiBI4Cctt8NuoeV/HJgRo/WAeyjbSqy8sOJtdPXk3EGUkoOSythGRviaVi dtdwDg7WooisFXElcNdv9++j7/LijqpOLjTBpw5JrgZ9zkjFmqeo9JBXs8Af9F319CQv WrdeEv+tIbXqc9ND5a22IXboZr8GUr9vUQRyfMYGGNDKsmS3mW+jUQ0xenZEQ9mpfu0/ O5OEhQu0J65aQ72ABSN6jXD39PlFt1XwEyDzOU9/LpJA5Fp/Kgp1uQ2idbUCF7wylwDl TfbXIwaTL3wr+S220+7GZwh/JRAOc7kjOToP4u+K3h+5DcNUThMJUbuo/0+mHkg1n06a 18oA== 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=AEDoT7xS7bCzOZvmLxWQmbcZkSa+UrTzIFKR5kcIzgs=; b=oRDMfvi212Ay8tZRN86P4r9HZJXTFXAyC52HqAyZDmD708JFwLJODidnnxrJnyufC7 RibVBBsPF06/+zMgYZ+zIoHyzl86gkg9TM7HnAP+b88xeRkbVmD9UbHgvuWO+Ihp63+g zMvlUm5LNhkNcXQH7o0I4DlIlHCXg26fzbQUHjemWKYPd78Suyf9R8DpNAxi8rtt1Dnf WVfVy6q2FePcAsNJ8L7Blnt2AuKd9L8fCqLXyFa0q7/l7xABzKAg6A2Lfy9yFkjzErBy nN1SweR5nSj/uyK/RHhEvgHnLtQ1jAtH1+/PnTZ4A1xmN5hiNa1f2MqJgO0eHYIkCktK Ziqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@aiera.com header.s=google header.b=a8zhOVFB; 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=NONE dis=NONE) header.from=aiera.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y8si2959504eda.170.2021.06.24.05.58.39; Thu, 24 Jun 2021 05:58:40 -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=@aiera.com header.s=google header.b=a8zhOVFB; 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=NONE dis=NONE) header.from=aiera.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3DA85687F13; Thu, 24 Jun 2021 15:58:36 +0300 (EEST) X-Original-To: FFmpeg-devel@ffmpeg.org Delivered-To: FFmpeg-devel@ffmpeg.org Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E4865687F13 for ; Thu, 24 Jun 2021 15:58:29 +0300 (EEST) Received: by mail-qt1-f170.google.com with SMTP id g3so390143qth.11 for ; Thu, 24 Jun 2021 05:58:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aiera.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sYVgc+8lAld/MFbdAugthpJc5OC0VTndN9PyDOYw9VY=; b=a8zhOVFBfAucQuevVsGeeymO79f5LYPZsJDn+25eUd7mC9suvq/F9tP9ujs2SgKbnV 5q+8Z4y5ZGU9McvczsIGcXAeIb/+eSwKo+9Y3NoztOeiUjl/M7jEBGul92j42cWajGJn OpZhNt3G6V0uiO1nJ1HYlXELlXvPc3NVRIbXs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sYVgc+8lAld/MFbdAugthpJc5OC0VTndN9PyDOYw9VY=; b=Oln1qnKmDDcbs8SYqwzJy9Fz7Wp8tWxVJZBvc1a3XjH08vu7vfefMynhamacrO9Kzn q4Uv5l3kyVmv9z2RLqgRC0//DMf8MztFwidwL1OFeCjFr8aKwobc5ZSfznVJPeR5CyBl T88PaXlnrmorP9/rJT86NBqIOylCRH34Fovax7IxFdt2yqKcMBpHPJcopi9d6zjKFTTX 0ouk6k6x4BLl+sqjnNeP8HhUkQ3wGYsQUcCcF87jzhsSnvIoV1q5ocU9x3+iSSpJwgXw UDCPqAY+jQJLlksNWtSMUJS31k7sANVirhkpM6IaoK5l+kdhH2qPgv+HgwBfDlbFNlWb o4Lw== X-Gm-Message-State: AOAM5314m5LeblpJCUhPkIWhAe5IY8bfhWS3qbMKzzYUBcOfXdDEX8ZT v/8XNQIq/9MY9TvT0eCTmZx0RPTG49rNYA== X-Received: by 2002:ac8:5c83:: with SMTP id r3mr4611367qta.78.1624539508161; Thu, 24 Jun 2021 05:58:28 -0700 (PDT) Received: from localhost.localdomain (pool-173-48-224-94.bstnma.fios.verizon.net. [173.48.224.94]) by smtp.gmail.com with ESMTPSA id d124sm2374067qkf.54.2021.06.24.05.58.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Jun 2021 05:58:27 -0700 (PDT) From: Kevin LaFlamme To: FFmpeg-devel@ffmpeg.org Date: Thu, 24 Jun 2021 08:58:07 -0400 Message-Id: <20210624125808.45663-1-kevin@aiera.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] Fix double write of DASH manifest in streaming mode 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: Kevin LaFlamme Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: /L7vZA4Ah/+H When streaming mode is enabled, the DASH manifest is written on the first packet for the segment so that the segment can be advertised immediately to clients. It was also still writing the manifest at the end of the segment leading to two duplicate writes. --- libavformat/dashenc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index e7a4a3d9e1..2b8fbcbe6e 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -2030,7 +2030,10 @@ static int dash_flush(AVFormatContext *s, int final, int stream) c->nr_of_streams_flushed = 0; } - ret = write_manifest(s, final); + // In streaming mode the manifest is written at the beginning + // of the segment instead + if (!c->streaming || final) + ret = write_manifest(s, final); } return ret; } @@ -2261,7 +2264,7 @@ static int dash_write_packet(AVFormatContext *s, AVPacket *pkt) // in streaming mode, the segments are available for playing // before fully written but the manifest is needed so that // clients and discover the segment filenames. - if (c->streaming && os->segment_type == SEGMENT_TYPE_MP4) { + if (c->streaming) { write_manifest(s, 0); } From patchwork Thu Jun 24 12:58:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin LaFlamme X-Patchwork-Id: 28609 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2042:0:0:0:0 with SMTP id z2csp438334iod; Thu, 24 Jun 2021 05:58:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqS5wxaWD35HFNAmjJZYQy2tnOVztWTVt5hvT/axuM6P6omdlukGwa+FQLL9jU5D0Tmoxf X-Received: by 2002:aa7:d851:: with SMTP id f17mr7024914eds.270.1624539530674; Thu, 24 Jun 2021 05:58:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624539530; cv=none; d=google.com; s=arc-20160816; b=UTXkgWDYM46PkM489YqL8RocOmXFtGCBkYA4r3wHWtf36hA/PUTCRdGod7aALol6Sa xMPKK+HaRvXpjhk2bMxqUHGTSkUZeBAAP1+342o0c/M8yqQMbNpgYDeAsbPeNM00x45L laSz/o9JO/ckDm8CirTTITP+A1ZJH8cgrSWTUxpMyxgaTC8BQjF7vZv3xZ/oZgynJSpw +nyZOg4gmDbhFcytTLEecop2tt8ypLVC6eDozu+hhcZ3H7Bu36nAFjn5LC9GQ0t6OAQE /8YdyNanxH2mF2Nyh/q6lwgOZQzn89k5DSKbnqe77Sqn4t+wBwePZorJs1/vFgHD+kWK b9+A== 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:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=FqUd0RuZdBjcDSqLhv8pg41ayRhvr3e8+zHQ3T7kB5U=; b=snOfHxuNCpJySz4eVsxbpmC1FoUQXqhSP7re+Ab+48slfnM++w/+Oh5XN29exYfcTo XGB1Az5HisJAzIS0rE7WGVP+kKJktSWMCUjNMSMihS6XrUyCaMbKdfVqCJfo75eRl/Eu h37BDCxuzFFuhOWYCWG7bkJ3QmdHNK1c445O1dEHxr3xZILDHsE2AGNIN1PaexCPuUQF VSujQwQPonNLVxnEFDRPh9nse5uHwZIC32vL2xIBHDosLMn7uB5S/jAjxTZauQ8F5G+E Fp7heEnmEnOEkbQ+i0YopxN9fQg019fIZf+ZIzEZL7RoOwq3C2zvdiqoypCrOysXIG4t UyDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@aiera.com header.s=google header.b=DWp9ERZL; 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=NONE dis=NONE) header.from=aiera.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id w5si2829589edr.23.2021.06.24.05.58.50; Thu, 24 Jun 2021 05:58:50 -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=@aiera.com header.s=google header.b=DWp9ERZL; 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=NONE dis=NONE) header.from=aiera.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5DEED68A13C; Thu, 24 Jun 2021 15:58:45 +0300 (EEST) X-Original-To: FFmpeg-devel@ffmpeg.org Delivered-To: FFmpeg-devel@ffmpeg.org Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E5F6168A107 for ; Thu, 24 Jun 2021 15:58:38 +0300 (EEST) Received: by mail-qt1-f173.google.com with SMTP id e3so4724148qte.0 for ; Thu, 24 Jun 2021 05:58:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aiera.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uvc7aBfrKV+uaGrcn18G5CmguyAkFikHblk2oLEfZkU=; b=DWp9ERZLUS9qtjNQkJJtq5T84IcTvRGWcz739Z0+PSBpogHHUL0+wtsICpOonwjGPp QgAQVf0TDo8xo9miaBtOQ9vnzrZ9kgmlLfDU9Hw8yVPNg/mQAqnfi88PYLJbTFPOAWUs SEth4RUi4yDnEcsFxexFGD54URKfec/gzr4bQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uvc7aBfrKV+uaGrcn18G5CmguyAkFikHblk2oLEfZkU=; b=um+u18LQnQjBELgpglB71C03K19SGzwVAbdxEO5nuBvET0DAjGbMEOo9d8w64Rjgic u6lZN+S2lRabrUVUAq1GP2H7Vt2QR6mTDWySTli+laIy2oGhAC5Mryrl0iFGuoz58KUG StiY6kAObZvJbjWCHhsicIEd6bESfVTQKjGKMdiIksmpOX+j0J53lUlgT0vhbL+fu3AS 0W6H2TEhgSx43WYTqNF+2oYpNFRtYmtz0I9D4bttJZ4bPhLg/X0pkMCUvMI4DC/jsVOq FNE2WGqMumfEF4p6IT580sapVtfQxpI50c235FvyXXCUvISz7+6XzOFmvD0DMw3LUjxr Zgig== X-Gm-Message-State: AOAM5317wHkftu3WP9JVvhXc7zc9g/woF3uRtJP0NuRAbnT38ZzAk+yo THW4oNzrz1iVGA3BFdwCWaDkauG+mGxLNw== X-Received: by 2002:ac8:5ed5:: with SMTP id s21mr4685774qtx.87.1624539517530; Thu, 24 Jun 2021 05:58:37 -0700 (PDT) Received: from localhost.localdomain (pool-173-48-224-94.bstnma.fios.verizon.net. [173.48.224.94]) by smtp.gmail.com with ESMTPSA id d124sm2374067qkf.54.2021.06.24.05.58.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Jun 2021 05:58:37 -0700 (PDT) From: Kevin LaFlamme To: FFmpeg-devel@ffmpeg.org Date: Thu, 24 Jun 2021 08:58:08 -0400 Message-Id: <20210624125808.45663-2-kevin@aiera.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210624125808.45663-1-kevin@aiera.com> References: <20210624125808.45663-1-kevin@aiera.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] Advertise current segment in streaming mode 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: Kevin LaFlamme Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 3TC7Cssfbfqe In streaming mode when using a segment list, the current segment should be listed so that clients can immediately request it even before complete. Without this, even though the segment is being written in a way that it can be requested while still writing, clients won't know it's available. --- libavformat/dashenc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 2b8fbcbe6e..901999324f 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -706,6 +706,8 @@ static void output_segment_list(OutputStream *os, AVIOContext *out, AVFormatCont Segment *seg = os->segments[i]; avio_printf(out, "\t\t\t\t\t\n", seg->file); } + if (c->streaming) + avio_printf(out, "\t\t\t\t\t\n", os->filename); avio_printf(out, "\t\t\t\t\n"); } if (!c->lhls || final) {