h265parse: Fix uninitialized width and height when update src caps.
The commit b90d0274 introduces uninitialized width and height when we consider to change the "pixel-aspect-ratio" for some interlaced stream. We need to check the resolution in the src caps, and if no resolution info found, there is no need to consider the aspect ratio. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2630>
This commit is contained in:
parent
1dc24d23d2
commit
f0d4135b3a
@ -2335,6 +2335,7 @@ gst_h265_parse_update_src_caps (GstH265Parse * h265parse, GstCaps * caps)
|
|||||||
const gchar *mdi_str = NULL;
|
const gchar *mdi_str = NULL;
|
||||||
const gchar *cll_str = NULL;
|
const gchar *cll_str = NULL;
|
||||||
gboolean codec_data_modified = FALSE;
|
gboolean codec_data_modified = FALSE;
|
||||||
|
GstStructure *st;
|
||||||
|
|
||||||
gst_caps_set_simple (caps, "parsed", G_TYPE_BOOLEAN, TRUE,
|
gst_caps_set_simple (caps, "parsed", G_TYPE_BOOLEAN, TRUE,
|
||||||
"stream-format", G_TYPE_STRING,
|
"stream-format", G_TYPE_STRING,
|
||||||
@ -2343,7 +2344,15 @@ gst_h265_parse_update_src_caps (GstH265Parse * h265parse, GstCaps * caps)
|
|||||||
gst_h265_parse_get_string (h265parse, FALSE, h265parse->align), NULL);
|
gst_h265_parse_get_string (h265parse, FALSE, h265parse->align), NULL);
|
||||||
|
|
||||||
gst_h265_parse_get_par (h265parse, &par_n, &par_d);
|
gst_h265_parse_get_par (h265parse, &par_n, &par_d);
|
||||||
if (par_n != 0 && par_d != 0 &&
|
|
||||||
|
width = 0;
|
||||||
|
height = 0;
|
||||||
|
st = gst_caps_get_structure (caps, 0);
|
||||||
|
gst_structure_get_int (st, "width", &width);
|
||||||
|
gst_structure_get_int (st, "height", &height);
|
||||||
|
|
||||||
|
/* If no resolution info, do not consider aspect ratio */
|
||||||
|
if (par_n != 0 && par_d != 0 && width > 0 && height > 0 &&
|
||||||
(!s || !gst_structure_has_field (s, "pixel-aspect-ratio"))) {
|
(!s || !gst_structure_has_field (s, "pixel-aspect-ratio"))) {
|
||||||
gint new_par_d = par_d;
|
gint new_par_d = par_d;
|
||||||
/* Special case for some encoders which provide an 1:2 pixel aspect ratio
|
/* Special case for some encoders which provide an 1:2 pixel aspect ratio
|
||||||
|
Loading…
x
Reference in New Issue
Block a user