Discussion:
[Bug 777841] New: waylandsink: fix buffer size when copying to pool
(too old to reply)
"GStreamer" (GNOME Bugzilla)
2017-01-27 16:07:23 UTC
Permalink
Raw Message
https://bugzilla.gnome.org/show_bug.cgi?id=777841

Bug ID: 777841
Summary: waylandsink: fix buffer size when copying to pool
Classification: Platform
Product: GStreamer
Version: 1.10.x
OS: Linux
Status: NEW
Severity: normal
Priority: Normal
Component: gst-plugins-bad
Assignee: gstreamer-***@lists.freedesktop.org
Reporter: ***@st.com
QA Contact: gstreamer-***@lists.freedesktop.org
GNOME version: ---

Created attachment 344429
--> https://bugzilla.gnome.org/attachment.cgi?id=344429&action=edit
waylandsink: consider buffer size

When the sink receives a buffer that is neither a wl_shm one nor a dmabuf one,
this buffer is copied to an internal wl_shm buffer before being sent to the
display.
In that case, the actual size of the received buffer (which may differ from the
one negotiated in the caps) must be used.

-----

The proposed patch fixes a crash in weston that tries to access memory.
Reproducible with a B2260 96 board and the following pipeline:
gst-launch-1.0 videotestsrc ! "video/x-raw,format=BGRx" ! v4l2video0convert !
"video/x-raw, format=NV12, width=500, height=500" ! waylandsink

v4l2video0convert calls the B2260 driver that aligns width from 500 to 504.
Hence the buffer size is 504x500x1.5 bytes (cropped to 500x500)

---

The root caus of this issue is here:

vmeta = gst_buffer_get_video_meta (buffer);
if (vmeta) {
gint i;
for (i = 0; i < vmeta->n_planes; i++) {
sink->video_info.offset[i] = vmeta->offset[i];
sink->video_info.stride[i] = vmeta->stride[i];

video_info is updated for .offset & .stride, but .size is not updated, so we
have unconsistent parameters.
size shall be recomputed from offset[] and stride[] (as done by static
fill_planes() from gst-libs/gst/video/video-info.c).
But since fill_planes() cannot be called from here, the proposed patch uses
mem->size. Better ideas are welcome
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
"GStreamer" (GNOME Bugzilla)
2017-01-27 17:13:24 UTC
Permalink
Raw Message
https://bugzilla.gnome.org/show_bug.cgi?id=777841

Nicolas Dufresne (stormer) <***@ndufresne.ca> changed:

What |Removed |Added
----------------------------------------------------------------------------
Attachment #344429|none |needs-work
status| |

--- Comment #1 from Nicolas Dufresne (stormer) <***@ndufresne.ca> ---
Review of attachment 344429:
--> (https://bugzilla.gnome.org/review?bug=777841&attachment=344429)

I think this is correct, just move out the assignment out of the loop please.

::: ext/wayland/gstwaylandsink.c
@@ +649,3 @@
sink->video_info.offset[i] = vmeta->offset[i];
sink->video_info.stride[i] = vmeta->stride[i];
+ sink->video_info.size = mem->size;

Written this way, it looks wrong, as you endup overriding over and over with
the same value. I think for anything shm we already ensure there is only 1 mem,
so the code is right, I would just pull that out of the loop.
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
"GStreamer" (GNOME Bugzilla)
2017-01-30 10:11:38 UTC
Permalink
Raw Message
https://bugzilla.gnome.org/show_bug.cgi?id=777841

Fabien Dessenne <***@st.com> changed:

What |Removed |Added
----------------------------------------------------------------------------
Attachment #344429|needs-work |none
status| |
Attachment #344429|0 |1
is obsolete| |

--- Comment #2 from Fabien Dessenne <***@st.com> ---
Created attachment 344519
--> https://bugzilla.gnome.org/attachment.cgi?id=344519&action=edit
[v2] waylandsink: consider buffer size

Move size assignment out of the loop, as suggested by Nicolas
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
"GStreamer" (GNOME Bugzilla)
2017-02-16 17:39:34 UTC
Permalink
Raw Message
https://bugzilla.gnome.org/show_bug.cgi?id=777841

Fabien Dessenne <***@st.com> changed:

What |Removed |Added
----------------------------------------------------------------------------
Attachment #344519|0 |1
is obsolete| |

--- Comment #3 from Fabien Dessenne <***@st.com> ---
Created attachment 345977
--> https://bugzilla.gnome.org/attachment.cgi?id=345977&action=edit
[v3] waylandsink: consider buffer size

Removed "Signed-off-by"
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
"GStreamer" (GNOME Bugzilla)
2017-02-22 09:23:19 UTC
Permalink
Raw Message
https://bugzilla.gnome.org/show_bug.cgi?id=777841

Nicolas Dufresne (stormer) <***@ndufresne.ca> changed:

What |Removed |Added
----------------------------------------------------------------------------
Attachment #345977|none |accepted-commit_now
status| |

--- Comment #4 from Nicolas Dufresne (stormer) <***@ndufresne.ca> ---
Review of attachment 345977:
--> (https://bugzilla.gnome.org/review?bug=777841&attachment=345977)

Looks good.
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
"GStreamer" (GNOME Bugzilla)
2017-02-22 09:27:02 UTC
Permalink
Raw Message
https://bugzilla.gnome.org/show_bug.cgi?id=777841

Nicolas Dufresne (stormer) <***@ndufresne.ca> changed:

What |Removed |Added
----------------------------------------------------------------------------
Attachment #345977|accepted-commit_now |committed
status| |
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
"GStreamer" (GNOME Bugzilla)
2017-02-22 09:26:59 UTC
Permalink
Raw Message
https://bugzilla.gnome.org/show_bug.cgi?id=777841

Nicolas Dufresne (stormer) <***@ndufresne.ca> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |***@ndufresne.ca
Resolution|--- |FIXED

--- Comment #5 from Nicolas Dufresne (stormer) <***@ndufresne.ca> ---
Commited in master e2dffab9bee8611b0daa818806f36541bfedde26
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
"GStreamer" (GNOME Bugzilla)
2017-02-22 09:36:43 UTC
Permalink
Raw Message
https://bugzilla.gnome.org/show_bug.cgi?id=777841

Nicolas Dufresne (stormer) <***@ndufresne.ca> changed:

What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|git master |1.10.4

--- Comment #6 from Nicolas Dufresne (stormer) <***@ndufresne.ca> ---
In 1.10 as fb2e63c468321a1691e06c5aad22df7559e1bd54

Thanks.
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
Loading...