sbc/ldac: Don't use GST_CAPS_NONE to mean NULL
authorOlivier CrĂȘte <olivier.crete@collabora.com>
Fri, 11 Dec 2020 19:52:20 +0000 (14:52 -0500)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 7 Apr 2021 21:14:50 +0000 (21:14 +0000)
The GST_CAPS_NONE macro actually returns a instance of
a empty caps.

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

ext/ldac/gstldacenc.c
ext/sbc/gstsbcenc.c

index 1820d3a..ec4c04f 100644 (file)
@@ -197,11 +197,11 @@ gst_ldac_enc_do_negotiate (GstAudioEncoder * audio_enc)
 
   /* Negotiate output format based on downstream caps restrictions */
   caps = gst_pad_get_allowed_caps (GST_AUDIO_ENCODER_SRC_PAD (enc));
-  if (caps == GST_CAPS_NONE || gst_caps_is_empty (caps))
-    goto failure;
 
   if (caps == NULL)
     caps = gst_static_pad_template_get_caps (&ldac_enc_src_factory);
+  else if (gst_caps_is_empty (caps))
+    goto failure;
 
   /* Fixate output caps */
   filter_caps = gst_caps_new_simple ("audio/x-ldac", "rate", G_TYPE_INT,
index 6dae1bf..8948df8 100644 (file)
@@ -89,11 +89,11 @@ gst_sbc_enc_set_format (GstAudioEncoder * audio_enc, GstAudioInfo * info)
 
   /* negotiate output format based on downstream caps restrictions */
   caps = gst_pad_get_allowed_caps (GST_AUDIO_ENCODER_SRC_PAD (enc));
-  if (caps == GST_CAPS_NONE || gst_caps_is_empty (caps))
-    goto failure;
 
   if (caps == NULL)
     caps = gst_static_pad_template_get_caps (&sbc_enc_src_factory);
+  else if (gst_caps_is_empty (caps))
+    goto failure;
 
   /* fixate output caps */
   filter_caps = gst_caps_new_simple ("audio/x-sbc", "rate", G_TYPE_INT,