From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 4D82849A5E for ; Mon, 26 Feb 2024 21:53:04 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 029DD68C8B3; Mon, 26 Feb 2024 23:53:02 +0200 (EET) Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2523A68C58B for ; Mon, 26 Feb 2024 23:52:55 +0200 (EET) Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-6e54451edc6so397434b3a.1 for ; Mon, 26 Feb 2024 13:52:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708984372; x=1709589172; darn=ffmpeg.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=UEbAl2oOxnJ1bXSTcbUWdiIpIsX1G1FkVgCAQk1Y/zY=; b=K5vrsiyjWuU0gjz9urgcU9bFuPk2/WKBqImi+83zGwRH6lL+h1A7PLp1gy5yjn5CU1 5KYz4p1q2YfWeusPNSKz796xO+olc9et4ns6bPqONvwacSCujIup8xrHMxgOq7mEOXPa 3cARtnqF0PjrfVYT3y1V7iYxnKfa+Rb4dx0dzjxhsV2Z3WDgSzkodqaqe4WK3r9eM+Ok FEuVL3VHjfOP0oJlKHCNAwTr975CY69iEqBU/G4G40BrEto1jmfrhIQsHcqxT8YY9Db8 fyipsKpe6BStaq6ngAYQm8tO2mXQN356En3YvOfzIjX2OylAG1Z1uAIP3M+7yMof08ml FYdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708984372; x=1709589172; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UEbAl2oOxnJ1bXSTcbUWdiIpIsX1G1FkVgCAQk1Y/zY=; b=WDQKLMxQg0J+Hkr9l+0hp20nh63FfV99w6pSIeYOSq6QwtGOWMMa7xntO1IqRej/MJ zmUo0F2Nb069JyfDHktO776wV1svu2kmnA0UF9pZIEeYqwMI4Ua5t1SNra04epGTubqo dAHnox0x7wIVTFVE3Tk8HGe2hDNDka5ILe+9USHT4QYke9emKN9/wss4hOw5zxy0Aj2b y6jOXpYxOHvCsMnoevYRcbsSxiA5wBt6OtlIDGFzjx5YHv4E5lO0ZKVj0ErKIFPi7W8B OkVBpA/RSv4lqhd6/A9vFBUBrKfIUwDANenClYwYaVSvYEfmTHHsX/fUHLnMu0tglTLN DP0A== X-Gm-Message-State: AOJu0Yz/cj+a9QgJIDZWR/zoIja551MUCHPdFKTVhECPLL90r9R0dqge seusNc1cyASWD1DfVjo/iHjYSWT8IMkIXA4gXZIaN+r+BFwK3daDObCZqqe8 X-Google-Smtp-Source: AGHT+IHawP4pkbI7AoeaGcPVxOGhChzpIXnUJe+LWfyoML5D1pJJGNEZmN4zPDtwPq+zCYhEcxgm/g== X-Received: by 2002:a62:e407:0:b0:6e4:c85a:4bc8 with SMTP id r7-20020a62e407000000b006e4c85a4bc8mr9064519pfh.5.1708984371880; Mon, 26 Feb 2024 13:52:51 -0800 (PST) Received: from [192.168.1.107] ([103.194.70.164]) by smtp.gmail.com with ESMTPSA id r13-20020aa7988d000000b006e27558af8esm4478553pfl.76.2024.02.26.13.52.50 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Feb 2024 13:52:51 -0800 (PST) Message-ID: <9a46bc13-bb1d-4d59-a0dc-a1e29209b3dc@gmail.com> Date: Tue, 27 Feb 2024 03:22:46 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: ffmpeg-devel@ffmpeg.org References: <20230923111034.6320-2-llyyr.public@gmail.com> Content-Language: en-US From: llyyr In-Reply-To: <20230923111034.6320-2-llyyr.public@gmail.com> Subject: Re: [FFmpeg-devel] [PATCH] avformat/mov: avoid seeking back to 0 on HEVC open GOP files 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 9/23/23 16:40, llyyr wrote: > ab77b878f1 attempted to fix the issue of broken packets being sent to > the decoder by implementing logic that kept attempting to PTS-step > backwards until it reached a valid point, however applying this > heuristic meant that in files that had no valid points (such as HEVC > videos shot on iPhones), we'd seek back to sample 0 on every seek > attempt. This meant that files that were previously seekable, albeit > with some skipped frames, were not seekable at all now. > > Relax this heuristic a bit by giving up on seeking to a valid point if > we've tried a different sample and we still don't have a valid point to > seek to. This may some frames to be skipped on seeking but it's better > than not being able to seek at all in such files. > > Fixes: ab77b878f1 ("avformat/mov: fix seeking with HEVC open GOP files") > --- > libavformat/mov.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git a/libavformat/mov.c b/libavformat/mov.c > index 1996e0028c..60a4d581d9 100644 > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -9108,7 +9108,7 @@ static int mov_seek_stream(AVFormatContext *s, AVStream *st, int64_t timestamp, > { > MOVStreamContext *sc = st->priv_data; > FFStream *const sti = ffstream(st); > - int sample, time_sample, ret; > + int sample, time_sample, ret, next_ts, requested_sample; > unsigned int i; > > // Here we consider timestamp to be PTS, hence try to offset it so that we > @@ -9129,7 +9129,17 @@ static int mov_seek_stream(AVFormatContext *s, AVStream *st, int64_t timestamp, > > if (!sample || can_seek_to_key_sample(st, sample, timestamp)) > break; > - timestamp -= FFMAX(sc->min_sample_duration, 1); > + > + next_ts = timestamp - FFMAX(sc->min_sample_duration, 1); > + requested_sample = av_index_search_timestamp(st, next_ts, flags); > + > + // If we can't seek to the next pts either and it's a different sample, > + // give up trying to find a good pts to seek to, otherwise we'll end up > + // seeking back to sample 0 on every seek. > + if (!can_seek_to_key_sample(st, requested_sample, next_ts) && sample != requested_sample) > + break; > + > + timestamp = next_ts; > } > > mov_current_sample_set(sc, sample); Pinging this as it seems to have been missed. The patch still applies on current master and the issue also still exists. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".