# HG changeset patch # User rosfran # Date 1163787504 0 # Node ID da398435732b3b973c983446fa537e4dc25b9c99 # Parent ae73b4837eedb662ae5db38206cf20c04b85f67a [svn r95] Minor fixes on the GstAdapter (cache buffer). diff -r ae73b4837eed -r da398435732b gst-plugins-mythtv/src/gstmythtvsrc.c --- a/gst-plugins-mythtv/src/gstmythtvsrc.c Fri Nov 17 15:20:28 2006 +0000 +++ b/gst-plugins-mythtv/src/gstmythtvsrc.c Fri Nov 17 18:18:24 2006 +0000 @@ -42,7 +42,7 @@ //( 32*1024 ) /* 4*1024 ??? */ -#define MAX_READ_SIZE 6*1024 +#define MAX_READ_SIZE 4*1024 //( 32*1024 ) #define GST_FLOW_ERROR_NO_DATA -101 @@ -620,12 +620,9 @@ } if ( ( src->buffer_remain = gst_adapter_available_fast( src->adapter ) ) < MAX_READ_SIZE ) { - //gint8 *tmp_buffer = g_malloc0( INTERNAL_BUFFER_SIZE ); // FIXME: DON'T ALLOC EVERY TIME + buffer = gst_buffer_new_and_alloc( INTERNAL_BUFFER_SIZE - src->buffer_remain ); - //g_memmove (tmp_buffer, src->buffer + src->buffer_offset, src->buffer_remain); - //g_memmove( tmp_buffer, src->buffer, src->buffer_remain ); - read = do_read_request_response( src, 0, INTERNAL_BUFFER_SIZE - src->buffer_remain, &(GST_BUFFER_DATA(buffer)) ); if (G_UNLIKELY (read < 0)) { @@ -640,15 +637,12 @@ gst_adapter_push( src->adapter, buffer ); - //len = gmyth_file_transfer_read( src->file_transfer, - // tmp_buffer + src->buffer_remain, INTERNAL_BUFFER_SIZE - src->buffer_remain, TRUE ); - // fixme: handle eos - // fixme: can I deallocate the previous buffer here? - //g_memmove( src->buffer, tmp_buffer, INTERNAL_BUFFER_SIZE ); src->buffer_offset = 0; src->buffer_remain = src->buffer_remain + read; - //g_free( tmp_buffer ); + g_print( "[%s]\tBYTES READ (actual) = %d, BYTES READ (cumulative) = %llu, "\ + "OFFSET = %llu, CONTENT SIZE = %llu.\n", __FUNCTION__, read, src->bytes_read, + src->read_offset, src->content_size ); } @@ -675,11 +669,7 @@ //gst_adapter_flush( src->adapter, size ); gst_buffer_unref( buffer ); - g_print( "[%s]\tBYTES READ (actual) = %d, BYTES READ (cumulative) = %llu, "\ - "OFFSET = %llu, CONTENT SIZE = %llu.\n", __FUNCTION__, read, src->bytes_read, - src->read_offset, src->content_size ); - - g_print( "Got buffer: [%s]\t\tBUFFER --->SIZE = %d, OFFSET = %llu, "\ + g_print( "Got buffer: [%s]\t\tBUFFER --->SIZE = %d, OFFSET = %llu, "\ "OFFSET_END = %llu.\n\n", __FUNCTION__, GST_BUFFER_SIZE (*outbuf), GST_BUFFER_OFFSET (*outbuf), GST_BUFFER_OFFSET_END (*outbuf) );