Don't call avcodec_close() on an unopened codec, as that causes a crash.
Happens for example when you create a BMediaFile and close it without committing the header git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33845 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
315c212bfd
commit
fac8f83095
@ -327,8 +327,9 @@ AVFormatWriter::~AVFormatWriter()
|
||||
for(unsigned i = 0; i < fContext->nb_streams; i++) {
|
||||
#if OPEN_CODEC_CONTEXT
|
||||
// We only need to close the AVCodecContext when we opened it.
|
||||
// This is experimental, see WriteHeader().
|
||||
avcodec_close(fContext->streams[i]->codec);
|
||||
// This is experimental, see CommitHeader().
|
||||
if (fHeaderWritten)
|
||||
avcodec_close(fContext->streams[i]->codec);
|
||||
#endif
|
||||
av_freep(&fContext->streams[i]->codec);
|
||||
av_freep(&fContext->streams[i]);
|
||||
|
Loading…
Reference in New Issue
Block a user