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:
@@ -327,7 +327,8 @@ AVFormatWriter::~AVFormatWriter()
|
|||||||
for(unsigned i = 0; i < fContext->nb_streams; i++) {
|
for(unsigned i = 0; i < fContext->nb_streams; i++) {
|
||||||
#if OPEN_CODEC_CONTEXT
|
#if OPEN_CODEC_CONTEXT
|
||||||
// We only need to close the AVCodecContext when we opened it.
|
// We only need to close the AVCodecContext when we opened it.
|
||||||
// This is experimental, see WriteHeader().
|
// This is experimental, see CommitHeader().
|
||||||
|
if (fHeaderWritten)
|
||||||
avcodec_close(fContext->streams[i]->codec);
|
avcodec_close(fContext->streams[i]->codec);
|
||||||
#endif
|
#endif
|
||||||
av_freep(&fContext->streams[i]->codec);
|
av_freep(&fContext->streams[i]->codec);
|
||||||
|
|||||||
Reference in New Issue
Block a user