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
118ad7a3
Commit
118ad7a3
authored
Apr 30, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display actual rate in statistics.
parent
5dd27e50
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
+14
-9
group.go
group.go
+9
-6
sfu.go
sfu.go
+5
-3
No files found.
group.go
View file @
118ad7a3
...
@@ -643,8 +643,9 @@ type connStats struct {
...
@@ -643,8 +643,9 @@ type connStats struct {
}
}
type
trackStats
struct
{
type
trackStats
struct
{
bitrate
uint64
bitrate
uint64
loss
uint8
maxBitrate
uint64
loss
uint8
}
}
func
getGroupStats
()
[]
groupStats
{
func
getGroupStats
()
[]
groupStats
{
...
@@ -693,8 +694,9 @@ func getClientStats(c *client) clientStats {
...
@@ -693,8 +694,9 @@ func getClientStats(c *client) clientStats {
expected
=
1
expected
=
1
}
}
conns
.
tracks
=
append
(
conns
.
tracks
,
trackStats
{
conns
.
tracks
=
append
(
conns
.
tracks
,
trackStats
{
bitrate
:
atomic
.
LoadUint64
(
&
t
.
maxBitrate
),
bitrate
:
uint64
(
t
.
rate
.
Estimate
())
*
8
,
loss
:
uint8
(
lost
*
100
/
expected
),
maxBitrate
:
atomic
.
LoadUint64
(
&
t
.
maxBitrate
),
loss
:
uint8
(
lost
*
100
/
expected
),
})
})
}
}
cs
.
up
=
append
(
cs
.
up
,
conns
)
cs
.
up
=
append
(
cs
.
up
,
conns
)
...
@@ -708,8 +710,9 @@ func getClientStats(c *client) clientStats {
...
@@ -708,8 +710,9 @@ func getClientStats(c *client) clientStats {
for
_
,
t
:=
range
down
.
tracks
{
for
_
,
t
:=
range
down
.
tracks
{
loss
:=
atomic
.
LoadUint32
(
&
t
.
loss
)
loss
:=
atomic
.
LoadUint32
(
&
t
.
loss
)
conns
.
tracks
=
append
(
conns
.
tracks
,
trackStats
{
conns
.
tracks
=
append
(
conns
.
tracks
,
trackStats
{
bitrate
:
atomic
.
LoadUint64
(
&
t
.
maxBitrate
.
bitrate
),
bitrate
:
uint64
(
t
.
rate
.
Estimate
())
*
8
,
loss
:
uint8
((
loss
*
100
)
/
256
),
maxBitrate
:
atomic
.
LoadUint64
(
&
t
.
maxBitrate
.
bitrate
),
loss
:
uint8
((
loss
*
100
)
/
256
),
})
})
}
}
cs
.
down
=
append
(
cs
.
down
,
conns
)
cs
.
down
=
append
(
cs
.
down
,
conns
)
...
...
sfu.go
View file @
118ad7a3
...
@@ -156,9 +156,11 @@ func statsHandler(w http.ResponseWriter, r *http.Request) {
...
@@ -156,9 +156,11 @@ func statsHandler(w http.ResponseWriter, r *http.Request) {
fmt
.
Fprintf
(
w
,
"<title>Stats</title>
\n
"
)
fmt
.
Fprintf
(
w
,
"<title>Stats</title>
\n
"
)
fmt
.
Fprintf
(
w
,
"<head><body>
\n
"
)
fmt
.
Fprintf
(
w
,
"<head><body>
\n
"
)
printBitrate
:=
func
(
w
io
.
Writer
,
rate
uint64
)
error
{
printBitrate
:=
func
(
w
io
.
Writer
,
rate
,
maxRate
uint64
)
error
{
var
err
error
var
err
error
if
rate
!=
0
&&
rate
!=
^
uint64
(
0
)
{
if
maxRate
!=
0
&&
maxRate
!=
^
uint64
(
0
)
{
_
,
err
=
fmt
.
Fprintf
(
w
,
"%v/%v"
,
rate
,
maxRate
)
}
else
{
_
,
err
=
fmt
.
Fprintf
(
w
,
"%v"
,
rate
)
_
,
err
=
fmt
.
Fprintf
(
w
,
"%v"
,
rate
)
}
}
return
err
return
err
...
@@ -167,7 +169,7 @@ func statsHandler(w http.ResponseWriter, r *http.Request) {
...
@@ -167,7 +169,7 @@ func statsHandler(w http.ResponseWriter, r *http.Request) {
printTrack
:=
func
(
w
io
.
Writer
,
t
trackStats
)
{
printTrack
:=
func
(
w
io
.
Writer
,
t
trackStats
)
{
fmt
.
Fprintf
(
w
,
"<tr><td></td><td></td><td></td>"
)
fmt
.
Fprintf
(
w
,
"<tr><td></td><td></td><td></td>"
)
fmt
.
Fprintf
(
w
,
"<td>"
)
fmt
.
Fprintf
(
w
,
"<td>"
)
printBitrate
(
w
,
t
.
bitrate
)
printBitrate
(
w
,
t
.
bitrate
,
t
.
maxBitrate
)
fmt
.
Fprintf
(
w
,
"</td>"
)
fmt
.
Fprintf
(
w
,
"</td>"
)
fmt
.
Fprintf
(
w
,
"<td>%d%%</td></tr>
\n
"
,
fmt
.
Fprintf
(
w
,
"<td>%d%%</td></tr>
\n
"
,
t
.
loss
,
t
.
loss
,
...
...
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