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
This commit is contained in:
Vivia Nikolaidou 2017-02-01 15:13:32 +02:00 committed by Sebastian Dröge
parent 718c4140fa
commit 21a9a89851

View file

@ -429,9 +429,17 @@ gst_decklink_audio_src_get_caps (GstBaseSrc * bsrc, GstCaps * filter)
GstCaps *channel_filter, *templ; GstCaps *channel_filter, *templ;
templ = gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD (bsrc)); templ = gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD (bsrc));
channel_filter = if (self->channels_found > 0) {
gst_caps_new_simple ("audio/x-raw", "channels", G_TYPE_INT, channel_filter =
self->channels_found, NULL); 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); caps = gst_caps_intersect (channel_filter, templ);
gst_caps_unref (channel_filter); gst_caps_unref (channel_filter);
gst_caps_unref (templ); gst_caps_unref (templ);