[svn r152] Some performance optimizations and memory clean-up routines. trunk
authorrosfran
Thu Nov 30 19:23:52 2006 +0000 (2006-11-30)
branchtrunk
changeset 1511799c8782451
parent 150 ae6deaca5e7b
child 152 22db2f4b6f86
[svn r152] Some performance optimizations and memory clean-up routines.
gst-plugins-mythtv/src/gstmythtvsrc.c
     1.1 --- a/gst-plugins-mythtv/src/gstmythtvsrc.c	Thu Nov 30 19:03:57 2006 +0000
     1.2 +++ b/gst-plugins-mythtv/src/gstmythtvsrc.c	Thu Nov 30 19:23:52 2006 +0000
     1.3 @@ -442,12 +442,12 @@
     1.4        else
     1.5  	goto read_error;
     1.6      } else if (G_UNLIKELY (read == 0) && !src->live_tv )
     1.7 -    	goto eos;
     1.8 +    	goto done;
     1.9  
    1.10      if ( G_UNLIKELY (src->update_prog_chain) )
    1.11        goto change_progchain;
    1.12      
    1.13 -    src->bytes_queue = g_byte_array_append( src->bytes_queue, g_memdup( buffer->data, read ), read );
    1.14 +    src->bytes_queue = g_byte_array_append( src->bytes_queue, buffer->data, read );
    1.15      if ( read > buffer_size_inter )
    1.16      	GST_WARNING_OBJECT( src, "\n\n\n[%s]\t\tINCREASED buffer size! Backend sent more than we ask him... (%d)\n\n\n", 
    1.17      			__FUNCTION__, abs( read - buffer_size_inter ) );
    1.18 @@ -468,6 +468,7 @@
    1.19    guint buffer_size = ( src->buffer_remain < MAX_READ_SIZE) ? src->buffer_remain : MAX_READ_SIZE;
    1.20    
    1.21    /* Create the buffer. */
    1.22 +  /*
    1.23    ret = gst_pad_alloc_buffer ( GST_BASE_SRC_PAD (GST_BASE_SRC (psrc)),
    1.24        src->read_offset, buffer_size,
    1.25        GST_PAD_CAPS (GST_BASE_SRC_PAD (GST_BASE_SRC (psrc))), outbuf );    
    1.26 @@ -478,9 +479,11 @@
    1.27      else
    1.28        goto done;
    1.29    }
    1.30 +  */
    1.31 +  *outbuf = gst_buffer_new_and_alloc( buffer_size );
    1.32    
    1.33    /* gets the first buffer_size bytes from the byte array buffer variable */ 
    1.34 -  guint8 *buf = g_memdup( src->bytes_queue->data, buffer_size );
    1.35 +  //guint8 *buf = g_memdup( src->bytes_queue->data, buffer_size );
    1.36  
    1.37    GST_DEBUG_OBJECT( src, "[%s] read from network? %s!, buffer_remain = %d\n", __FUNCTION__, 
    1.38    	read == -1 ? "NO, got from buffer" : "YES, go see the backend's log file", src->buffer_remain );
    1.39 @@ -488,7 +491,7 @@
    1.40    GST_BUFFER_SIZE (*outbuf) = buffer_size;
    1.41    GST_BUFFER_MALLOCDATA( *outbuf ) = g_malloc0( GST_BUFFER_SIZE (*outbuf) );
    1.42    GST_BUFFER_DATA( *outbuf ) = GST_BUFFER_MALLOCDATA( *outbuf );
    1.43 -  g_memmove( GST_BUFFER_DATA( (*outbuf) ), buf, GST_BUFFER_SIZE(*outbuf) );
    1.44 +  g_memmove( GST_BUFFER_DATA( (*outbuf) ), src->bytes_queue->data, GST_BUFFER_SIZE(*outbuf) );
    1.45    GST_BUFFER_OFFSET (*outbuf) = src->read_offset;
    1.46    GST_BUFFER_OFFSET_END (*outbuf) = src->read_offset + GST_BUFFER_SIZE (*outbuf);
    1.47