From patchwork Mon Apr 5 17:45:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Robinson X-Patchwork-Id: 26765 Return-Path: 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 67B3A44AEB3 for ; Mon, 5 Apr 2021 20:46:29 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 44C3B689AD2; Mon, 5 Apr 2021 20:46:29 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from bender.codefive.co.uk (bender.codefive.co.uk [167.99.204.80]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 03E51687F2A for ; Mon, 5 Apr 2021 20:46:22 +0300 (EEST) Received: from titanium.codefive.co.uk (61.192.187.81.in-addr.arpa [81.187.192.61]) by bender.codefive.co.uk (Postfix) with ESMTPSA id A377ABD037; Mon, 5 Apr 2021 18:46:21 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=nerdoftheherd.com; s=mail; t=1617644781; bh=XyiF5ggwrGRW1mXEO//izwKXoY5R5ysbCqtSJdE/710=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version: Content-Transfer-Encoding:From:Subject:Date; b=KaJR12EpfDAHyhVYRuBHor8jNfVhhmXZdnyticfeM2oilIBLTRsxalar0DmXG08Qe gcxolvousGEeifGwMtQ2TQgg+AaGYVl+jFKN3wJ49b7JO4ECylgpqE3IZjfDZ37Sfo O1sFOBwl1VlDIcJVM9xyezZWc/JbHfcWzQDeEJddkMes+evcCNcAYnnhGLapXwyzIx ybajQXmqgZeqN58W0e6v3EN7ALMix/NwyCnzywJuKTPgt32XNpIONvSH8TvQLe4men wxgmnII1og2jkgXpfaXLavEU4OY5Jxe4zqltKDT9+hAsCO25PjxmQpFwDSffaCk7jQ 4Ro4xPAYzGXtA== From: Matt Robinson To: ffmpeg-devel@ffmpeg.org Date: Mon, 5 Apr 2021 18:45:04 +0100 Message-Id: <20210405174504.11477-1-git@nerdoftheherd.com> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/dashdec: Also fetch final partial segment 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 Cc: Matt Robinson Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Currently, the DASH demuxer omits the final segment for a non-live stream (using SegmentTemplate) if it is shorter than the other segments. Correct calc_max_seg_no to round up when calulating the number of segments instead of rounding down to resolve this issue. Signed-off-by: Matt Robinson --- libavformat/dashdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 6f3f28dcc7..73effd85db 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -1445,7 +1445,7 @@ static int64_t calc_max_seg_no(struct representation *pls, DASHContext *c) } else if (c->is_live && pls->fragment_duration) { num = pls->first_seq_no + (((get_current_time_in_sec() - c->availability_start_time)) * pls->fragment_timescale) / pls->fragment_duration; } else if (pls->fragment_duration) { - num = pls->first_seq_no + (c->media_presentation_duration * pls->fragment_timescale) / pls->fragment_duration; + num = pls->first_seq_no + av_rescale_rnd(1, c->media_presentation_duration * pls->fragment_timescale, pls->fragment_duration, AV_ROUND_UP); } return num;