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
ce7f3670
Commit
ce7f3670
authored
Jun 04, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resize packet cache dynamically.
parent
b00d2aba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
3 deletions
+26
-3
webclient.go
webclient.go
+26
-3
No files found.
webclient.go
View file @
ce7f3670
...
...
@@ -366,7 +366,7 @@ func addUpConn(c *webClient, id string) (*upConnection, error) {
track
:=
&
upTrack
{
track
:
remote
,
label
:
label
,
cache
:
packetcache
.
New
(
96
),
cache
:
packetcache
.
New
(
32
),
rate
:
estimator
.
New
(
time
.
Second
),
jitter
:
jitter
.
New
(
remote
.
Codec
()
.
ClockRate
),
maxBitrate
:
^
uint64
(
0
),
...
...
@@ -975,11 +975,12 @@ func handleReport(track *rtpDownTrack, report rtcp.ReceptionReport, jiffies uint
}
}
func
updateUp
Bitrate
(
up
*
upConnection
,
maxVideoRate
uint64
)
{
func
updateUp
Track
(
up
*
upConnection
,
maxVideoRate
uint64
)
{
now
:=
rtptime
.
Jiffies
()
for
_
,
track
:=
range
up
.
tracks
{
isvideo
:=
track
.
track
.
Kind
()
==
webrtc
.
RTPCodecTypeVideo
clockrate
:=
track
.
track
.
Codec
()
.
ClockRate
minrate
:=
uint64
(
minAudioRate
)
rate
:=
^
uint64
(
0
)
if
isvideo
{
...
...
@@ -990,6 +991,7 @@ func updateUpBitrate(up *upConnection, maxVideoRate uint64) {
}
}
local
:=
track
.
getLocal
()
var
maxrto
uint64
for
_
,
l
:=
range
local
{
bitrate
:=
l
.
GetMaxBitrate
(
now
)
if
bitrate
==
^
uint64
(
0
)
{
...
...
@@ -1002,8 +1004,29 @@ func updateUpBitrate(up *upConnection, maxVideoRate uint64) {
if
rate
>
bitrate
{
rate
=
bitrate
}
ll
,
ok
:=
l
.
(
*
rtpDownTrack
)
if
ok
{
_
,
j
:=
ll
.
stats
.
Get
(
now
)
jitter
:=
uint64
(
j
)
*
(
rtptime
.
JiffiesPerSec
/
uint64
(
clockrate
))
rtt
:=
atomic
.
LoadUint64
(
&
ll
.
rtt
)
rto
:=
rtt
+
4
*
jitter
if
rto
>
maxrto
{
maxrto
=
rto
}
}
}
track
.
maxBitrate
=
rate
_
,
r
:=
track
.
rate
.
Estimate
()
packets
:=
int
((
uint64
(
r
)
*
maxrto
*
4
)
/
rtptime
.
JiffiesPerSec
)
if
packets
<
32
{
packets
=
32
}
if
packets
>
256
{
packets
=
256
}
track
.
cache
.
ResizeCond
(
packets
)
}
}
...
...
@@ -1690,7 +1713,7 @@ func sendRateUpdate(c *webClient) {
c
.
mu
.
Lock
()
for
_
,
u
:=
range
c
.
up
{
updateUp
Bitrate
(
u
,
maxVideoRate
)
updateUp
Track
(
u
,
maxVideoRate
)
for
_
,
t
:=
range
u
.
tracks
{
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