ext/ogg/gstoggmux.c: Fix an ugly memleak where the muxer didn't flush enough ogg pages. This also resulted in badly m...

Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_get_type), (gst_ogg_mux_init),
(gst_ogg_mux_sinkconnect), (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_next_buffer), (gst_ogg_mux_push_page),
(gst_ogg_mux_compare_pads), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_loop):
Fix an ugly memleak where the muxer didn't flush enough ogg
pages. This also resulted in badly muxed ogg files.
This commit is contained in:
Wim Taymans 2004-05-18 11:36:40 +00:00
parent 754cf8b99b
commit db9cdcef0f
2 changed files with 18 additions and 7 deletions

View file

@ -1,3 +1,13 @@
2004-05-18 Wim Taymans <wim@fluendo.com>
* ext/ogg/gstoggmux.c: (gst_ogg_mux_get_type), (gst_ogg_mux_init),
(gst_ogg_mux_sinkconnect), (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_next_buffer), (gst_ogg_mux_push_page),
(gst_ogg_mux_compare_pads), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_loop):
Fix an ugly memleak where the muxer didn't flush enough ogg
pages. This also resulted in badly muxed ogg files.
2004-05-18 Stephane Loeuillet <stephane.loeuillet@tiscali.fr>
* gst/asfdemux/asfheaders.c :

View file

@ -384,6 +384,7 @@ gst_ogg_mux_next_buffer (GstOggPad * pad)
switch (type) {
case GST_EVENT_EOS:
gst_event_unref (event);
return NULL;
default:
gst_pad_event_default (pad->pad, event);
@ -415,8 +416,9 @@ gst_ogg_mux_push_page (GstOggMux * mux, ogg_page * page)
if (GST_PAD_IS_USABLE (mux->srcpad))
gst_pad_push (mux->srcpad, GST_DATA (buffer));
else
else {
gst_buffer_unref (buffer);
}
}
/*
@ -543,14 +545,13 @@ gst_ogg_mux_loop (GstElement * element)
ogg_page page;
GstBuffer *buf, *tmpbuf;
GstOggPad *pad = ogg_mux->pulling;
gint ret;
GstOggPadState newstate;
/* now see if we have a buffer */
buf = pad->buffer;
if (buf == NULL) {
/* no buffer, get one */
buf = gst_ogg_mux_next_buffer (pad);
/* no buffer, get one, and store in the pad so we free it later on */
buf = pad->buffer = gst_ogg_mux_next_buffer (pad);
/* data exhausted on this pad (EOS) */
if (buf == NULL) {
/* stop pulling from the pad */
@ -601,9 +602,9 @@ gst_ogg_mux_loop (GstElement * element)
/* store new readahead buffer */
pad->buffer = tmpbuf;
/* create a page */
ret = ogg_stream_pageout (&pad->stream, &page);
if (ret > 0) {
/* flush out the pages now. The packet we got could end up in
* more than one page so we need to flush them all */
while (ogg_stream_pageout (&pad->stream, &page) > 0) {
/* we have a complete page now, we can push the page
* and make sure to pull on a new pad the next time around */
gst_ogg_mux_push_page (ogg_mux, &page);