Skip to content

Commit 673acf2

Browse files
author
Clement Champetier
committed
ICodec: fixed how to close the AVCodecContext if it's allocated outside
1 parent 3f96a67 commit 673acf2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/AvTranscoder/codec/ICodec.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@ ICodec::ICodec( const ECodecType type, AVCodecContext& avCodecContext )
4343

4444
ICodec::~ICodec()
4545
{
46-
if( ! _isCodecContextAllocated )
47-
return;
46+
avcodec_close(_avCodecContext);
47+
48+
if(!_isCodecContextAllocated)
49+
return;
4850

49-
avcodec_close( _avCodecContext );
50-
av_free( _avCodecContext );
51-
_avCodecContext = NULL;
51+
av_free(_avCodecContext);
52+
_avCodecContext = NULL;
5253
}
5354

5455
void ICodec::openCodec()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy