From 7768342230450559509e3e593b2ea33e81ea0ca4 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 9 Apr 2013 17:32:28 +0200 Subject: icydemux: avoid subbuffer when we can --- gst/icydemux/gsticydemux.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gst/icydemux/gsticydemux.c b/gst/icydemux/gsticydemux.c index 4a533b921..16dc2cf42 100644 --- a/gst/icydemux/gsticydemux.c +++ b/gst/icydemux/gsticydemux.c @@ -543,7 +543,12 @@ gst_icydemux_chain (GstPad * pad, GstBuffer * buf) while (size) { if (icydemux->remaining) { chunk = (size <= icydemux->remaining) ? size : icydemux->remaining; - sub = gst_buffer_create_sub (buf, offset, chunk); + if (offset == 0 && chunk == size) { + sub = buf; + buf = NULL; + } else { + sub = gst_buffer_create_sub (buf, offset, chunk); + } offset += chunk; icydemux->remaining -= chunk; size -= chunk; @@ -585,7 +590,8 @@ gst_icydemux_chain (GstPad * pad, GstBuffer * buf) } done: - gst_buffer_unref (buf); + if (buf) + gst_buffer_unref (buf); return ret; -- cgit v1.2.1