diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2013-04-09 17:34:12 +0200 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2013-04-09 17:34:12 +0200 |
commit | ece73b786a7a074cbbe02ab558b15204877afa95 (patch) | |
tree | 9b7b8edc7bfad7e5f407c67c1c1c1f7515de76d5 /gst/icydemux | |
parent | 91a3afc4dc4f164692fa245a9b6082e1ef65f3ca (diff) | |
download | gstreamer-plugins-good-ece73b786a7a074cbbe02ab558b15204877afa95.tar.gz |
icydemux: avoid copy when we can
Diffstat (limited to 'gst/icydemux')
-rw-r--r-- | gst/icydemux/gsticydemux.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gst/icydemux/gsticydemux.c b/gst/icydemux/gsticydemux.c index d32b4151d..b12bcb4dc 100644 --- a/gst/icydemux/gsticydemux.c +++ b/gst/icydemux/gsticydemux.c @@ -532,7 +532,12 @@ gst_icydemux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) while (size) { if (icydemux->remaining) { chunk = (size <= icydemux->remaining) ? size : icydemux->remaining; - sub = gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL, offset, chunk); + if (offset == 0 && chunk == size) { + sub = buf; + buf = NULL; + } else { + sub = gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL, offset, chunk); + } offset += chunk; icydemux->remaining -= chunk; size -= chunk; @@ -576,7 +581,8 @@ gst_icydemux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) } done: - gst_buffer_unref (buf); + if (buf) + gst_buffer_unref (buf); return ret; |