mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 21:16:24 +00:00
omxvideoenc: use caps from query in propose_allocation
Prevent crash by not deferencing a NULL pointer if self->input_state isn't defined when propose_allocation() is called. https://bugzilla.gnome.org/show_bug.cgi?id=786442
This commit is contained in:
parent
318ef5b357
commit
79df3b0e8e
1 changed files with 16 additions and 3 deletions
|
@ -1905,15 +1905,28 @@ gst_omx_video_enc_propose_allocation (GstVideoEncoder * encoder,
|
|||
{
|
||||
GstOMXVideoEnc *self = GST_OMX_VIDEO_ENC (encoder);
|
||||
guint num_buffers;
|
||||
gsize size = self->input_state->info.size;
|
||||
GstCaps *caps;
|
||||
GstVideoInfo info;
|
||||
|
||||
gst_query_parse_allocation (query, &caps, NULL);
|
||||
|
||||
if (!caps) {
|
||||
GST_WARNING_OBJECT (self, "allocation query does not contain caps");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!gst_video_info_from_caps (&info, caps)) {
|
||||
GST_WARNING_OBJECT (self, "Failed to parse caps %" GST_PTR_FORMAT, caps);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL);
|
||||
|
||||
num_buffers = self->enc_in_port->port_def.nBufferCountMin + 1;
|
||||
GST_DEBUG_OBJECT (self,
|
||||
"request at least %d buffers of size %" G_GSIZE_FORMAT, num_buffers,
|
||||
size);
|
||||
gst_query_add_allocation_pool (query, NULL, size, num_buffers, 0);
|
||||
info.size);
|
||||
gst_query_add_allocation_pool (query, NULL, info.size, num_buffers, 0);
|
||||
|
||||
return
|
||||
GST_VIDEO_ENCODER_CLASS
|
||||
|
|
Loading…
Reference in a new issue