diff --git a/sys/va/gstvah264dec.c b/sys/va/gstvah264dec.c index 571eddf7a9..69535a1b1a 100644 --- a/sys/va/gstvah264dec.c +++ b/sys/va/gstvah264dec.c @@ -643,6 +643,7 @@ gst_va_h264_dec_new_sequence (GstH264Decoder * decoder, const GstH264SPS * sps, VAProfile profile; gint display_width; gint display_height; + gint padding_left, padding_right, padding_top, padding_bottom; guint rt_format; gboolean negotiation_needed = FALSE; gboolean interlaced; @@ -653,9 +654,14 @@ gst_va_h264_dec_new_sequence (GstH264Decoder * decoder, const GstH264SPS * sps, if (sps->frame_cropping_flag) { display_width = sps->crop_rect_width; display_height = sps->crop_rect_height; + padding_left = sps->crop_rect_x; + padding_right = sps->width - sps->crop_rect_x - display_width; + padding_top = sps->crop_rect_y; + padding_bottom = sps->height - sps->crop_rect_y - display_height; } else { display_width = sps->width; display_height = sps->height; + padding_left = padding_right = padding_top = padding_bottom = 0; } profile = _get_profile (self, sps, max_dpb_size); @@ -701,9 +707,19 @@ gst_va_h264_dec_new_sequence (GstH264Decoder * decoder, const GstH264SPS * sps, || base->height < self->coded_height; if (base->need_valign) { /* *INDENT-OFF* */ + if (base->valign.padding_left != padding_left || + base->valign.padding_right != padding_right || + base->valign.padding_top != padding_top || + base->valign.padding_bottom != padding_bottom) { + negotiation_needed = TRUE; + GST_INFO_OBJECT (self, "crop rect changed to (%d,%d)-->(%d,%d)", + padding_left, padding_top, padding_right, padding_bottom); + } base->valign = (GstVideoAlignment) { - .padding_bottom = self->coded_height - base->height, - .padding_right = self->coded_width - base->width, + .padding_left = padding_left, + .padding_right = padding_right, + .padding_top = padding_top, + .padding_bottom = padding_bottom, }; /* *INDENT-ON* */ }