EricssonResearch / EricssonResearch/openwebrtc
TURN support
- Dominant language
- C
- Stars
- 1.8k
- Forks
- 531
- PR merge metrics
- No merged PRs in 30d
Description
One basic question, since I try to figure out what's my problem, ref: https://github.com/EricssonResearch/openwebrtc-ios-sdk/issues/59
but I found after I print all of the data from remote NICE candidate, there is NOT any TURN info,
```
(:3569): libnice-CRITICAL **: file address.c: line 280 (nice_address_to_string): should not be reached
nice_remote_candidate No.1 NiceCandidateType: CANDIDATE_TYPE_HOST,NiceCandidateTransport: TRANSPORT_TYPE_UDP,addr: 192.168.1.207,base_addr: ,priority: 2122260223, stream_id: 1, component_id: 1,username: mC3vpYCw/WK+/hWa,password:jXLq0MSHZLqzial7Ki9hM1jb,
NO TURN
(:3569): libnice-CRITICAL **: file address.c: line 280 (nice_address_to_string): should not be reached
nice_remote_candidate No.2 NiceCandidateType: CANDIDATE_TYPE_HOST,NiceCandidateTransport: TRANSPORT_TYPE_UDP,addr: 192.168.18.132,base_addr: ,priority: 2122194687, stream_id: 1, component_id: 1,username: mC3vpYCw/WK+/hWa,password:jXLq0MSHZLqzial7Ki9hM1jb,
NO TURN
(:3569): libnice-CRITICAL **: file address.c: line 280 (nice_address_to_string): should not be reached
nice_remote_candidate No.3 NiceCandidateType: CANDIDATE_TYPE_SERVER_REFLEXIVE,NiceCandidateTransport: TRANSPORT_TYPE_UDP,addr: 220.130.33.227,base_addr: ,priority: 1686052607, stream_id: 1, component_id: 1,username: mC3vpYCw/WK+/hWa,password:jXLq0MSHZLqzial7Ki9hM1jb,
NO TURN
(:3569): libnice-CRITICAL **: file address.c: line 280 (nice_address_to_string): should not be reached
nice_remote_candidate No.4 NiceCandidateType: CANDIDATE_TYPE_SERVER_REFLEXIVE,NiceCandidateTransport: TRANSPORT_TYPE_UDP,addr: 116.226.127.167,base_addr: ,priority: 1685987071, stream_id: 1, component_id: 1,username: mC3vpYCw/WK+/hWa,password:jXLq0MSHZLqzial7Ki9hM1jb,
NO TURN
(:3569): libnice-CRITICAL **: file address.c: line 280 (nice_address_to_string): should not be reached
nice_remote_candidate No.5 NiceCandidateType: CANDIDATE_TYPE_RELAY,NiceCandidateTransport: TRANSPORT_TYPE_UDP,addr: 54.178.56.14,base_addr: ,priority: 41885439, stream_id: 1, component_id: 1,username: mC3vpYCw/WK+/hWa,password:jXLq0MSHZLqzial7Ki9hM1jb,
NO TURN
(:3569): libnice-CRITICAL **: file address.c: line 280 (nice_address_to_string): should not be reached
nice_remote_candidate No.6 NiceCandidateType: CANDIDATE_TYPE_RELAY,NiceCandidateTransport: TRANSPORT_TYPE_UDP,addr: 54.178.56.14,base_addr: ,priority: 41885439, stream_id: 1, component_id: 1,username: mC3vpYCw/WK+/hWa,password:jXLq0MSHZLqzial7Ki9hM1jb,
NO TURN
(:3569): libnice-CRITICAL **: file address.c: line 280 (nice_address_to_string): should not be reached
nice_remote_candidate No.7 NiceCandidateType: CANDIDATE_TYPE_RELAY,NiceCandidateTransport: TRANSPORT_TYPE_UDP,addr: 54.178.56.14,base_addr: ,priority: 41819903, stream_id: 1, component_id: 1,username: mC3vpYCw/WK+/hWa,password:jXLq0MSHZLqzial7Ki9hM1jb,
NO TURN
(:3569): libnice-CRITICAL **: file address.c: line 280 (nice_address_to_string): should not be reached
nice_remote_candidate No.8 NiceCandidateType: CANDIDATE_TYPE_RELAY,NiceCandidateTransport: TRANSPORT_TYPE_UDP,addr: 54.178.56.14,base_addr: ,priority: 41819903, stream_id: 1, component_id: 1,username: mC3vpYCw/WK+/hWa,password:jXLq0MSHZLqzial7Ki9hM1jb,
NO TURN
(:3569): libnice-CRITICAL **: file address.c: line 280 (nice_address_to_string): should not be reached
nice_remote_candidate No.9 NiceCandidateType: CANDIDATE_TYPE_RELAY,NiceCandidateTransport: TRANSPORT_TYPE_UDP,addr: 54.178.56.14,base_addr: ,priority: 25108223, stream_id: 1, component_id: 1,username: mC3vpYCw/WK+/hWa,password:jXLq0MSHZLqzial7Ki9hM1jb,
NO TURN
(:3569): libnice-CRITICAL **: file address.c: line 280 (nice_address_to_string): should not be reached
nice_remote_candidate No.10 NiceCandidateType: CANDIDATE_TYPE_RELAY,NiceCandidateTransport: TRANSPORT_TYPE_UDP,addr: 54.178.56.14,base_addr: ,priority: 25108223, stream_id: 1, component_id: 1,username: mC3vpYCw/WK+/hWa,password:jXLq0MSHZLqzial7Ki9hM1jb,
NO TURN
local_candidate No.1 candidate_type: CANDIDATE_TYPE_HOST,component_type: COMPONENT_TYPE_RTP,foundation: 2833646159,transport_type: TRANSPORT_TYPE_UDP,address: 192.168.1.207, port: 62390, priority: 2122260223,related_address: ,related_port:0
local_candidate No.2 candidate_type: CANDIDATE_TYPE_HOST,component_type: COMPONENT_TYPE_RTP,foundation: 1966334295,transport_type: TRANSPORT_TYPE_UDP,address: 192.168.18.132, port: 54597, priority: 2122194687,related_address: ,related_port:0
local_candidate No.3 candidate_type: CANDIDATE_TYPE_SERVER_REFLEXIVE,component_type: COMPONENT_TYPE_RTP,foundation: 699270395,transport_type: TRANSPORT_TYPE_UDP,address: 220.130.33.227, port: 62390, priority: 1686052607,related_address: ,related_port:0
local_candidate No.4 candidate_type: CANDIDATE_TYPE_SERVER_REFLEXIVE,component_type: COMPONENT_TYPE_RTP,foundation: 3116293828,transport_type: TRANSPORT_TYPE_UDP,address: 116.226.127.167, port: 54597, priority: 1685987071,related_address: ,related_port:0
local_candidate No.5 candidate_type: CANDIDATE_TYPE_RELAY,component_type: COMPONENT_TYPE_RTP,foundation: 841301765,transport_type: TRANSPORT_TYPE_UDP,address: 54.178.56.14, port: 51638, priority: 41885439,related_address: ,related_port:0
local_candidate No.6 candidate_type: CANDIDATE_TYPE_RELAY,component_type: COMPONENT_TYPE_RTP,foundation: 841301765,transport_type: TRANSPORT_TYPE_UDP,address: 54.178.56.14, port: 58119, priority: 41885439,related_address: ,related_port:0
local_candidate No.7 candidate_type: CANDIDATE_TYPE_RELAY,component_type: COMPONENT_TYPE_RTP,foundation: 841301765,transport_type: TRANSPORT_TYPE_UDP,address: 54.178.56.14, port: 61101, priority: 41819903,related_address: ,related_port:0
local_candidate No.8 candidate_type: CANDIDATE_TYPE_RELAY,component_type: COMPONENT_TYPE_RTP,foundation: 841301765,transport_type: TRANSPORT_TYPE_UDP,address: 54.178.56.14, port: 54455, priority: 41819903,related_address: ,related_port:0
local_candidate No.9 candidate_type: CANDIDATE_TYPE_RELAY,component_type: COMPONENT_TYPE_RTP,foundation: 841301765,transport_type: TRANSPORT_TYPE_UDP,address: 54.178.56.14, port: 50767, priority: 25108223,related_address: ,related_port:0
local_candidate No.10 candidate_type: CANDIDATE_TYPE_RELAY,component_type: COMPONENT_TYPE_RTP,foundation: 841301765,transport_type: TRANSPORT_TYPE_UDP,address: 54.178.56.14, port: 61385, priority: 25108223,related_address: ,related_port:0
```
then I take look the code in owr_transport_agent.c and owr_candidate.c
```
NiceCandidate * _owr_candidate_to_nice_candidate(OwrCandidate *candidate)
{
OwrCandidatePrivate *priv;
NiceCandidate *nice_candidate;
NiceCandidateType candidate_type;
NiceComponentType component_type;
NiceCandidateTransport transport;
g_return_val_if_fail(candidate, NULL);
priv = candidate->priv;
switch (priv->type) {
case OWR_CANDIDATE_TYPE_HOST:
candidate_type = NICE_CANDIDATE_TYPE_HOST;
break;
case OWR_CANDIDATE_TYPE_SERVER_REFLEXIVE:
candidate_type = NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE;
break;
case OWR_CANDIDATE_TYPE_PEER_REFLEXIVE:
candidate_type = NICE_CANDIDATE_TYPE_PEER_REFLEXIVE;
break;
case OWR_CANDIDATE_TYPE_RELAY:
candidate_type = NICE_CANDIDATE_TYPE_RELAYED;
break;
default:
g_return_val_if_reached(NULL);
}
switch (priv->component_type) {
case OWR_COMPONENT_TYPE_RTP:
component_type = NICE_COMPONENT_TYPE_RTP;
break;
case OWR_COMPONENT_TYPE_RTCP:
component_type = NICE_COMPONENT_TYPE_RTCP;
break;
default:
g_return_val_if_reached(NULL);
}
switch (priv->transport_type) {
case OWR_TRANSPORT_TYPE_UDP:
transport = NICE_CANDIDATE_TRANSPORT_UDP;
break;
case OWR_TRANSPORT_TYPE_TCP_ACTIVE:
transport = NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE;
break;
case OWR_TRANSPORT_TYPE_TCP_PASSIVE:
transport = NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE;
break;
case OWR_TRANSPORT_TYPE_TCP_SO:
transport = NICE_CANDIDATE_TRANSPORT_TCP_SO;
break;
default:
g_return_val_if_reached(NULL);
}
g_return_val_if_fail(priv->address && strlen(priv->address) > 0, NULL);
g_return_val_if_fail(priv->port || transport == NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE, NULL);
nice_candidate = nice_candidate_new(candidate_type);
nice_candidate->transport = NICE_CANDIDATE_TRANSPORT_UDP;
nice_candidate->component_id = component_type;
nice_candidate->transport = transport;
nice_address_set_from_string(&nice_candidate->addr, priv->address);
nice_address_set_port(&nice_candidate->addr, priv->port);
if (priv->base_address && strlen(priv->base_address) > 0)
nice_address_set_from_string(&nice_candidate->base_addr, priv->base_address);
if (priv->base_port)
nice_address_set_port(&nice_candidate->base_addr, priv->base_port);
if (priv->foundation && strlen(priv->foundation) > 0) {
g_strlcpy((gchar *)&nice_candidate->foundation, priv->foundation,
MIN(NICE_CANDIDATE_MAX_FOUNDATION, 1 + strlen(priv->foundation)));
}
nice_candidate->priority = candidate->priv->priority;
if (priv->ufrag && strlen(priv->ufrag) > 0)
nice_candidate->username = g_strdup(priv->ufrag);
if (priv->password && strlen(priv->password) > 0)
nice_candidate->password = g_strdup(priv->password);
return nice_candidate;
}
```
there is don't need to set any TURN server info set?
```
struct _TurnServer
{
gint ref_count;
NiceAddress server;
gchar *username;
gchar *password;
NiceRelayType type;
};
```
Contributor guide
Research direction
Start with owr_transport_agent.c and owr_candidate.c, especially _owr_candidate_to_nice_candidate(), and compare the candidate conversion with the _TurnServer structure shown in the issue. Trace how relay candidates and TURN configuration are represented and passed to libnice; done means the expected TURN information is correctly accounted for or the missing behavior is documented with a focused reproduction or test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- audio-video-rtc, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100