ionorg / ion-sfu

Pure Go WebRTC SFU
MIT License
980 stars 238 forks source link

How to add local candidate when peer connection of ion-sfu is set ice-lite. #674

Open lugy-bupt opened 1 year ago

lugy-bupt commented 1 year ago

Hi team,

I created a peer connection and set it as ice-lite and passive status like below, but I failed to find the way setting local candidate for it. How to set the local candidate when peer connection is ice-lite?

    se := webrtc.SettingEngine{}
    se.SetLite(true)
    se.SetEphemeralUDPPortRange(9090, 9090)
        se.SetAnsweringDTLSRole(webrtc.DTLSRoleServer)
    se.SetNetworkTypes([]webrtc.NetworkType{webrtc.NetworkTypeUDP4})
    se.SetNAT1To1IPs([]string{"x.x.x.x"}, webrtc.ICECandidateTypeHost)
        ...

        api := webrtc.NewAPI(webrtc.WithMediaEngine(&me), webrtc.WithSettingEngine(se))
    pc, err := api.NewPeerConnection(webrtc.Configuration{})

The answer generated is below, and there is no candidate.

answer v=0
o=- 1455384849914031032 1671779282 IN IP4 0.0.0.0
s=-
t=0 0
a=fingerprint:sha-256 BD:8B:B0:31:BC:6E:41:76:A4:BF:BB:FA:2C:3D:51:42:48:D7:CC:7F:02:7B:98:25:4E:FE:C7:9A:03:54:9B:3B
a=ice-lite
a=extmap-allow-mixed
a=group:BUNDLE 0
m=audio 9 UDP/TLS/RTP/SAVPF 111 9 0 8
c=IN IP4 0.0.0.0
a=setup:passive
a=mid:0
a=ice-ufrag:ZwwyifEGbkkDlyOG
a=ice-pwd:syeKIeSKHXDootmMhfeOgLzWSLmkBDgb
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:111 opus/48000/2
a=fmtp:111 minptime=10;useinbandfec=1
a=rtcp-fb:111 transport-cc 
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=recvonly
birdyGrong commented 1 year ago

I have the same question, how did you solve it ?