diff --git a/gst/gstbuffer.c b/gst/gstbuffer.c index 52add64e5d..7f92694776 100644 --- a/gst/gstbuffer.c +++ b/gst/gstbuffer.c @@ -205,7 +205,9 @@ gst_buffer_copy_into (GstBuffer * dest, GstBuffer * src, g_warn_if_fail (gst_buffer_is_writable (dest)); #endif - GST_CAT_LOG (GST_CAT_BUFFER, "copy %p to %p", src, dest); + GST_CAT_LOG (GST_CAT_BUFFER, "copy %p to %p, offset %" G_GSIZE_FORMAT + "-%" G_GSIZE_FORMAT "/%" G_GSIZE_FORMAT, src, dest, offset, size, + bufsize); if (flags & GST_BUFFER_COPY_FLAGS) { guint mask; @@ -222,7 +224,7 @@ gst_buffer_copy_into (GstBuffer * dest, GstBuffer * src, if (offset == 0) { GST_BUFFER_TIMESTAMP (dest) = GST_BUFFER_TIMESTAMP (src); GST_BUFFER_OFFSET (dest) = GST_BUFFER_OFFSET (src); - if (size == gst_buffer_get_size (src)) { + if (size == bufsize) { GST_BUFFER_DURATION (dest) = GST_BUFFER_DURATION (src); GST_BUFFER_OFFSET_END (dest) = GST_BUFFER_OFFSET_END (src); } @@ -594,6 +596,9 @@ gst_buffer_trim (GstBuffer * buffer, gsize offset, gsize size) gsize bsize; GstMemory *mem; + GST_CAT_LOG (GST_CAT_BUFFER, "trim %p %" G_GSIZE_FORMAT "-%" G_GSIZE_FORMAT, + buffer, offset, size); + g_return_if_fail (gst_buffer_is_writable (buffer)); arr = (GPtrArray *) buffer->memory; @@ -926,7 +931,8 @@ gst_buffer_create_sub (GstBuffer * buffer, gsize offset, gsize size) /* create the new buffer */ subbuffer = gst_buffer_new (); - GST_CAT_LOG (GST_CAT_BUFFER, "new subbuffer %p of %p", subbuffer, buffer); + GST_CAT_LOG (GST_CAT_BUFFER, "new subbuffer %p of %p %" G_GSIZE_FORMAT + "-%" G_GSIZE_FORMAT, subbuffer, buffer, offset, size); gst_buffer_copy_into (subbuffer, buffer, GST_BUFFER_COPY_ALL, offset, size); diff --git a/gst/gstmemory.c b/gst/gstmemory.c index 54a4fdab2c..5412f224f4 100644 --- a/gst/gstmemory.c +++ b/gst/gstmemory.c @@ -116,7 +116,7 @@ _default_mem_get_sizes (GstMemoryDefault * mem, gsize * maxsize) static void _default_mem_trim (GstMemoryDefault * mem, gsize offset, gsize size) { - g_return_if_fail (size + mem->offset + offset > mem->maxsize); + g_return_if_fail (size + mem->offset + offset <= mem->maxsize); mem->offset += offset; mem->size = size; @@ -198,7 +198,7 @@ static void _default_mem_extract (GstMemoryDefault * mem, gsize offset, gpointer dest, gsize size) { - g_return_if_fail (size + mem->offset + offset > mem->maxsize); + g_return_if_fail (size + mem->offset + offset <= mem->maxsize); memcpy (dest, mem->data + mem->offset + offset, size); } diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c index 930ab56e43..19087c2dcc 100644 --- a/libs/gst/base/gstbasetransform.c +++ b/libs/gst/base/gstbasetransform.c @@ -1539,7 +1539,7 @@ gst_base_transform_prepare_output_buffer (GstBaseTransform * trans, /* no valid buffer yet, make one, metadata is writable */ *out_buf = gst_buffer_new_and_alloc (outsize); gst_buffer_copy_into (*out_buf, in_buf, - GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, 0); + GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1); } else { GST_DEBUG_OBJECT (trans, "reuse input buffer"); *out_buf = in_buf; @@ -1608,7 +1608,7 @@ gst_base_transform_prepare_output_buffer (GstBaseTransform * trans, gst_buffer_set_caps (*out_buf, outcaps); if (copymeta) gst_buffer_copy_into (*out_buf, in_buf, - GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, 0); + GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1); /* clear the GAP flag when the subclass does not understand it */ if (!trans->priv->gap_aware) GST_BUFFER_FLAG_UNSET (*out_buf, GST_BUFFER_FLAG_GAP);