[FFmpeg-devel] [PATCH] lavf/mov: fix hang while seek on a kind of fragmented mp4.

Michael Niedermayer michael at niedermayer.cc
Mon Feb 4 20:27:33 EET 2019

On Sat, Feb 02, 2019 at 05:03:25PM +0100, Marton Balint wrote:
> On Sat, 2 Feb 2019, Charles Liu wrote:
> >Binary searching would hang if the fragment items do NOT have timestamp for the specified stream.
> >
> >For example, a fmp4 consists of separated 'moof' boxes for each track, and separated 'sidx' for each segment, but no 'mfra' box.
> >Then every fragment item only have the timestamp for one of its tracks.
> I don't see why you are changing the search to be linear. Is it possible the
> some of the stream fragmens have NOPTS_VALUE but other don't? In this case
> you should keep the binary search and only fall back to linear search if
> binary search finds an AV_NOPTS_VALUE. See similar code in function
> mxf_absolute_bodysid_offset of libavformat/mxfdec.c.

The point of binary searching is to achieve O(log n) time
if there is any linear search this is no longer achieved.
So its not ideal to have any AV_NOPTS_VALUE in the array that is
searched. It would be better if the unknown entries are not in the
array that is used for the search or if their value is monotonized
once for all searches
that being ideal at least ...


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190204/fee77fb1/attachment.sig>

More information about the ffmpeg-devel mailing list