Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
galene
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
galene
Commits
6005ad9e
Commit
6005ad9e
authored
May 22, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create a connection interface, use it in gotICE.
parent
6d6cb6ca
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
11 deletions
+28
-11
client.go
client.go
+16
-11
conn.go
conn.go
+12
-0
No files found.
client.go
View file @
6005ad9e
...
...
@@ -654,6 +654,18 @@ func getDownConn(c *client, id string) *downConnection {
return
conn
}
func
getConn
(
c
*
client
,
id
string
)
connection
{
up
:=
getUpConn
(
c
,
id
)
if
up
!=
nil
{
return
up
}
down
:=
getDownConn
(
c
,
id
)
if
down
!=
nil
{
return
down
}
return
nil
}
func
addDownConn
(
c
*
client
,
id
string
,
remote
*
upConnection
)
(
*
downConnection
,
error
)
{
pc
,
err
:=
groups
.
api
.
NewPeerConnection
(
iceConfiguration
())
if
err
!=
nil
{
...
...
@@ -1065,18 +1077,11 @@ func gotAnswer(c *client, id string, answer webrtc.SessionDescription) error {
}
func
gotICE
(
c
*
client
,
candidate
*
webrtc
.
ICECandidateInit
,
id
string
)
error
{
var
pc
*
webrtc
.
PeerConnection
down
:=
getDownConn
(
c
,
id
)
if
down
!=
nil
{
pc
=
down
.
pc
}
else
{
up
:=
getUpConn
(
c
,
id
)
if
up
==
nil
{
return
errors
.
New
(
"unknown id in ICE"
)
}
pc
=
up
.
pc
conn
:=
getConn
(
c
,
id
)
if
conn
==
nil
{
return
errors
.
New
(
"unknown id in ICE"
)
}
return
pc
.
AddICECandidate
(
*
candidate
)
return
conn
.
getPC
()
.
AddICECandidate
(
*
candidate
)
}
func
(
c
*
client
)
setRequested
(
requested
map
[
string
]
uint32
)
error
{
...
...
conn.go
View file @
6005ad9e
...
...
@@ -16,6 +16,10 @@ import (
"github.com/pion/webrtc/v2"
)
type
connection
interface
{
getPC
()
*
webrtc
.
PeerConnection
}
type
upTrack
struct
{
track
*
webrtc
.
Track
label
string
...
...
@@ -95,6 +99,10 @@ type upConnection struct {
iceCandidates
[]
*
webrtc
.
ICECandidateInit
}
func
(
up
*
upConnection
)
getPC
()
*
webrtc
.
PeerConnection
{
return
up
.
pc
}
func
getUpMid
(
pc
*
webrtc
.
PeerConnection
,
track
*
webrtc
.
Track
)
string
{
for
_
,
t
:=
range
pc
.
GetTransceivers
()
{
if
t
.
Receiver
()
!=
nil
&&
t
.
Receiver
()
.
Track
()
==
track
{
...
...
@@ -189,3 +197,7 @@ type downConnection struct {
tracks
[]
*
downTrack
iceCandidates
[]
*
webrtc
.
ICECandidateInit
}
func
(
down
*
downConnection
)
getPC
()
*
webrtc
.
PeerConnection
{
return
down
.
pc
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment