audioaggregator: Fix negotiation with downstream if there is no peer yet
authorSebastian Dröge <sebastian@centricular.com>
Thu, 9 Jul 2020 09:45:27 +0000 (12:45 +0300)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 9 Jul 2020 16:48:02 +0000 (16:48 +0000)
get_allowed_caps() will return NULL, which is not a problem in itself.
Just take the template caps for negotiation in that case instead of
erroring out.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/744>

gst-libs/gst/audio/gstaudioaggregator.c

index f83c617..1d45170 100644 (file)
@@ -875,7 +875,11 @@ gst_audio_aggregator_sink_setcaps (GstAudioAggregatorPad * aaggpad,
   gint downstream_rate;
   GstStructure *s;
 
-  if (!downstream_caps || gst_caps_is_empty (downstream_caps)) {
+  /* Returns NULL if there is no downstream peer */
+  if (!downstream_caps)
+    downstream_caps = gst_pad_get_pad_template_caps (agg->srcpad);
+
+  if (gst_caps_is_empty (downstream_caps)) {
     ret = FALSE;
     goto done;
   }