Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sfu
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
Alain Takoudjou
sfu
Commits
5bfe964d
Commit
5bfe964d
authored
Jul 16, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restart ICE instead of restarting down connections.
parent
6b34d1e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
19 deletions
+31
-19
static/sfu.js
static/sfu.js
+8
-5
webclient.go
webclient.go
+23
-14
No files found.
static/sfu.js
View file @
5bfe964d
...
...
@@ -717,11 +717,14 @@ function sendRequest(value) {
async
function
gotOffer
(
id
,
labels
,
offer
)
{
let
c
=
down
[
id
];
if
(
c
)
{
// a new offer with a known id does not indicate renegotiation,
// but a new connection that replaces the old one.
delete
(
down
[
id
])
c
.
close
(
false
);
c
=
null
;
if
(
!
offer
.
renegotiate
)
{
delete
(
down
[
id
])
c
.
close
(
false
);
c
=
null
;
}
}
else
if
(
offer
.
renegotiate
)
{
console
.
warn
(
"
Renegotiating unknown connection
"
);
// but keep going
}
if
(
!
c
)
{
...
...
webclient.go
View file @
5bfe964d
...
...
@@ -179,6 +179,7 @@ type clientMessage struct {
Offer
*
webrtc
.
SessionDescription
`json:"offer,omitempty"`
Answer
*
webrtc
.
SessionDescription
`json:"answer,omitempty"`
Candidate
*
webrtc
.
ICECandidateInit
`json:"candidate,omitempty"`
Renegotiate
bool
`json:"renegotiate,omitempty"`
Labels
map
[
string
]
string
`json:"labels,omitempty"`
Del
bool
`json:"del,omitempty"`
Request
rateMap
`json:"request,omitempty"`
...
...
@@ -393,8 +394,9 @@ func addDownTrack(c *webClient, conn *rtpDownConnection, remoteTrack upTrack, re
return
s
,
nil
}
func
negotiate
(
c
*
webClient
,
down
*
rtpDownConnection
)
error
{
offer
,
err
:=
down
.
pc
.
CreateOffer
(
nil
)
func
negotiate
(
c
*
webClient
,
down
*
rtpDownConnection
,
renegotiate
,
restartIce
bool
)
error
{
options
:=
webrtc
.
OfferOptions
{
ICERestart
:
restartIce
}
offer
,
err
:=
down
.
pc
.
CreateOffer
(
&
options
)
if
err
!=
nil
{
return
err
}
...
...
@@ -422,10 +424,11 @@ func negotiate(c *webClient, down *rtpDownConnection) error {
}
return
c
.
write
(
clientMessage
{
Type
:
"offer"
,
Id
:
down
.
id
,
Offer
:
&
offer
,
Labels
:
labels
,
Type
:
"offer"
,
Id
:
down
.
id
,
Offer
:
&
offer
,
Renegotiate
:
renegotiate
,
Labels
:
labels
,
})
}
...
...
@@ -733,7 +736,7 @@ func clientLoop(c *webClient, conn *websocket.Conn) error {
return
err
}
if
down
!=
nil
{
err
=
negotiate
(
c
,
down
)
err
=
negotiate
(
c
,
down
,
false
,
false
)
if
err
!=
nil
{
log
.
Printf
(
"Negotiate: %v"
,
err
)
delDownConn
(
c
,
down
.
id
)
...
...
@@ -769,14 +772,20 @@ func clientLoop(c *webClient, conn *websocket.Conn) error {
"unknown connection"
)
continue
}
tracks
:=
make
([]
upTrack
,
len
(
down
.
tracks
))
for
i
,
t
:=
range
down
.
tracks
{
tracks
[
i
]
=
t
.
remote
err
:=
negotiate
(
c
,
down
,
true
,
true
)
if
err
!=
nil
{
log
.
Printf
(
"Renegotiate: %v"
)
tracks
:=
make
(
[]
upTrack
,
len
(
down
.
tracks
),
)
for
i
,
t
:=
range
down
.
tracks
{
tracks
[
i
]
=
t
.
remote
}
go
c
.
pushConn
(
down
.
remote
.
Id
(),
down
.
remote
,
tracks
,
down
.
remote
.
Label
(),
)
}
go
c
.
pushConn
(
down
.
remote
.
Id
(),
down
.
remote
,
tracks
,
down
.
remote
.
Label
(),
)
case
permissionsChangedAction
:
c
.
write
(
clientMessage
{
Type
:
"permissions"
,
...
...
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