#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, 21 months 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, 21 months ago

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

I'm not sure what constitutes a valid ticket if actual code and specific exact details about it and how to recreate the issue don't. Personally if someone took the time to log a bug report like this for my project i'd be pretty happy with it.

Last edited 21 months ago by sporn (previous) (diff)

comment:3 by mkver, 21 months 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, 20 months ago

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