]> git.sesse.net Git - mlt/commitdiff
Fix some unprotected calls to av_close_input_file.
authorDan Dennedy <dan@dennedy.org>
Thu, 29 Sep 2011 19:42:02 +0000 (12:42 -0700)
committerDan Dennedy <dan@dennedy.org>
Thu, 29 Sep 2011 19:42:02 +0000 (12:42 -0700)
src/modules/avformat/producer_avformat.c

index 58fb87cef04e16cb5e53f3340b3df9312d7ed2fd..2287301cd3c182bc8facc0fd4c8bc04f8a180eca 100644 (file)
@@ -842,7 +842,9 @@ static int producer_open( producer_avformat self, mlt_profile profile, const cha
 
        if ( self->dummy_context )
        {
+               avformat_lock();
                av_close_input_file( self->dummy_context );
+               avformat_unlock();
                self->dummy_context = NULL;
        }
 
@@ -863,12 +865,9 @@ static void reopen_video( producer_avformat self, mlt_producer producer )
        mlt_service_lock( MLT_PRODUCER_SERVICE( producer ) );
        pthread_mutex_lock( &self->audio_mutex );
 
+       avformat_lock();
        if ( self->video_codec )
-       {
-               avformat_lock();
                avcodec_close( self->video_codec );
-               avformat_unlock();
-       }
        self->video_codec = NULL;
        if ( self->dummy_context )
                av_close_input_file( self->dummy_context );
@@ -876,6 +875,7 @@ static void reopen_video( producer_avformat self, mlt_producer producer )
        if ( self->video_format )
                av_close_input_file( self->video_format );
        self->video_format = NULL;
+       avformat_unlock();
 
        int audio_index = self->audio_index;
        int video_index = self->video_index;