"TLS support is not available" 使用 libnice 创建 GTlsClientConnection 时

"TLS support is not available" when creating GTlsClientConnection with libnice

我有工作代码,其中两个对等点通过中继服务器 (coturn) 连接,并且在伪 tcp 上一切似乎都很好。我已经用 nice_agent_attach_recv()nice_agent_get_io_stream().

成功测试了消息交换

但是当我尝试创建 GTlsClientConnection 时,我返回:0:TLS support is not available

这是部分代码:

   if(!nice_agent_set_relay_info(agent, stream_id, 
       NICE_COMPONENT_TYPE_RTP, 
       "my.coturn.server", 
       5349, //tls-listener-port (I also tried the non tls port: 3478)
       username.c_str(), 
       password.c_str(), 
       NICE_RELAY_TYPE_TURN_TCP)) 
   {
        printf("error setting up relay info\n");
   }

   ...

   //after state has changed to NICE_COMPONENT_STATE_READY

   ...

   io_stream = nice_agent_get_io_stream (agent, stream_id, component_id);
   input = g_io_stream_get_input_stream (G_IO_STREAM (io_stream));
   output = g_io_stream_get_output_stream (G_IO_STREAM (io_stream));

   GIOStream* tlsConnection  = g_tls_client_connection_new 
                               (G_IO_STREAM (io_stream), NULL, &error);

   /////////////////////////
   /// error == 0 (TLS support is not available)

我是 libnice 和 glib 的新手。所以,我可能遗漏了一些基本的东西。

可能需要安装 glib-networking 软件包。