diff mbox series

[FFmpeg-devel] Allow using only the mfra info for seeking using the fragment index

Message ID 20201004142841.179499-1-derek.buitenhuis@gmail.com
State Accepted
Commit 2be3eb7f77a3b6433016f5691ed504f99e0377da
Headers show
Series [FFmpeg-devel] Allow using only the mfra info for seeking using the fragment index | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Derek Buitenhuis Oct. 4, 2020, 2:28 p.m. UTC
From: Justin Ruggles <justin.ruggles@gmail.com>

The mfra has enough information to enable seeking, and reading it is
behind an AVOption flag, so we shouldn't require that sidx information
also be present in order to seek using the fragment index.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
---
This is especially important want I/O is networked, since otherwise it will
read essentially the entire file by seeking to every sidx in the file, which
for a live-style FMP4 can be a *lot*.

Dale Curtis is CC'd, as this is probably highly relevant to him.

Note: If a global sidx is present, that information will override the mfra, but
if sidx are before each moof, those will no longer be parsed in mov_read_header
if you set use_mfra_for, which can result in a wrong duration since mfra isn't
used for setting duration while sidx is.
---
 libavformat/mov.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Derek Buitenhuis Oct. 7, 2020, 3:44 p.m. UTC | #1
On 04/10/2020 15:28, Derek Buitenhuis wrote:
> From: Justin Ruggles <justin.ruggles@gmail.com>
> 
> The mfra has enough information to enable seeking, and reading it is
> behind an AVOption flag, so we shouldn't require that sidx information
> also be present in order to seek using the fragment index.
> 
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
> ---
> This is especially important want I/O is networked, since otherwise it will
> read essentially the entire file by seeking to every sidx in the file, which
> for a live-style FMP4 can be a *lot*.
> 
> Dale Curtis is CC'd, as this is probably highly relevant to him.
> 
> Note: If a global sidx is present, that information will override the mfra, but
> if sidx are before each moof, those will no longer be parsed in mov_read_header
> if you set use_mfra_for, which can result in a wrong duration since mfra isn't
> used for setting duration while sidx is.
> ---
>  libavformat/mov.c | 1 +
>  1 file changed, 1 insertion(+)

Ping.

- Derek
Derek Buitenhuis Oct. 8, 2020, 10:26 a.m. UTC | #2
On 07/10/2020 16:44, Derek Buitenhuis wrote:
>> The mfra has enough information to enable seeking, and reading it is
>> behind an AVOption flag, so we shouldn't require that sidx information
>> also be present in order to seek using the fragment index.
>>
>> Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
>> ---
>> This is especially important want I/O is networked, since otherwise it will
>> read essentially the entire file by seeking to every sidx in the file, which
>> for a live-style FMP4 can be a *lot*.
>>
>> Dale Curtis is CC'd, as this is probably highly relevant to him.
>>
>> Note: If a global sidx is present, that information will override the mfra, but
>> if sidx are before each moof, those will no longer be parsed in mov_read_header
>> if you set use_mfra_for, which can result in a wrong duration since mfra isn't
>> used for setting duration while sidx is.
>> ---
>>  libavformat/mov.c | 1 +
>>  1 file changed, 1 insertion(+)
> 
> Ping.

Will push late today, or tomorrow, if nobody objects.

- Derek
Derek Buitenhuis Oct. 11, 2020, 11:37 a.m. UTC | #3
On 08/10/2020 11:26, Derek Buitenhuis wrote:
>> Ping.
> 
> Will push late today, or tomorrow, if nobody objects.

Pushed.

- Derek
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 4f64e96bc0..7fd43a8fc5 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -7529,6 +7529,7 @@  static int mov_read_mfra(MOVContext *c, AVIOContext *f)
             goto fail;
     } while (!ret);
     ret = 0;
+    c->frag_index.complete = 1;
 fail:
     seek_ret = avio_seek(f, original_pos, SEEK_SET);
     if (seek_ret < 0) {