flacdec: use gst_adapter_copy() to avoid unnecessary buffer merges

gst_adapter_peek() will merge buffers as needed, which we can avoid
here since we're doing a memcpy anyway and then flush the copied
data from the adapter right away.
This commit is contained in:
Tim-Philipp Müller 2009-08-01 15:22:49 +01:00
parent 33b686974e
commit e8badc0686

View file

@ -809,7 +809,7 @@ gst_flac_dec_read_stream (const FLAC__StreamDecoder * decoder,
GST_LOG_OBJECT (dec, "feeding %u bytes to decoder (available=%u, bytes=%u)", GST_LOG_OBJECT (dec, "feeding %u bytes to decoder (available=%u, bytes=%u)",
len, gst_adapter_available (dec->adapter), (guint) * bytes); len, gst_adapter_available (dec->adapter), (guint) * bytes);
memcpy (buffer, gst_adapter_peek (dec->adapter, len), len); gst_adapter_copy (dec->adapter, buffer, 0, len);
*bytes = len; *bytes = len;
gst_adapter_flush (dec->adapter, len); gst_adapter_flush (dec->adapter, len);