From patchwork Fri Mar 26 21:48:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Robinson X-Patchwork-Id: 26622 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 2406E44B840 for ; Fri, 26 Mar 2021 23:48:58 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F220668A48F; Fri, 26 Mar 2021 23:48:57 +0200 (EET) 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 91C0A680A7C for ; Fri, 26 Mar 2021 23:48:51 +0200 (EET) 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 5CF1DBD034 for ; Fri, 26 Mar 2021 21:48:50 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=nerdoftheherd.com; s=mail; t=1616795330; bh=HHzVHrq/i6nPaMwCGf18iyWuPY3Qp7xX5s86EwIwTGs=; h=From:To:Subject:Date:Message-Id:MIME-Version: Content-Transfer-Encoding:From:Subject:Date; b=Nyz6ErbK+TxOmDmjvZCLfWBSFzENA4q0qlNRRUiX1zn7L6dBKHCG4tX/DCwGZjm5f pFRvol9rxOsO9i11edbYfzSCXO4rKgBhH9BTk+LORGdAHw8Qnk7o/1ui30l7L3J9LN gY/kKPsPlCOAqkuSFkqBQh4Kv4Kv28QS8stJahgbmo0Rjs4X9hQRhJLcS1Ou7PXkb3 BR2EJRMq6ctBsYwmOJKHgYuLgb+q9rmLG6faJdlR4ztpDO1/XjvAjfsLXSFHOJ2dwc WBOUCRuQxpTERwtnmBJUKt3DjQlmKaOgqsDyxxNLaaPOAXbpHO8fv/SPyTuzNiMIIo gwpccGwp9isSA== From: Matt Robinson To: ffmpeg-devel@ffmpeg.org Date: Fri, 26 Mar 2021 21:48:41 +0000 Message-Id: <20210326214841.89356-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 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;