Browse Source

MT#55283 add convenience alias flag `WebRTC`

Change-Id: Ibc2588aa629862e48664e580d5d4311bf2d3cf16
rfuchs/dataport
Richard Fuchs 2 years ago
parent
commit
9f714288fd
5 changed files with 59 additions and 10 deletions
  1. +6
    -0
      daemon/call_interfaces.c
  2. +2
    -10
      daemon/janus.c
  3. +8
    -0
      docs/ng_control_protocol.md
  4. +11
    -0
      include/call_interfaces.h
  5. +32
    -0
      t/auto-daemon-tests.pl

+ 6
- 0
daemon/call_interfaces.c View File

@ -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 */


+ 2
- 10
daemon/janus.c View File

@ -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;


+ 8
- 0
docs/ng_control_protocol.md View File

@ -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.


+ 11
- 0
include/call_interfaces.h View File

@ -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;
}


+ 32
- 0
t/auto-daemon-tests.pl View File

@ -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'] }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
c=IN IP4 198.51.100.1
t=0 0
m=audio 2000 RTP/AVP 0 8
----------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT UDP/TLS/RTP/SAVPF 0 8
a=mid:1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=sendrecv
a=rtcp-mux
a=setup:actpass
a=fingerprint:sha-256 FINGERPRINT256
a=tls-id:TLS_ID
a=ice-ufrag:ICEUFRAG
a=ice-pwd:ICEPWD
a=ice-options:trickle
a=candidate:ICEBASE 1 UDP 2130706431 203.0.113.1 PORT typ host
a=end-of-candidates
SDP
#done_testing;NGCP::Rtpengine::AutoTest::terminate('f00');exit;
done_testing();

Loading…
Cancel
Save