bluetooth/gst: Add assertions around element_add_pad and bin_add
authorMarijn Suijten <marijns95@gmail.com>
Thu, 21 Jan 2021 11:04:23 +0000 (12:04 +0100)
committerMarijn Suijten <marijns95@gmail.com>
Fri, 22 Jan 2021 08:47:09 +0000 (09:47 +0100)
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/484>

src/modules/bluetooth/a2dp-codec-aptx-gst.c
src/modules/bluetooth/a2dp-codec-ldac-gst.c

index f949115..cdf92f7 100644 (file)
@@ -362,14 +362,14 @@ bool gst_init_aptx(struct gst_info *info, pa_sample_spec *ss, bool for_encoding)
         info->enc_bin = gst_bin_new("aptx_enc_bin");
         pa_assert(info->enc_bin);
 
-        gst_bin_add(GST_BIN(info->enc_bin), enc);
+        pa_assert_se(gst_bin_add(GST_BIN(info->enc_bin), enc));
 
         pad = gst_element_get_static_pad(enc, "sink");
-        gst_element_add_pad(info->enc_bin, gst_ghost_pad_new("sink", pad));
+        pa_assert_se(gst_element_add_pad(info->enc_bin, gst_ghost_pad_new("sink", pad)));
         gst_object_unref(GST_OBJECT(pad));
 
         pad = gst_element_get_static_pad(enc, "src");
-        gst_element_add_pad(info->enc_bin, gst_ghost_pad_new("src", pad));
+        pa_assert_se(gst_element_add_pad(info->enc_bin, gst_ghost_pad_new("src", pad)));
         gst_object_unref(GST_OBJECT(pad));
     } else {
         dec = gst_element_factory_make("openaptxdec", "aptx_decoder");
@@ -398,14 +398,14 @@ bool gst_init_aptx(struct gst_info *info, pa_sample_spec *ss, bool for_encoding)
         info->dec_bin = gst_bin_new("aptx_dec_bin");
         pa_assert(info->dec_bin);
 
-        gst_bin_add(GST_BIN(info->dec_bin), dec);
+        pa_assert_se(gst_bin_add(GST_BIN(info->dec_bin), dec));
 
         pad = gst_element_get_static_pad(dec, "sink");
-        gst_element_add_pad(info->dec_bin, gst_ghost_pad_new("sink", pad));
+        pa_assert_se(gst_element_add_pad(info->dec_bin, gst_ghost_pad_new("sink", pad)));
         gst_object_unref(GST_OBJECT(pad));
 
         pad = gst_element_get_static_pad(dec, "src");
-        gst_element_add_pad(info->dec_bin, gst_ghost_pad_new("src", pad));
+        pa_assert_se(gst_element_add_pad(info->dec_bin, gst_ghost_pad_new("src", pad)));
         gst_object_unref(GST_OBJECT(pad));
     }
 
index 313ff5b..45fe0f0 100644 (file)
@@ -291,11 +291,11 @@ bool gst_init_ldac(struct gst_info *info, pa_sample_spec *ss, bool for_encoding)
     }
 
     pad = gst_element_get_static_pad(enc, "sink");
-    gst_element_add_pad(info->enc_bin, gst_ghost_pad_new("sink", pad));
+    pa_assert_se(gst_element_add_pad(info->enc_bin, gst_ghost_pad_new("sink", pad)));
     gst_object_unref(GST_OBJECT(pad));
 
     pad = gst_element_get_static_pad(rtpldacpay, "src");
-    gst_element_add_pad(info->enc_bin, gst_ghost_pad_new("src", pad));
+    pa_assert_se(gst_element_add_pad(info->enc_bin, gst_ghost_pad_new("src", pad)));
     gst_object_unref(GST_OBJECT(pad));
 
     return true;