diff --git a/src/gstvpe.c b/src/gstvpe.c index a5ed1ff..ae0bf9c 100644 --- a/src/gstvpe.c +++ b/src/gstvpe.c @@ -166,7 +166,7 @@ static gboolean gst_vpe_set_output_caps (GstVpe * self) { GstCaps *outcaps; - GstStructure *s, *out_s; + GstStructure *s, *out_s = NULL; gint fps_n, fps_d; gint par_width, par_height; const gchar *fmt = NULL; @@ -184,9 +184,10 @@ gst_vpe_set_output_caps (GstVpe * self) && gst_caps_is_strictly_equal (outcaps, self->output_caps))) { GST_DEBUG_OBJECT (self, "Downstream allowed caps: %s", gst_caps_to_string (outcaps)); - out_s = gst_caps_get_structure (outcaps, 0); - fmt = gst_structure_get_string (out_s, "format"); - + if(gst_caps_get_size(outcaps) > 0 ) { + out_s = gst_caps_get_structure (outcaps, 0); + fmt = gst_structure_get_string (out_s, "format"); + } if (out_s && gst_structure_get_int (out_s, "width", &self->output_width) && gst_structure_get_int (out_s, "height", &self->output_height) && fmt) { @@ -210,8 +211,8 @@ gst_vpe_set_output_caps (GstVpe * self) 2 : self->input_crop.c.height; self->output_width = self->input_crop.c.width; } else { - self->output_height = self->input_height; - self->output_width = self->input_width; + self->output_height = self->input_crop.c.height; + self->output_width = self->input_crop.c.width; } self->output_fourcc = GST_MAKE_FOURCC ('N', 'V', '1', '2'); }