mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-05 02:02:26 +00:00
ximagsink: do not access uninitialized height variable.
Exit like in xvimagesink, if we have partial caps.
This commit is contained in:
parent
ea2e208cc1
commit
bc4388c413
1 changed files with 80 additions and 76 deletions
|
@ -1659,6 +1659,7 @@ gst_ximagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
|
|||
GstCaps *alloc_caps;
|
||||
gboolean alloc_unref = FALSE;
|
||||
gint width, height;
|
||||
GstVideoRectangle dst, src, result;
|
||||
|
||||
ximagesink = GST_XIMAGESINK (bsink);
|
||||
|
||||
|
@ -1674,10 +1675,13 @@ gst_ximagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
|
|||
|
||||
/* get struct to see what is requested */
|
||||
structure = gst_caps_get_structure (caps, 0);
|
||||
|
||||
if (gst_structure_get_int (structure, "width", &width) &&
|
||||
gst_structure_get_int (structure, "height", &height)) {
|
||||
GstVideoRectangle dst, src, result;
|
||||
if (!gst_structure_get_int (structure, "width", &width) ||
|
||||
!gst_structure_get_int (structure, "height", &height)) {
|
||||
GST_WARNING_OBJECT (ximagesink, "invalid caps for buffer allocation %"
|
||||
GST_PTR_FORMAT, caps);
|
||||
ret = GST_FLOW_UNEXPECTED;
|
||||
goto beach;
|
||||
}
|
||||
|
||||
src.w = width;
|
||||
src.h = height;
|
||||
|
@ -1757,7 +1761,6 @@ gst_ximagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
|
|||
* width and height variables */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
alloc:
|
||||
/* Inspect our buffer pool */
|
||||
|
@ -1799,6 +1802,7 @@ alloc:
|
|||
|
||||
*buf = GST_BUFFER_CAST (ximage);
|
||||
|
||||
beach:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue