]> git.sesse.net Git - mlt/commitdiff
producer_avformat.c: bugfix segfault in unprotected libavcodec call that is clearly...
authorddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 17 Jun 2008 03:03:05 +0000 (03:03 +0000)
committerddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 17 Jun 2008 03:03:05 +0000 (03:03 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@1143 d19143bc-622f-0410-bfdd-b5b2a6649095

src/modules/avformat/producer_avformat.c

index c188b27cc481e184c2ddfc2bd3b63a7ca2281f82..f242b861ce4b55ec3ac35e35df54683592b0ad07 100644 (file)
@@ -723,6 +723,7 @@ static void producer_set_up_video( mlt_producer this, mlt_frame frame )
                        codec = avcodec_find_decoder( codec_context->codec_id );
 
                        // If we don't have a codec and we can't initialise it, we can't do much more...
+                       avformat_lock( );
                        if ( codec != NULL && avcodec_open( codec_context, codec ) >= 0 )
                        {
                                // Now store the codec with its destructor
@@ -733,6 +734,7 @@ static void producer_set_up_video( mlt_producer this, mlt_frame frame )
                                // Remember that we can't use this later
                                mlt_properties_set_int( properties, "video_index", -1 );
                        }
+                       avformat_unlock( );
                }
 
                // No codec, no show...
@@ -1060,6 +1062,7 @@ static void producer_set_up_audio( mlt_producer this, mlt_frame frame )
                        codec = avcodec_find_decoder( codec_context->codec_id );
 
                        // If we don't have a codec and we can't initialise it, we can't do much more...
+                       avformat_lock( );
                        if ( codec != NULL && avcodec_open( codec_context, codec ) >= 0 )
                        {
                                // Now store the codec with its destructor
@@ -1071,6 +1074,7 @@ static void producer_set_up_audio( mlt_producer this, mlt_frame frame )
                                // Remember that we can't use this later
                                mlt_properties_set_int( properties, "audio_index", -1 );
                        }
+                       avformat_unlock( );
                }
 
                // No codec, no show...