videocoder: Don't push out identical caps

This avoids triggering plenty of extra code/methods/overhead downstream when
we can just quickly check whenever we want to set caps whether they are
identical or not

https://bugzilla.gnome.org/show_bug.cgi?id=706600
This commit is contained in:
Edward Hervey 2013-08-23 15:22:43 +02:00
parent cd3fe60c68
commit d1cf4b2b9a

View file

@ -3010,6 +3010,7 @@ gst_video_decoder_negotiate_default (GstVideoDecoder * decoder)
GstAllocationParams params; GstAllocationParams params;
gboolean ret = TRUE; gboolean ret = TRUE;
GstVideoCodecFrame *frame; GstVideoCodecFrame *frame;
GstCaps *prevcaps;
g_return_val_if_fail (GST_VIDEO_INFO_WIDTH (&state->info) != 0, FALSE); g_return_val_if_fail (GST_VIDEO_INFO_WIDTH (&state->info) != 0, FALSE);
g_return_val_if_fail (GST_VIDEO_INFO_HEIGHT (&state->info) != 0, FALSE); g_return_val_if_fail (GST_VIDEO_INFO_HEIGHT (&state->info) != 0, FALSE);
@ -3052,7 +3053,14 @@ gst_video_decoder_negotiate_default (GstVideoDecoder * decoder)
} }
} }
} }
ret = gst_pad_set_caps (decoder->srcpad, state->caps);
prevcaps = gst_pad_get_current_caps (decoder->srcpad);
if (!prevcaps || !gst_caps_is_equal (prevcaps, state->caps))
ret = gst_pad_set_caps (decoder->srcpad, state->caps);
else
ret = TRUE;
if (prevcaps)
gst_caps_unref (prevcaps);
if (!ret) if (!ret)
goto done; goto done;