diff options
author | Tom Greenwood <tcdgreenwood@hotmail.com> | 2013-04-10 19:07:00 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2013-04-15 09:44:36 +0200 |
commit | 3023521366ca6aa0b9bb9daa3939f344d08cbf37 (patch) | |
tree | 65bb5f12b40783ee3a2e22f80093aa5bda688b72 | |
parent | 6e01d1869b0f0f71137e6142367f789bcc2bc01c (diff) |
videodecoder: Ignore caps events if the caps did not change
https://bugzilla.gnome.org/show_bug.cgi?id=697672
-rw-r--r-- | gst-libs/gst/video/gstvideodecoder.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/gst-libs/gst/video/gstvideodecoder.c b/gst-libs/gst/video/gstvideodecoder.c index 08fc0bb67..ed546ff20 100644 --- a/gst-libs/gst/video/gstvideodecoder.c +++ b/gst-libs/gst/video/gstvideodecoder.c @@ -756,13 +756,21 @@ gst_video_decoder_setcaps (GstVideoDecoder * decoder, GstCaps * caps) GST_DEBUG_OBJECT (decoder, "setcaps %" GST_PTR_FORMAT, caps); + GST_VIDEO_DECODER_STREAM_LOCK (decoder); + + if (decoder->priv->input_state) { + GST_DEBUG_OBJECT (decoder, + "Checking if caps changed old %" GST_PTR_FORMAT " new %" GST_PTR_FORMAT, + decoder->priv->input_state->caps, caps); + if (gst_caps_is_equal (decoder->priv->input_state->caps, caps)) + goto caps_not_changed; + } + state = _new_input_state (caps); if (G_UNLIKELY (state == NULL)) goto parse_fail; - GST_VIDEO_DECODER_STREAM_LOCK (decoder); - if (decoder_class->set_format) ret = decoder_class->set_format (decoder, state); @@ -777,11 +785,18 @@ gst_video_decoder_setcaps (GstVideoDecoder * decoder, GstCaps * caps) return ret; - /* ERRORS */ +caps_not_changed: + { + GST_DEBUG_OBJECT (decoder, "Caps did not change - ignore"); + GST_VIDEO_DECODER_STREAM_UNLOCK (decoder); + return TRUE; + } + /* ERRORS */ parse_fail: { GST_WARNING_OBJECT (decoder, "Failed to parse caps"); + GST_VIDEO_DECODER_STREAM_UNLOCK (decoder); return FALSE; } |