[calls] sip: media-pipeline: Check codec availability before setup



commit 29742a5f8dc774143030b7aada004d0791f6aea5
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date:   Mon Feb 28 08:39:47 2022 +0100

    sip: media-pipeline: Check codec availability before setup

 plugins/sip/calls-sip-media-pipeline.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/plugins/sip/calls-sip-media-pipeline.c b/plugins/sip/calls-sip-media-pipeline.c
index c52d81d2..84af9fa4 100644
--- a/plugins/sip/calls-sip-media-pipeline.c
+++ b/plugins/sip/calls-sip-media-pipeline.c
@@ -279,7 +279,6 @@ send_pipeline_setup_codecs (CallsSipMediaPipeline *self,
   g_assert (CALLS_IS_SIP_MEDIA_PIPELINE (self));
   g_assert (codec);
 
-  /* TODO check if codec is available */
   MAKE_ELEMENT (encoder, codec->gst_encoder_name, "encoder");
   MAKE_ELEMENT (payloader, codec->gst_payloader_name, "payloader");
 
@@ -458,7 +457,6 @@ recv_pipeline_setup_codecs (CallsSipMediaPipeline *self,
   g_assert (CALLS_IS_SIP_MEDIA_PIPELINE (self));
   g_assert (codec);
 
-  /* TODO check if codec is available */
   MAKE_ELEMENT (decoder, codec->gst_decoder_name, "decoder");
   MAKE_ELEMENT (depayloader, codec->gst_depayloader_name, "depayloader");
 
@@ -812,6 +810,12 @@ calls_sip_media_pipeline_set_codec (CallsSipMediaPipeline *self,
     return;
   }
 
+  if (!media_codec_available_in_gst (codec)) {
+    g_warning ("Cannot setup pipeline with codec '%s' because it's not available in GStreamer",
+               codec->name);
+    return;
+  }
+
   if (!recv_pipeline_setup_codecs (self, codec, &error)) {
     g_warning ("Error trying to setup codec for receive pipeline: %s",
                error->message);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]