[PATCH] video: Add documentation about default_map implementation

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH] video: Add documentation about default_map implementation

Frediano Ziglio
default_map does not take into consideration length of
mapped memory resulting on memory errors.
Document this behaviour on affected functions.

See https://bugzilla.gnome.org/show_bug.cgi?id=779524.

Signed-off-by: Frediano Ziglio <[hidden email]>
---
 gst-libs/gst/video/gstvideometa.c | 8 +++++++-
 gst-libs/gst/video/video-frame.c  | 6 ++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/gst-libs/gst/video/gstvideometa.c b/gst-libs/gst/video/gstvideometa.c
index e2065d8..ee7c321 100644
--- a/gst-libs/gst/video/gstvideometa.c
+++ b/gst-libs/gst/video/gstvideometa.c
@@ -212,7 +212,9 @@ default_map (GstVideoMeta * meta, guint plane, GstMapInfo * info,
   offset = meta->offset[plane];
 
   /* find the memory block for this plane, this is the memory block containing
-   * the plane offset. FIXME use plane size */
+   * the plane offset. FIXME use plane size. Once fixed update comment on
+   * gst_buffer_add_video_meta_full, gst_video_frame_map_id and
+   * gst_video_frame_map. */
   if (!gst_buffer_find_memory (buffer, offset, 1, &idx, &length, &skip))
     goto no_memory;
 
@@ -293,6 +295,10 @@ gst_buffer_add_video_meta (GstBuffer * buffer,
  *
  * Attaches GstVideoMeta metadata to @buffer with the given parameters.
  *
+ * Attaching metadata to @buffer require that the memories attached to
+ * the buffer are Plane-alignment. Failing to do so will possible cause
+ * memory errors.
+ *
  * Returns: (transfer none): the #GstVideoMeta on @buffer.
  */
 GstVideoMeta *
diff --git a/gst-libs/gst/video/video-frame.c b/gst-libs/gst/video/video-frame.c
index 30a2d85..50644f8 100644
--- a/gst-libs/gst/video/video-frame.c
+++ b/gst-libs/gst/video/video-frame.c
@@ -64,6 +64,9 @@ video_frame_get_perf_category (void)
  * All video planes of @buffer will be mapped and the pointers will be set in
  * @frame->data.
  *
+ * If video frame has GstVideoMeta the buffer requires to have Plane-aligned
+ * memories.
+ *
  * Returns: %TRUE on success.
  */
 gboolean
@@ -230,6 +233,9 @@ invalid_size:
  * just work and you can access the data easily. It also maps the underlying
  * memory chunks for you.
  *
+ * If video frame has GstVideoMeta the buffer requires to have Plane-aligned
+ * memories.
+ *
  * Returns: %TRUE on success.
  */
 gboolean
--
2.9.3

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Loading...