From 2917844f0902f524c4f51cc6520a5c602c92e56f Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 29 Jun 2004 15:25:10 +0000 Subject: [PATCH] ext/ogg/: Fix memleak in oggdemux when running unconnected pads. doc update in mux, start working on keyframe mode. Original commit message from CVS: * ext/ogg/gstoggdemux.c: (gst_ogg_pad_push): * ext/ogg/gstoggmux.c: Fix memleak in oggdemux when running unconnected pads. doc update in mux, start working on keyframe mode. --- ChangeLog | 7 +++++++ ext/ogg/gstoggdemux.c | 8 ++++---- ext/ogg/gstoggmux.c | 11 +++++++++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5719de3982c..43855e3a7a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-06-29 Wim Taymans + + * ext/ogg/gstoggdemux.c: (gst_ogg_pad_push): + * ext/ogg/gstoggmux.c: + Fix memleak in oggdemux when running unconnected pads. + doc update in mux, start working on keyframe mode. + 2004-06-29 Benjamin Otte * sys/oss/gstosssink.c: diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c index df119c9bc48..940862fb473 100644 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@ -376,8 +376,7 @@ gst_ogg_demux_src_event (GstPad * pad, GstEvent * event) GST_OGG_SET_STATE (ogg, GST_OGG_STATE_SEEK); FOR_PAD_IN_CURRENT_CHAIN (ogg, pad, - pad->flags |= GST_OGG_PAD_NEEDS_DISCONT; - ); + pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;); GST_DEBUG_OBJECT (ogg, "initiating seeking to offset %" G_GUINT64_FORMAT, offset); ogg->seek_pad = cur; @@ -424,8 +423,7 @@ gst_ogg_demux_handle_event (GstPad * pad, GstEvent * event) gst_event_unref (event); GST_FLAG_UNSET (ogg, GST_OGG_FLAG_WAIT_FOR_DISCONT); FOR_PAD_IN_CURRENT_CHAIN (ogg, pad, - pad->flags |= GST_OGG_PAD_NEEDS_DISCONT; - ); + pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;); break; case GST_EVENT_EOS: if (ogg->state == GST_OGG_STATE_SETUP) { @@ -829,6 +827,8 @@ gst_ogg_pad_push (GstOggDemux * ogg, GstOggPad * pad) pad->offset = packet.granulepos; if (GST_PAD_IS_USABLE (pad->pad)) gst_pad_push (pad->pad, GST_DATA (buf)); + else + gst_buffer_unref (buf); break; } default: diff --git a/ext/ogg/gstoggmux.c b/ext/ogg/gstoggmux.c index a147160a2d1..1c311c8167b 100644 --- a/ext/ogg/gstoggmux.c +++ b/ext/ogg/gstoggmux.c @@ -92,6 +92,10 @@ struct _GstOggMux guint64 max_delay; guint64 max_page_delay; + + gboolean keyframe_mode; /* when a delta frame is detected on a stream, we mark + pages as delta frames up to the page that has the + keyframe */ }; typedef enum @@ -804,11 +808,14 @@ gst_ogg_mux_send_headers (GstOggMux * mux) * 1) find a pad to pull on, this is done by pulling on all pads and * looking at the buffers to decide which one should be muxed first. * 2) store the selected pad and keep on pulling until we fill a - * complete ogg page. This is needed because the ogg spec says that + * complete ogg page or the ogg page is filled above the max-delay + * threshold. This is needed because the ogg spec says that * you should fill a complete page with data from the same logical * stream. When the page is filled, go back to 1). * 3) before filling a packet, read ahead one more buffer to see if this - * packet is the last of the stream. + * packet is the last of the stream. We need to do this because the ogg + * spec mandates that the last packet should have the EOS flag set before + * sending it to ogg. */ static void gst_ogg_mux_loop (GstElement * element)