icydemux: avoid copy when we can

This commit is contained in:
Wim Taymans 2013-04-09 17:34:12 +02:00
parent 91a3afc4dc
commit ece73b786a

View file

@ -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;
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,6 +581,7 @@ gst_icydemux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
}
done:
if (buf)
gst_buffer_unref (buf);
return ret;