mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 02:15:31 +00:00
icydemux: avoid copy when we can
This commit is contained in:
parent
91a3afc4dc
commit
ece73b786a
1 changed files with 8 additions and 2 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue