segv handler, playlist_move bugfix, resize_yuv422 optimisation
authorddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 11 Feb 2004 17:58:13 +0000 (17:58 +0000)
committerddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 11 Feb 2004 17:58:13 +0000 (17:58 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@136 d19143bc-622f-0410-bfdd-b5b2a6649095

src/framework/mlt_frame.c
src/framework/mlt_playlist.c
src/miracle/miracle_local.c
src/valerie/valerie_notifier.c

index 314facd..2fef7c0 100644 (file)
@@ -416,6 +416,10 @@ void mlt_resize_yuv422( uint8_t *output, int owidth, int oheight, uint8_t *input
        iheight = iheight - ( iheight % 2 );
        oheight = oheight - ( oheight % 2 );
 
+       // Optimisation point
+       if ( iwidth == owidth && iheight == oheight )
+               memcpy( output, input, iheight * istride );
+
        // Coordinates (0,0 is middle of output)
        int y;
 
index 4b02210..928c76d 100644 (file)
@@ -549,18 +549,17 @@ int mlt_playlist_move( mlt_playlist this, int src, int dest )
                else if ( current == dest )
                        current = src;
 
+               src_entry = this->list[ src ];
                if ( src > dest )
                {
-                       int t = dest;
-                       dest = src;
-                       src = t;
+                       for ( i = src; i > dest; i -- )
+                               this->list[ i ] = this->list[ i - 1 ];
+               }
+               else
+               {
+                       for ( i = src; i < dest; i ++ )
+                               this->list[ i ] = this->list[ i + 1 ];
                }
-               
-               src_entry = this->list[ src ];
-
-               for ( i = src + 1; i <= dest; i ++ )
-                       this->list[ i - 1 ] = this->list[ i ];
-
                this->list[ dest ] = src_entry;
 
                mlt_playlist_get_clip_info( this, &current_info, current );
index 501487a..51663d9 100644 (file)
@@ -26,6 +26,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include <signal.h>
+#include <execinfo.h>
+#include <stdio.h>
 
 /* Valerie header files */
 #include <valerie/valerie_util.h>
@@ -286,6 +288,31 @@ void signal_handler( int sig )
        }
 }
 
+static void sigsegv_handler()
+{
+       void *array[ 10 ];
+       size_t size;
+       char **strings;
+       size_t i;
+
+       fprintf( stderr, "\a\nMiracle experienced a segmentation fault.\n"
+               "Dumping stack from the offending thread\n\n" );
+       size = backtrace( array, 10 );
+       strings = backtrace_symbols( array, size );
+
+       fprintf( stderr, "Obtained %zd stack frames.\n", size );
+
+       for ( i = 0; i < size; i++ )
+                fprintf( stderr, "%s\n", strings[ i ] );
+
+       free( strings );
+
+       fprintf( stderr, "\nDone dumping - exiting.\n" );
+       exit( EXIT_FAILURE );
+}
+
+
+
 /** Local 'connect' function.
 */
 
@@ -304,6 +331,7 @@ static valerie_response miracle_local_connect( miracle_local local )
        signal( SIGPIPE, signal_handler );
        signal( SIGALRM, signal_handler );
        signal( SIGCHLD, SIG_IGN );
+       signal( SIGSEGV, sigsegv_handler );
 
        return response;
 }
index 5e34043..bdcf33c 100644 (file)
@@ -90,6 +90,7 @@ int valerie_notifier_wait( valerie_notifier this, valerie_status status )
 
 void valerie_notifier_put( valerie_notifier this, valerie_status status )
 {
+       static unsigned int counter = 0;
        pthread_mutex_lock( &this->mutex );
        valerie_status_copy( &this->store[ status->unit ], status );
        valerie_status_copy( &this->last, status );