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
5b922268
Commit
5b922268
authored
Jun 01, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Maintain full time information from sender reports.
parent
a6db6b10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
24 deletions
+31
-24
conn.go
conn.go
+14
-13
webclient.go
webclient.go
+17
-11
No files found.
conn.go
View file @
5b922268
...
@@ -24,23 +24,24 @@ type localTrackAction struct {
...
@@ -24,23 +24,24 @@ type localTrackAction struct {
}
}
type
upTrack
struct
{
type
upTrack
struct
{
track
*
webrtc
.
Track
track
*
webrtc
.
Track
label
string
label
string
rate
*
estimator
.
Estimator
rate
*
estimator
.
Estimator
cache
*
packetcache
.
Cache
cache
*
packetcache
.
Cache
jitter
*
jitter
.
Estimator
jitter
*
jitter
.
Estimator
maxBitrate
uint64
maxBitrate
uint64
lastPLI
uint64
lastPLI
uint64
lastFIR
uint64
lastFIR
uint64
firSeqno
uint32
firSeqno
uint32
lastSenderReport
uint32
lastSenderReportTime
uint32
localCh
chan
localTrackAction
// signals that local has changed
localCh
chan
localTrackAction
// signals that local has changed
writerDone
chan
struct
{}
// closed when the loop dies
writerDone
chan
struct
{}
// closed when the loop dies
mu
sync
.
Mutex
mu
sync
.
Mutex
local
[]
downTrack
local
[]
downTrack
srTime
uint64
srNTPTime
uint64
srRTPTime
uint32
}
}
func
(
up
*
upTrack
)
notifyLocal
(
add
bool
,
track
downTrack
)
{
func
(
up
*
upTrack
)
notifyLocal
(
add
bool
,
track
downTrack
)
{
...
...
webclient.go
View file @
5b922268
...
@@ -558,10 +558,11 @@ func rtcpUpListener(conn *upConnection, track *upTrack, r *webrtc.RTPReceiver) {
...
@@ -558,10 +558,11 @@ func rtcpUpListener(conn *upConnection, track *upTrack, r *webrtc.RTPReceiver) {
for
_
,
p
:=
range
ps
{
for
_
,
p
:=
range
ps
{
switch
p
:=
p
.
(
type
)
{
switch
p
:=
p
.
(
type
)
{
case
*
rtcp
.
SenderReport
:
case
*
rtcp
.
SenderReport
:
atomic
.
StoreUint32
(
&
track
.
lastSenderReport
,
track
.
mu
.
Lock
()
uint32
(
p
.
NTPTime
>>
16
))
track
.
srTime
=
mono
.
Now
(
0x10000
)
atomic
.
StoreUint32
(
&
track
.
lastSenderReportTime
,
track
.
srNTPTime
=
p
.
NTPTime
uint32
(
mono
.
Now
(
0x10000
)))
track
.
srRTPTime
=
p
.
RTPTime
track
.
mu
.
Unlock
()
case
*
rtcp
.
SourceDescription
:
case
*
rtcp
.
SourceDescription
:
}
}
}
}
...
@@ -573,7 +574,7 @@ func sendRR(conn *upConnection) error {
...
@@ -573,7 +574,7 @@ func sendRR(conn *upConnection) error {
return
nil
return
nil
}
}
now
:=
uint32
(
mono
.
Now
(
0x10000
)
)
now
:=
mono
.
Now
(
0x10000
)
reports
:=
make
([]
rtcp
.
ReceptionReport
,
0
,
len
(
conn
.
tracks
))
reports
:=
make
([]
rtcp
.
ReceptionReport
,
0
,
len
(
conn
.
tracks
))
for
_
,
t
:=
range
conn
.
tracks
{
for
_
,
t
:=
range
conn
.
tracks
{
...
@@ -584,10 +585,15 @@ func sendRR(conn *upConnection) error {
...
@@ -584,10 +585,15 @@ func sendRR(conn *upConnection) error {
if
lost
>=
expected
{
if
lost
>=
expected
{
lost
=
expected
-
1
lost
=
expected
-
1
}
}
lastSR
:=
atomic
.
LoadUint32
(
&
t
.
lastSenderReport
)
var
delay
uint32
t
.
mu
.
Lock
()
if
lastSR
!=
0
{
srTime
:=
t
.
srTime
delay
=
now
-
atomic
.
LoadUint32
(
&
t
.
lastSenderReportTime
)
srNTPTime
:=
t
.
srNTPTime
t
.
mu
.
Unlock
()
var
delay
uint64
if
srNTPTime
!=
0
{
delay
=
now
-
srTime
}
}
reports
=
append
(
reports
,
rtcp
.
ReceptionReport
{
reports
=
append
(
reports
,
rtcp
.
ReceptionReport
{
...
@@ -596,8 +602,8 @@ func sendRR(conn *upConnection) error {
...
@@ -596,8 +602,8 @@ func sendRR(conn *upConnection) error {
TotalLost
:
totalLost
,
TotalLost
:
totalLost
,
LastSequenceNumber
:
eseqno
,
LastSequenceNumber
:
eseqno
,
Jitter
:
t
.
jitter
.
Jitter
(),
Jitter
:
t
.
jitter
.
Jitter
(),
LastSenderReport
:
lastSR
,
LastSenderReport
:
uint32
(
srNTPTime
>>
16
)
,
Delay
:
delay
,
Delay
:
uint32
(
delay
)
,
})
})
}
}
...
...
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