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
c0122c06
Commit
c0122c06
authored
Sep 03, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement restartIce for older browsers.
parent
aa876bcd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
16 deletions
+34
-16
static/protocol.js
static/protocol.js
+34
-16
No files found.
static/protocol.js
View file @
c0122c06
...
...
@@ -386,14 +386,8 @@ ServerConnection.prototype.newUpStream = function(id) {
pc
.
oniceconnectionstatechange
=
e
=>
{
if
(
c
.
onstatus
)
c
.
onstatus
.
call
(
c
,
pc
.
iceConnectionState
);
if
(
pc
.
iceConnectionState
===
'
failed
'
)
{
try
{
/** @ts-ignore */
pc
.
restartIce
();
}
catch
(
e
)
{
console
.
warn
(
e
);
}
}
if
(
pc
.
iceConnectionState
===
'
failed
'
)
c
.
restartIce
();
}
pc
.
ontrack
=
console
.
error
;
...
...
@@ -587,12 +581,7 @@ ServerConnection.prototype.gotRenegotiate = async function(id) {
let
c
=
this
.
up
[
id
];
if
(
!
c
)
throw
new
Error
(
'
unknown up stream
'
);
try
{
/** @ts-ignore */
c
.
pc
.
restartIce
();
}
catch
(
e
)
{
console
.
warn
(
e
);
}
c
.
restartIce
();
}
/**
...
...
@@ -837,12 +826,17 @@ Stream.prototype.flushIceCandidates = async function () {
* automatically when required. If the client requires renegotiation, it
* is probably more effective to call restartIce on the underlying PC
* rather than invoking this function directly.
*
* @function
* @param {boolean} [restartIce]
*/
Stream
.
prototype
.
negotiate
=
async
function
()
{
Stream
.
prototype
.
negotiate
=
async
function
(
restartIce
)
{
let
c
=
this
;
let
offer
=
await
c
.
pc
.
createOffer
();
let
options
=
null
;
if
(
restartIce
)
options
=
{
iceRestart
:
true
};
let
offer
=
await
c
.
pc
.
createOffer
(
options
);
if
(
!
offer
)
throw
(
new
Error
(
"
Didn't create offer
"
));
await
c
.
pc
.
setLocalDescription
(
offer
);
...
...
@@ -867,6 +861,30 @@ Stream.prototype.negotiate = async function () {
});
}
/**
* restartIce causes an ICE restart on an up stream. It is called
* automatically when ICE signals that the connection has failed. It
* returns immediately, negotiation will happen asynchronously.
*/
Stream
.
prototype
.
restartIce
=
function
()
{
let
c
=
this
;
/** @ts-ignore */
if
(
typeof
c
.
pc
.
restartIce
===
'
function
'
)
{
try
{
/** @ts-ignore */
c
.
pc
.
restartIce
();
return
;
}
catch
(
e
)
{
console
.
warn
(
e
);
}
}
// negotiate is async, but this returns immediately.
c
.
negotiate
(
true
);
}
/**
* updateStats is called periodically, if requested by setStatsInterval,
* in order to recompute stream statistics and invoke the onstats handler.
...
...
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