diff options
author | Sven Gothel <[email protected]> | 2018-01-12 01:53:01 +0100 |
---|---|---|
committer | Bradley Sepos <[email protected]> | 2018-05-28 23:56:19 -0400 |
commit | 5a52b9265c71296f676be899f7f8ef893e12f7bb (patch) | |
tree | 897c3192ad9bd1ef8d41d6a11a5fedbf03b34886 /libhb/encavcodec.c | |
parent | 2d6441de7700303e0ca1896bd0b6db0509ded3d2 (diff) |
FFMPEG: Use avcodec_free_context(..) instead of deprecated leaking avcodec_close(..)
Hence rename hb_avcodec_close -> hb_avcodec_free_context and pass the required ptr-ptr.
avcodec_free_context(..) ensures releasing of all resources attached to the context.
Diffstat (limited to 'libhb/encavcodec.c')
-rw-r--r-- | libhb/encavcodec.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libhb/encavcodec.c b/libhb/encavcodec.c index 01a1fc389..8484bba6a 100644 --- a/libhb/encavcodec.c +++ b/libhb/encavcodec.c @@ -399,12 +399,13 @@ void encavcodecClose( hb_work_object_t * w ) return; } hb_chapter_queue_close(&pv->chapter_queue); - if( pv->context && pv->context->codec ) + if( pv->context ) { hb_deep_log( 2, "encavcodec: closing libavcodec" ); - avcodec_flush_buffers( pv->context ); - hb_avcodec_close( pv->context ); - av_free( pv->context ); + if( pv->context->codec ) { + avcodec_flush_buffers( pv->context ); + } + hb_avcodec_free_context(&pv->context); } if( pv->file ) { |