diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index b042ee6a1..141ca4208 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -1192,6 +1192,12 @@ void call_ng_flags_flags(sdp_ng_flags *out, str *s, helper_arg dummy) { case CSH_LOOKUP("unidirectional"): out->unidirectional = 1; break; + case CSH_LOOKUP("webrtc"): + case CSH_LOOKUP("webRTC"): + case CSH_LOOKUP("WebRTC"): + case CSH_LOOKUP("WebRtc"): + ng_flags_webrtc(out); + break; default: /* handle values aliases from other dictionaries */ diff --git a/daemon/janus.c b/daemon/janus.c index 5dbee76f9..116a5536e 100644 --- a/daemon/janus.c +++ b/daemon/janus.c @@ -630,16 +630,8 @@ static const char *janus_videoroom_join(struct websocket_message *wm, struct jan flags.generate_mid = 1; flags.rtcp_mirror = 1; - if (!plain_offer) { - // set all WebRTC-specific attributes - flags.transport_protocol = &transport_protocols[PROTO_UDP_TLS_RTP_SAVPF]; - flags.ice_option = ICE_FORCE; - flags.trickle_ice = 1; - flags.rtcp_mux_offer = 1; - flags.rtcp_mux_require = 1; - flags.no_rtcp_attr = 1; - flags.sdes_off = 1; - } + if (!plain_offer) + ng_flags_webrtc(&flags); else { flags.transport_protocol = &transport_protocols[PROTO_RTP_AVP]; flags.ice_option = ICE_REMOVE; diff --git a/docs/ng_control_protocol.md b/docs/ng_control_protocol.md index 4fecb3fc4..3623621d5 100644 --- a/docs/ng_control_protocol.md +++ b/docs/ng_control_protocol.md @@ -1124,6 +1124,14 @@ Spaces in each string may be replaced by hyphens. When this flag is present, kernelize also one-way rtp media. +* `WebRTC` + + Shortcut alias for several other flags that must be set when talking to a + WebRTC client. Currently an alias for (subject to change): + `transport-protocol=UDP/TLS/RTP/SAVPF` `ICE=force` `tricke-ICE` + `rtcp-mux-offer` `rtcp-mux-require` `no-rtcp-attribute` `SDES-off` + `generate-mid` + **Optionally included replace-flags are:** Similar to the usual `flags` list, but this one controls which parts of the SDP body should be rewritten. diff --git a/include/call_interfaces.h b/include/call_interfaces.h index df6105e5d..e2afb53bb 100644 --- a/include/call_interfaces.h +++ b/include/call_interfaces.h @@ -316,6 +316,17 @@ INLINE struct sdp_manipulations *sdp_manipulations_get_by_name(sdp_ng_flags *f, return NULL; return sdp_manipulations_get_create_by_id(f, id); } +// set all WebRTC-specific attributes +INLINE void ng_flags_webrtc(sdp_ng_flags *f) { + f->transport_protocol = &transport_protocols[PROTO_UDP_TLS_RTP_SAVPF]; + f->ice_option = ICE_FORCE; + f->trickle_ice = 1; + f->rtcp_mux_offer = 1; + f->rtcp_mux_require = 1; + f->no_rtcp_attr = 1; + f->sdes_off = 1; + f->generate_mid = 1; +} diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index 2b94abd77..91505105e 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -22959,5 +22959,37 @@ rcv($sock_ax, $port_bx, qr/^\x80\xc8\x00\x06\x69\x28\x80\x8c\xe9\x71\x56\xff\xcc +offer('webrtc', { flags => ['WebRTC'] }, <