diff mbox series

[FFmpeg-devel] avformat/mxfdec: disallow generic seek search

Message ID 20240826233330.14039-1-cus@passwd.hu
State New
Headers show
Series [FFmpeg-devel] avformat/mxfdec: disallow generic seek search | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Marton Balint Aug. 26, 2024, 11:33 p.m. UTC
If the demuxer does not provide per-stream indexes, the generic seek search can
attempt to read the whole media file from the beginning when seeking. For large
MXF files this can cause huge lockups for a seek after the last timestamp,
which will eventually fail. So let's disable the generic seek for mxf, the
demuxer's own seek code should handle seeking just fine.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavformat/mxfdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tomas Härdin Sept. 1, 2024, 9:06 p.m. UTC | #1
tis 2024-08-27 klockan 01:33 +0200 skrev Marton Balint:
> If the demuxer does not provide per-stream indexes, the generic seek
> search can
> attempt to read the whole media file from the beginning when seeking.
> For large
> MXF files this can cause huge lockups for a seek after the last
> timestamp,
> which will eventually fail. So let's disable the generic seek for
> mxf, the
> demuxer's own seek code should handle seeking just fine.

Sounds reasonable. We already go through the trouble of extracting all
index table segments

/Tomas
Marton Balint Sept. 2, 2024, 8:52 p.m. UTC | #2
On Sun, 1 Sep 2024, Tomas Härdin wrote:

> tis 2024-08-27 klockan 01:33 +0200 skrev Marton Balint:
>> If the demuxer does not provide per-stream indexes, the generic seek
>> search can
>> attempt to read the whole media file from the beginning when seeking.
>> For large
>> MXF files this can cause huge lockups for a seek after the last
>> timestamp,
>> which will eventually fail. So let's disable the generic seek for
>> mxf, the
>> demuxer's own seek code should handle seeking just fine.
>
> Sounds reasonable. We already go through the trouble of extracting all
> index table segments

Ok, will apply.

Thanks,
Marton

>
> /Tomas
> _______________________________________________
> 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".
>
diff mbox series

Patch

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index af0c8a3100..ac63c0d5ad 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -4274,7 +4274,7 @@  static const AVClass demuxer_class = {
 const FFInputFormat ff_mxf_demuxer = {
     .p.name         = "mxf",
     .p.long_name    = NULL_IF_CONFIG_SMALL("MXF (Material eXchange Format)"),
-    .p.flags        = AVFMT_SEEK_TO_PTS,
+    .p.flags        = AVFMT_SEEK_TO_PTS | AVFMT_NOGENSEARCH,
     .p.priv_class   = &demuxer_class,
     .priv_data_size = sizeof(MXFContext),
     .flags_internal = FF_INFMT_FLAG_INIT_CLEANUP,