diff -r b6b5f2dc831d -r 7140b2c2e63c gst-plugins-mythtv/src/gstmythtvsrc.c --- a/gst-plugins-mythtv/src/gstmythtvsrc.c Fri Feb 02 22:46:13 2007 +0000 +++ b/gst-plugins-mythtv/src/gstmythtvsrc.c Wed Feb 14 21:35:23 2007 +0000 @@ -398,6 +398,8 @@ /* just get from the byte array, no network effort... */ if ((src->buffer_remain = src->bytes_queue->len) < MAX_READ_SIZE) { + +program_chain_changed: GByteArray *buffer = NULL; guint buffer_size_inter = (INTERNAL_BUFFER_SIZE - src->buffer_remain); @@ -409,11 +411,23 @@ read = do_read_request_response (src, buffer_size_inter, buffer); if (G_UNLIKELY (read < 0)) { + + if (buffer != NULL) { + g_byte_array_free (buffer, TRUE); + buffer = NULL; + } + if (src->live_tv) goto change_progchain; else goto read_error; } else if (G_UNLIKELY (read == 0)) { + + if (buffer != NULL) { + g_byte_array_free (buffer, TRUE); + buffer = NULL; + } + if (!src->live_tv) goto done; else @@ -421,7 +435,13 @@ } if (G_UNLIKELY (src->update_prog_chain)) - goto change_progchain; + { + if (buffer != NULL) { + g_byte_array_free (buffer, TRUE); + buffer = NULL; + } + goto change_progchain; + } src->bytes_queue = g_byte_array_append (src->bytes_queue, buffer->data, read); @@ -477,15 +497,15 @@ src->bytes_queue = g_byte_array_remove_range (src->bytes_queue, 0, buffer_size); - GST_DEBUG_OBJECT (src, "Got buffer: BUFFER --->SIZE = %d, OFFSET = %llu, " + GST_DEBUG_OBJECT ( src, "Got buffer: BUFFER --->SIZE = %d, OFFSET = %llu, " "OFFSET_END = %llu.", GST_BUFFER_SIZE (*outbuf), - GST_BUFFER_OFFSET (*outbuf), GST_BUFFER_OFFSET_END (*outbuf)); + GST_BUFFER_OFFSET (*outbuf), GST_BUFFER_OFFSET_END (*outbuf) ); GST_DEBUG_OBJECT (src, "CONTENT_SIZE = %llu, BYTES_READ = %llu.", src->content_size, src->bytes_read); - if (G_UNLIKELY (src->eos) || (!src->live_tv - && (src->bytes_read >= src->content_size))) + if ( G_UNLIKELY (src->eos) || ( !src->live_tv + && ( src->bytes_read >= src->content_size ) ) ) goto eos; done: @@ -519,12 +539,12 @@ gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1, 0)); /* go to the next program chain */ - src->unique_setup = FALSE; - src->update_prog_chain = TRUE; + //src->unique_setup = FALSE; + //src->update_prog_chain = TRUE; - gst_mythtv_src_next_program_chain (src); + //gst_mythtv_src_next_program_chain (src); - return GST_FLOW_ERROR_NO_DATA; + goto program_chain_changed; } }