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
23c4aea5
Commit
23c4aea5
authored
Aug 06, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement renegotiation in the up direction.
parent
95066152
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
13 deletions
+20
-13
static/sfu.js
static/sfu.js
+1
-0
webclient.go
webclient.go
+19
-13
No files found.
static/sfu.js
View file @
23c4aea5
...
...
@@ -1243,6 +1243,7 @@ async function negotiate(id) {
id
:
id
,
labels
:
c
.
labelsByMid
,
offer
:
offer
,
renegotiate
:
true
,
});
}
...
...
webclient.go
View file @
23c4aea5
...
...
@@ -209,12 +209,7 @@ func getUpConns(c *webClient) []*rtpUpConnection {
return
up
}
func
addUpConn
(
c
*
webClient
,
id
string
)
(
*
rtpUpConnection
,
error
)
{
conn
,
err
:=
newUpConn
(
c
,
id
)
if
err
!=
nil
{
return
nil
,
err
}
func
addUpConn
(
c
*
webClient
,
id
string
)
(
*
rtpUpConnection
,
bool
,
error
)
{
c
.
mu
.
Lock
()
defer
c
.
mu
.
Unlock
()
...
...
@@ -222,13 +217,17 @@ func addUpConn(c *webClient, id string) (*rtpUpConnection, error) {
c
.
up
=
make
(
map
[
string
]
*
rtpUpConnection
)
}
if
c
.
down
!=
nil
&&
c
.
down
[
id
]
!=
nil
{
conn
.
pc
.
Close
()
return
nil
,
errors
.
New
(
"Adding duplicate connection"
)
return
nil
,
false
,
errors
.
New
(
"Adding duplicate connection"
)
}
old
:=
c
.
up
[
id
]
if
old
!=
nil
{
old
.
pc
.
Close
()
return
old
,
false
,
nil
}
conn
,
err
:=
newUpConn
(
c
,
id
)
if
err
!=
nil
{
return
nil
,
false
,
err
}
c
.
up
[
id
]
=
conn
...
...
@@ -237,7 +236,7 @@ func addUpConn(c *webClient, id string) (*rtpUpConnection, error) {
sendICE
(
c
,
id
,
candidate
)
})
return
conn
,
nil
return
conn
,
true
,
nil
}
func
delUpConn
(
c
*
webClient
,
id
string
)
bool
{
...
...
@@ -444,11 +443,18 @@ func sendICE(c *webClient, id string, candidate *webrtc.ICECandidate) error {
})
}
func
gotOffer
(
c
*
webClient
,
id
string
,
offer
webrtc
.
SessionDescription
,
labels
map
[
string
]
string
)
error
{
up
,
err
:=
addUpConn
(
c
,
id
)
func
gotOffer
(
c
*
webClient
,
id
string
,
offer
webrtc
.
SessionDescription
,
renegotiate
bool
,
labels
map
[
string
]
string
)
error
{
if
!
renegotiate
{
// unless the client indicates that this is a compatible
// renegotiation, tear down the existing connection.
delUpConn
(
c
,
id
)
}
up
,
_
,
err
:=
addUpConn
(
c
,
id
)
if
err
!=
nil
{
return
err
}
if
c
.
username
!=
""
{
up
.
label
=
c
.
username
}
...
...
@@ -911,7 +917,7 @@ func handleClientMessage(c *webClient, m clientMessage) error {
if
m
.
Offer
==
nil
{
return
protocolError
(
"null offer"
)
}
err
:=
gotOffer
(
c
,
m
.
Id
,
*
m
.
Offer
,
m
.
Labels
)
err
:=
gotOffer
(
c
,
m
.
Id
,
*
m
.
Offer
,
m
.
Renegotiate
,
m
.
Labels
)
if
err
!=
nil
{
log
.
Printf
(
"gotOffer: %v"
,
err
)
return
failConnection
(
c
,
m
.
Id
,
"negotiation failed"
)
...
...
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