From patchwork Mon Mar 29 19:33:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Robinson X-Patchwork-Id: 26643 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 ED55344B46C for ; Mon, 29 Mar 2021 22:33:45 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B9E856806F5; Mon, 29 Mar 2021 22:33:45 +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 2260D68041C for ; Mon, 29 Mar 2021 22:33:38 +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 5121CBD035 for ; Mon, 29 Mar 2021 20:33:38 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=nerdoftheherd.com; s=mail; t=1617046418; bh=HHzVHrq/i6nPaMwCGf18iyWuPY3Qp7xX5s86EwIwTGs=; h=From:To:Subject:Date:Message-Id:MIME-Version: Content-Transfer-Encoding:From:Subject:Date; b=gFOeD/o7+khWXTkYA66KBpwQjv98vdLNMZegh2NUQPEVBExzsLlHpDJJwlB+CmSkn RnGfTkcjP5UdmGT7o6hy0s5tTfwv8T5YByE9O9klYOrhhL8FEhNoIZX0j5oz7ddDER +k9MeMOOLswSRN4Mh2gZ2788MjuVSCNoFz+m2Ex5IVTy+EH0UJxwSGqDQI3+9/ZuFk eOEnPBBtIC1XPWPWNiybbYvYCxR+RwU4d/yJ1oJmVu7zNvbYF1O9e0anT3pXWSjk+E g9ufaT6O5CrgR8a0XQfWBJ4ZKRlpTbMeMfbi1CjwvlmQXA27iaIuxVs2AP94YLs/nu ZbYd6c96qi+JA== From: Matt Robinson To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Mar 2021 20:33:12 +0100 Message-Id: <20210329193312.5623-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;