Correctly close all codecs, I think.
authorCarl Hetherington <cth@carlh.net>
Thu, 22 May 2014 14:07:31 +0000 (15:07 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 22 May 2014 14:07:31 +0000 (15:07 +0100)
src/lib/ffmpeg.cc

index 017960f2a26ef46de980c1622a912efa7bfa87af..ec7ec452e37683bfe374a16589d56c49377df562 100644 (file)
@@ -57,14 +57,10 @@ FFmpeg::~FFmpeg ()
        boost::mutex::scoped_lock lm (_mutex);
 
        for (uint32_t i = 0; i < _format_context->nb_streams; ++i) {
-               AVCodecContext* context = _format_context->streams[i]->codec;
-               if (context->codec_type == AVMEDIA_TYPE_VIDEO || context->codec_type == AVMEDIA_TYPE_AUDIO) {
-                       avcodec_close (context);
-               }
+               avcodec_close (_format_context->streams[i]->codec);
        }
 
        av_frame_free (&_frame);
-       
        avformat_close_input (&_format_context);
 }