sendrecv: Add a Google STUN server to the configuration
authorNirbheek Chauhan <nirbheek@centricular.com>
Tue, 12 Dec 2017 16:10:09 +0000 (21:40 +0530)
committerNirbheek Chauhan <nirbheek@centricular.com>
Tue, 12 Dec 2017 16:10:48 +0000 (21:40 +0530)
Without this, the example will only work on link-local and localhost
networks.

webrtc/sendrecv/gst/webrtc-sendrecv.c

index bab1047..c823f65 100644 (file)
@@ -250,6 +250,7 @@ on_negotiation_needed (GstElement * element, gpointer user_data)
   g_signal_emit_by_name (webrtc1, "create-offer", NULL, promise);
 }
 
+#define STUN_SERVER " stun-server=stun://stun.l.google.com:19302 "
 #define RTP_CAPS_OPUS "application/x-rtp,media=audio,encoding-name=OPUS,payload="
 #define RTP_CAPS_VP8 "application/x-rtp,media=video,encoding-name=VP8,payload="
 
@@ -260,7 +261,7 @@ start_pipeline (void)
   GError *error = NULL;
 
   pipe1 =
-      gst_parse_launch ("webrtcbin name=sendrecv "
+      gst_parse_launch ("webrtcbin name=sendrecv " STUN_SERVER
       "videotestsrc pattern=ball ! queue ! vp8enc deadline=1 ! rtpvp8pay ! "
       "queue ! " RTP_CAPS_VP8 "96 ! sendrecv. "
       "audiotestsrc wave=red-noise ! queue ! opusenc ! rtpopuspay ! "