Is it possible to reuse a DTLS certificate (WebRTCbin)?

Hello,

I am using a webrtcbin pipeline to send video from a low resource embedded cpu to chrome browser. It is working well but it can take up to 20 sec between on_negotiation_needed_cb() and on_offer_created_cb(). My understanding is my low ressource cpu takes time to generate the DTLS certificate.

I tried to reuse the certificate by setting it in on_negotiation_needed_cb():

void on_negotiation_needed_cb(GstElement *webrtcbin, gpointer user_data)
{
...
// load cert from file ( was saved in a previous call to on_offer_created_cb() )
... 
          GstWebRTCRTPTransceiver *trans;
          g_signal_emit_by_name(webrtcbin, "get-transceiver", 0, &trans);
          GstWebRTCRTPSender *sender;
          g_object_get(trans, "sender", &sender, NULL);
          GstWebRTCDTLSTransport *dtls_transport;
          g_object_get(sender, "transport", &dtls_transport, NULL);
          // dtls_transport is null at this point, so we can't initialise certificate
          g_object_set(dtls_transport, "certificate", cert.c_str(), NULL);
...

Like the comment says the GstWebRTCDTLSTransport does not exist in the GstWebRTCRTPSender at this point so the set fail because dtls_transport is NULL.

Is there a way to set the dtls certificate to avoid the 20 sec delay?

Not currently. webrtcbin does not currently support custom DTLS certificates.

Thanks for the quick reply @ystreet00