summaryrefslogtreecommitdiff
path: root/sys/decklink
diff options
context:
space:
mode:
authorVivia Nikolaidou <vivia@toolsonair.com>2017-02-01 15:13:32 +0200
committerSebastian Dröge <sebastian@centricular.com>2017-02-01 15:17:33 +0200
commit21a9a8985163c6cdadb673af369401f974a8afe9 (patch)
tree0948fbd957c85ce7ee905495e5db29380b4e81d7 /sys/decklink
parent718c4140fac99c2fa7cdb25860566d2d9fa0eec3 (diff)
downloadgstreamer-plugins-bad-21a9a8985163c6cdadb673af369401f974a8afe9.tar.gz
decklinkaudiosrc: Fix get_caps returning EMPTY
If get_caps is called before negotiation, channels_found will be 0 and therefore won't intersect with the template caps. https://bugzilla.gnome.org/show_bug.cgi?id=778028
Diffstat (limited to 'sys/decklink')
-rw-r--r--sys/decklink/gstdecklinkaudiosrc.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/decklink/gstdecklinkaudiosrc.cpp b/sys/decklink/gstdecklinkaudiosrc.cpp
index 93e16d168..1fc1a696c 100644
--- a/sys/decklink/gstdecklinkaudiosrc.cpp
+++ b/sys/decklink/gstdecklinkaudiosrc.cpp
@@ -429,9 +429,17 @@ gst_decklink_audio_src_get_caps (GstBaseSrc * bsrc, GstCaps * filter)
GstCaps *channel_filter, *templ;
templ = gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD (bsrc));
- channel_filter =
- gst_caps_new_simple ("audio/x-raw", "channels", G_TYPE_INT,
- self->channels_found, NULL);
+ if (self->channels_found > 0) {
+ channel_filter =
+ gst_caps_new_simple ("audio/x-raw", "channels", G_TYPE_INT,
+ self->channels_found, NULL);
+ } else if (self->channels > 0) {
+ channel_filter =
+ gst_caps_new_simple ("audio/x-raw", "channels", G_TYPE_INT,
+ self->channels, NULL);
+ } else {
+ channel_filter = gst_caps_new_empty_simple ("audio/x-raw");
+ }
caps = gst_caps_intersect (channel_filter, templ);
gst_caps_unref (channel_filter);
gst_caps_unref (templ);