videoencoder: Only set the caps when they actually changed

This commit is contained in:
Sebastian Dröge 2013-08-23 19:20:03 +02:00
parent 96ab6db422
commit f678411c6e

View file

@ -1448,11 +1448,12 @@ gst_video_encoder_negotiate_default (GstVideoEncoder * encoder)
GstVideoEncoderClass *klass = GST_VIDEO_ENCODER_GET_CLASS (encoder);
GstAllocator *allocator;
GstAllocationParams params;
gboolean ret;
gboolean ret = TRUE;
GstVideoCodecState *state = encoder->priv->output_state;
GstVideoInfo *info = &state->info;
GstQuery *query = NULL;
GstVideoCodecFrame *frame;
GstCaps *prevcaps;
g_return_val_if_fail (state->caps != NULL, FALSE);
@ -1507,7 +1508,12 @@ gst_video_encoder_negotiate_default (GstVideoEncoder * encoder)
}
}
ret = gst_pad_set_caps (encoder->srcpad, state->caps);
prevcaps = gst_pad_get_current_caps (encoder->srcpad);
if (!prevcaps || !gst_caps_is_equal (prevcaps, state->caps))
ret = gst_pad_set_caps (encoder->srcpad, state->caps);
if (prevcaps)
gst_caps_unref (prevcaps);
if (!ret)
goto done;