summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2015-03-14 16:00:47 +0000
committerTim-Philipp Müller <tim@centricular.com>2015-03-14 16:02:03 +0000
commit68012b4d23d7296060a4ae7ac07a588a8a005bb5 (patch)
tree5dc5760d25984b501484bd300f01b1d0c4bb02e0
parent4a1cee3c447d4dacc92f5caa5c58e12bbc460263 (diff)
collectpads: avoid multiple calls to gst_buffer_get_size() in macro
-rw-r--r--libs/gst/base/gstcollectpads.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libs/gst/base/gstcollectpads.c b/libs/gst/base/gstcollectpads.c
index 45e31d90d..8866790a2 100644
--- a/libs/gst/base/gstcollectpads.c
+++ b/libs/gst/base/gstcollectpads.c
@@ -1131,7 +1131,7 @@ GstBuffer *
gst_collect_pads_read_buffer (GstCollectPads * pads, GstCollectData * data,
guint size)
{
- guint readsize;
+ guint readsize, buf_size;
GstBuffer *buffer;
g_return_val_if_fail (pads != NULL, NULL);
@@ -1142,7 +1142,8 @@ gst_collect_pads_read_buffer (GstCollectPads * pads, GstCollectData * data,
if ((buffer = data->buffer) == NULL)
return NULL;
- readsize = MIN (size, gst_buffer_get_size (buffer) - data->pos);
+ buf_size = gst_buffer_get_size (buffer);
+ readsize = MIN (size, buf_size - data->pos);
return gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, data->pos,
readsize);