Joiner desktop windows (#89)
* base classes/logic from a playground * fix sandbox * add vk support
This commit is contained in:
1 parent
1308361eb6
commit
30ed29a161
34 files changed
+7056
No files matched your search
@@ -29,6 +29,12 @@ const (
|
||||
type TelemostHeadlessJoiner struct {
|
||||
logFn func(string, ...any)
|
||||
OnConnected func(tunnel.DataTunnel)
|
||||
// OnRemoteCandidate is fired for every trickle ICE candidate the
|
||||
// Telemost SFU sends, and once per incoming SDP (target=-1) so
|
||||
// callers can extract any candidates carried inline. The Windows
|
||||
// joiner uses these to install /32 bypass routes before the
|
||||
// candidate is added to Pion's PeerConnection.
|
||||
OnRemoteCandidate func(target int, candidateOrSDP string)
|
||||
ResolveFn ResolveFunc
|
||||
Status StatusEmitter
|
||||
PCConfig PeerConnectionConfigurer
|
||||
@@ -442,6 +448,9 @@ func (j *TelemostHeadlessJoiner) handlePubAnswer(sdp string) {
|
||||
if j.pubPC == nil {
|
||||
return
|
||||
}
|
||||
if j.OnRemoteCandidate != nil {
|
||||
j.OnRemoteCandidate(-1, sdp)
|
||||
}
|
||||
err := j.pubPC.SetRemoteDescription(webrtc.SessionDescription{
|
||||
Type: webrtc.SDPTypeAnswer,
|
||||
SDP: sdp,
|
||||
@@ -476,6 +485,9 @@ func (j *TelemostHeadlessJoiner) handleSubOffer(sdp string, pcSeq int) {
|
||||
j.logFn("telemost-joiner: sub PC not ready for offer")
|
||||
return
|
||||
}
|
||||
if j.OnRemoteCandidate != nil {
|
||||
j.OnRemoteCandidate(-1, sdp)
|
||||
}
|
||||
|
||||
err := j.subPC.SetRemoteDescription(webrtc.SessionDescription{
|
||||
Type: webrtc.SDPTypeOffer,
|
||||
@@ -553,6 +565,14 @@ func (j *TelemostHeadlessJoiner) handleMessage(raw []byte) {
|
||||
idx := uint16(sdpIdx)
|
||||
cand := webrtc.ICECandidateInit{Candidate: candidate, SDPMid: &sdpMid, SDPMLineIndex: &idx}
|
||||
|
||||
if j.OnRemoteCandidate != nil {
|
||||
tgt := 1
|
||||
if target == "SUBSCRIBER" {
|
||||
tgt = 0
|
||||
}
|
||||
j.OnRemoteCandidate(tgt, candidate)
|
||||
}
|
||||
|
||||
if target == "SUBSCRIBER" {
|
||||
if j.subRemoteSet {
|
||||
j.subPC.AddICECandidate(cand)
|
||||
|
||||
@@ -47,6 +47,12 @@ type VKJoinResponse struct {
|
||||
type VKHeadlessJoiner struct {
|
||||
logFn func(string, ...any)
|
||||
OnConnected func(tunnel.DataTunnel)
|
||||
// OnRemoteCandidate is fired for every trickle ICE candidate the
|
||||
// VK SFU sends and once per incoming SDP (target=-1) so the caller
|
||||
// can extract any candidates carried inline. The Windows joiner
|
||||
// uses this to install /32 bypass routes before the candidate
|
||||
// reaches Pion.
|
||||
OnRemoteCandidate func(target int, candidateOrSDP string)
|
||||
ResolveFn ResolveFunc
|
||||
Status StatusEmitter
|
||||
PCConfig PeerConnectionConfigurer
|
||||
@@ -520,6 +526,9 @@ func (h *VKHeadlessJoiner) onTransmittedData(data map[string]interface{}) {
|
||||
candidateJSON, _ := json.Marshal(candidate)
|
||||
var candidateInit webrtc.ICECandidateInit
|
||||
json.Unmarshal(candidateJSON, &candidateInit)
|
||||
if h.OnRemoteCandidate != nil {
|
||||
h.OnRemoteCandidate(0, candidateInit.Candidate)
|
||||
}
|
||||
if h.remoteSet {
|
||||
h.pc.AddICECandidate(candidateInit)
|
||||
} else {
|
||||
@@ -530,6 +539,9 @@ func (h *VKHeadlessJoiner) onTransmittedData(data map[string]interface{}) {
|
||||
if sdp, ok := data["sdp"].(map[string]interface{}); ok {
|
||||
sdpType, _ := sdp["type"].(string)
|
||||
sdpStr, _ := sdp["sdp"].(string)
|
||||
if h.OnRemoteCandidate != nil {
|
||||
h.OnRemoteCandidate(-1, sdpStr)
|
||||
}
|
||||
h.logFn("headless: remote SDP: %s", sdpType)
|
||||
|
||||
if sdpType == "answer" {
|
||||
|
||||
Reference in new issue
Block a user