From 8d723c5fe1d35faa58214adc401d565f3a98d7ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 1 Feb 2017 16:45:53 +0200 Subject: [PATCH] decklinkvideosink: Do nothing if set_caps() is called with basically the same caps again and error out here already otherwise. We currently don't support reconfiguration here and it can't happen really either unless the auto mode is selected. --- sys/decklink/gstdecklinkvideosink.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/sys/decklink/gstdecklinkvideosink.cpp b/sys/decklink/gstdecklinkvideosink.cpp index f0f79e9ccb..4881ff8e03 100644 --- a/sys/decklink/gstdecklinkvideosink.cpp +++ b/sys/decklink/gstdecklinkvideosink.cpp @@ -336,12 +336,32 @@ gst_decklink_video_sink_set_caps (GstBaseSink * bsink, GstCaps * caps) const GstDecklinkMode *mode; HRESULT ret; BMDVideoOutputFlags flags; + GstVideoInfo info; GST_DEBUG_OBJECT (self, "Setting caps %" GST_PTR_FORMAT, caps); - if (!gst_video_info_from_caps (&self->info, caps)) + if (!gst_video_info_from_caps (&info, caps)) return FALSE; + + g_mutex_lock (&self->output->lock); + if (self->output->video_enabled) { + if (self->info.finfo->format == info.finfo->format && + self->info.width == info.width && self->info.height == info.height) { + // FIXME: We should also consider the framerate as it is used + // for mode selection below in auto mode + GST_DEBUG_OBJECT (self, "Nothing relevant has changed"); + self->info = info; + g_mutex_unlock (&self->output->lock); + return TRUE; + } else { + GST_DEBUG_OBJECT (self, "Reconfiguration not supported at this point"); + g_mutex_unlock (&self->output->lock); + return FALSE; + } + } + g_mutex_unlock (&self->output->lock); + self->output->output->SetScheduledFrameCompletionCallback (new GStreamerVideoOutputCallback (self)); @@ -387,6 +407,7 @@ gst_decklink_video_sink_set_caps (GstBaseSink * bsink, GstCaps * caps) return FALSE; } + self->info = info; g_mutex_lock (&self->output->lock); self->output->mode = mode; self->output->video_enabled = TRUE;