From patchwork Mon Mar 15 17:04:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 26403 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 DA0BB44B60C for ; Mon, 15 Mar 2021 19:27:58 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B344F68AEA7; Mon, 15 Mar 2021 19:27:58 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9E04A68AB96 for ; Mon, 15 Mar 2021 19:27:52 +0200 (EET) Received: by mail-wr1-f42.google.com with SMTP id v4so6098322wrp.13 for ; Mon, 15 Mar 2021 10:27:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Bnt54xAmiLFNcUgaUFPJrNMQMZdyBNm4e95Z6kKptCI=; b=NpmUv23ngnqw/Y6WUl+WKBJH9bgdzzFRjlnlhyPNsSQDUwIB56A8R1F1AypFuzoyZb 8D0c1BwO2CXQdVNPYC5FBC2VHdwBBZLnBch4CtkCtcaQC9nDQ0tXMtzhklCKbnFXiTti gavqNqdV4kCZx3RpM9rhEQWylt45qxFvl0pbel0njWlxwyaWLqtA8jnszjnKFw/kgdCJ jvk2+utu+SfTqAC/8JmKR0Mc0NnKUmKULFms0U4teK5rdaeYJ34CG+BY4072wMqNbKka hEKerOpqYavk222liY5JAPuB4d3OgIQSTLJ83VS237IVnXwtc88LAsLsfC2HOJYmVQj5 Ejwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Bnt54xAmiLFNcUgaUFPJrNMQMZdyBNm4e95Z6kKptCI=; b=Q8mTt31YHsmmLjxXOfKcMBcTwEXV3V8TOo+sZBGD+0ohesfWgfGxQqT6WSeJ8aK/3w FRMP5hLFAA0z2iwD2WgGyVf7smHrFFsUP/Y+NFJo0KAr8NXwcSfu8HrIFszsyEHR4Oya RtJiTsGLK+vTnevuQifhqn6Fxsc1CsyqIMtfvJGM5FkPSrEVpnU3WSwZY+PJjCCAAVob YN8MFLaUEVtOCmuMaWIHwxwMky5An3LWw+URDj9LB42YbS573HqGlsg3QQqDlmU9O6Hj 78aCKa8d0KxYEO4toqsc4Ctx/K0SVSWuL29n62gpceMUrL2pXgkVf+PmH07eUeGm3QF0 j4Jw== X-Gm-Message-State: AOAM531p8IPJPHfU/AJGH/xbdrpcHY9ZilxEjFRW1zHADRSjbvIh3qpk qh3dNv/0kGn5GPq4Gvn+4bt0H5ddswQ= X-Google-Smtp-Source: ABdhPJwDV4BRISsM8Vwdqe3I+LhvFSKv9Qv23EMvbAjfyVYZE6trkgh1cNCF73sBpwWhCklgMW8x2w== X-Received: by 2002:adf:f4ce:: with SMTP id h14mr590670wrp.257.1615827886885; Mon, 15 Mar 2021 10:04:46 -0700 (PDT) Received: from localhost.localdomain ([82.129.110.36]) by smtp.gmail.com with ESMTPSA id h25sm250506wml.32.2021.03.15.10.04.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Mar 2021 10:04:45 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Mar 2021 17:04:37 +0000 Message-Id: <20210315170437.605788-1-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/mov: Handle when we have an mfra box but have not read the full sidx for a fragment 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" Use the tfra timestamp if it is available and sidx timestamp is not. Fixes reading the entire file after seeking in a live-style DASH FMP4 with an MFRA. This specifically fixes when use_mfra_for is set. Signed-off-by: Derek Buitenhuis --- I could also put it behind an additional use_mfra_for option check if that is what people want. --- libavformat/mov.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index 23b0ead01e..97857789f4 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1279,6 +1279,10 @@ static int64_t get_frag_time(MOVFragmentIndex *frag_index, if (track_id >= 0) { frag_stream_info = get_frag_stream_info(frag_index, index, track_id); + if (frag_stream_info->sidx_pts != AV_NOPTS_VALUE) + return frag_stream_info->sidx_pts; + if (frag_stream_info->first_tfra_pts != AV_NOPTS_VALUE) + return frag_stream_info->first_tfra_pts; return frag_stream_info->sidx_pts; }