Opened 2 years ago

Closed 2 years ago

#9871 closed defect (needs_more_info)

AccessViolationException setting seekable = 1

Reported by: sporn Owned by:
Priority: normal Component: avformat
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
How to reproduce:

            var outputFormat = av_guess_format("mp4", @"D:\test.mp4", null);
            var formatContext = avformat_alloc_context();
            formatContext->oformat = outputFormat;
            var videoStream = avformat_new_stream(formatContext, null);
            var videoCodec = avcodec_find_encoder(AVCodecID.AV_CODEC_ID_H264);
            var videoCodecContext = avcodec_alloc_context3(videoCodec);
            avcodec_open2(videoCodecContext, videoCodec, null);
            avio_open(&formatContext->pb, @"D:\test.mp4", AVIO_FLAG_WRITE);
            formatContext->pb->seekable = 1;
            avformat_write_header(formatContext, null);
            avio_close(formatContext->pb);

setting formatContext->pb->seekable = 1 is throwing an access violation exception when calling avio_close.
comment out that line and avio_close works fine.

Change History (4)

comment:1 by Carl Eugen Hoyos, 2 years ago

This has currently no similarities with a valid ticket, isn't this a question for the libav-user mailing list?

comment:2 by sporn, 2 years ago

Sure, i'll post it there instead, although, not particularly confident of a response.

Version 0, edited 2 years ago by sporn (next)

comment:3 by mkver, 2 years ago

I can't reproduce this (after converting the snippet into C). You will have to provide more details to allow us to reproduce this. A stacktrace would also be nice.

Nevertheless, here are some comments: First of all, an AVIOContext created as above will already be seekable (after all, you are just writing an ordinary file). Second, seekable is not a boolean, but a bitfield, so the likely intended value is AVIO_SEEKABLE_NORMAL (which happens to be 1). 3. Using avio_close() is generally dangerous, because it frees the memory, but leaves a dangling pointer behind. Better use avio_closep(). Finally, the videoCodecContext in your example is unused.

comment:4 by Carl Eugen Hoyos, 2 years ago

Resolution: needs_more_info
Status: newclosed
Note: See TracTickets for help on using tickets.