diff options
author | Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com> | 2016-04-14 17:02:23 +0200 |
---|---|---|
committer | Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com> | 2016-04-18 11:14:04 +0200 |
commit | aa168041218d2ac8890d96719b3c16c3ee898824 (patch) | |
tree | 03ac533f9b10ed652e095c55ee5a6e9cd1794141 | |
parent | 49a59f00eb0808bd4f6e503582a543ebff001d40 (diff) |
vaapidecode: refactor is_display_resolution_changed()
Make the comparisons more readable and simple.
https://bugzilla.gnome.org/show_bug.cgi?id=764316
-rw-r--r-- | gst/vaapi/gstvaapidecode.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index cdf5c15c..6b904e41 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -389,8 +389,8 @@ is_display_resolution_changed (GstVaapiDecode * decode, { GstVideoDecoder *const vdec = GST_VIDEO_DECODER (decode); GstVideoCodecState *state; - GstVideoInfo *vinfo; guint display_width, display_height; + guint negotiated_width, negotiated_height; display_width = GST_VIDEO_INFO_WIDTH (&decode->decoded_info); display_height = GST_VIDEO_INFO_HEIGHT (&decode->decoded_info); @@ -402,23 +402,17 @@ is_display_resolution_changed (GstVaapiDecode * decode, state = gst_video_decoder_get_output_state (vdec); if (G_UNLIKELY (!state)) goto set_display_res; - vinfo = &state->info; - if (!crop_rect) { - if (G_UNLIKELY (display_width != decode->display_width - || display_height != decode->display_height)) - goto set_display_res; - } + negotiated_width = GST_VIDEO_INFO_WIDTH (&state->info); + negotiated_height = GST_VIDEO_INFO_HEIGHT (&state->info); + gst_video_codec_state_unref (state); - if (GST_VIDEO_INFO_WIDTH (vinfo) == display_width - && GST_VIDEO_INFO_HEIGHT (vinfo) == display_height) { - gst_video_codec_state_unref (state); + if ((display_width == negotiated_width && display_height == negotiated_height) + && (decode->display_width == negotiated_width + && decode->display_height == negotiated_height)) return FALSE; - } set_display_res: - if (state) - gst_video_codec_state_unref (state); decode->display_width = display_width; decode->display_height = display_height; return TRUE; |