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
903e499d
Commit
903e499d
authored
Jun 12, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't reduce video rate in large groups.
parent
a8ca2e85
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
39 deletions
+3
-39
group.go
group.go
+0
-1
rtpconn.go
rtpconn.go
+2
-9
webclient.go
webclient.go
+1
-29
No files found.
group.go
View file @
903e499d
...
...
@@ -45,7 +45,6 @@ type group struct {
name
string
dead
bool
description
*
groupDescription
videoCount
uint32
locked
uint32
mu
sync
.
Mutex
...
...
rtpconn.go
View file @
903e499d
...
...
@@ -429,10 +429,6 @@ func newUpConn(c client, id string) (*rtpUpConnection, error) {
conn
.
tracks
=
append
(
conn
.
tracks
,
track
)
if
remote
.
Kind
()
==
webrtc
.
RTPCodecTypeVideo
{
atomic
.
AddUint32
(
&
c
.
Group
()
.
videoCount
,
1
)
}
go
readLoop
(
conn
,
track
)
go
rtcpUpListener
(
conn
,
track
,
receiver
)
...
...
@@ -1090,7 +1086,7 @@ func handleReport(track *rtpDownTrack, report rtcp.ReceptionReport, jiffies uint
}
}
func
updateUpTrack
(
track
*
rtpUpTrack
,
maxVideoRate
uint64
)
uint64
{
func
updateUpTrack
(
track
*
rtpUpTrack
)
uint64
{
now
:=
rtptime
.
Jiffies
()
isvideo
:=
track
.
track
.
Kind
()
==
webrtc
.
RTPCodecTypeVideo
...
...
@@ -1099,10 +1095,7 @@ func updateUpTrack(track *rtpUpTrack, maxVideoRate uint64) uint64 {
rate
:=
^
uint64
(
0
)
if
isvideo
{
minrate
=
minVideoRate
rate
=
maxVideoRate
if
rate
<
minrate
{
rate
=
minrate
}
rate
=
^
uint64
(
0
)
}
local
:=
track
.
getLocal
()
var
maxrto
uint64
...
...
webclient.go
View file @
903e499d
...
...
@@ -9,7 +9,6 @@ import (
"encoding/json"
"errors"
"log"
"math"
"os"
"strings"
"sync"
...
...
@@ -228,7 +227,6 @@ func addUpConn(c *webClient, id string) (*rtpUpConnection, error) {
old
:=
c
.
up
[
id
]
if
old
!=
nil
{
decrementVideoTracks
(
c
,
old
)
old
.
pc
.
Close
()
}
...
...
@@ -255,8 +253,6 @@ func delUpConn(c *webClient, id string) bool {
delete
(
c
.
up
,
id
)
c
.
mu
.
Unlock
()
decrementVideoTracks
(
c
,
conn
)
go
func
(
clients
[]
client
)
{
for
_
,
c
:=
range
clients
{
c
.
pushConn
(
conn
.
id
,
nil
,
nil
,
""
)
...
...
@@ -267,21 +263,6 @@ func delUpConn(c *webClient, id string) bool {
return
true
}
func
decrementVideoTracks
(
c
*
webClient
,
conn
*
rtpUpConnection
)
{
conn
.
mu
.
Lock
()
defer
conn
.
mu
.
Unlock
()
for
_
,
track
:=
range
conn
.
tracks
{
if
track
.
track
.
Kind
()
==
webrtc
.
RTPCodecTypeVideo
{
count
:=
atomic
.
AddUint32
(
&
c
.
group
.
videoCount
,
^
uint32
(
0
))
if
count
==
^
uint32
(
0
)
{
log
.
Printf
(
"Negative track count!"
)
atomic
.
StoreUint32
(
&
c
.
group
.
videoCount
,
0
)
}
}
}
}
func
getDownConn
(
c
*
webClient
,
id
string
)
*
rtpDownConnection
{
if
c
.
down
==
nil
{
return
nil
...
...
@@ -1042,21 +1023,12 @@ func handleClientMessage(c *webClient, m clientMessage) error {
}
func
sendRateUpdate
(
c
*
webClient
)
{
maxVideoRate
:=
^
uint64
(
0
)
count
:=
atomic
.
LoadUint32
(
&
c
.
group
.
videoCount
)
if
count
>=
3
{
maxVideoRate
=
uint64
(
2000000
/
math
.
Sqrt
(
float64
(
count
)))
if
maxVideoRate
<
minVideoRate
{
maxVideoRate
=
minVideoRate
}
}
up
:=
getUpConns
(
c
)
for
_
,
u
:=
range
up
{
tracks
:=
u
.
getTracks
()
for
_
,
t
:=
range
tracks
{
rate
:=
updateUpTrack
(
t
,
maxVideoRate
)
rate
:=
updateUpTrack
(
t
)
if
!
t
.
hasRtcpFb
(
"goog-remb"
,
""
)
{
continue
}
...
...
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