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
dcb21111
Commit
dcb21111
authored
May 31, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send sender reports.
parent
f8516221
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
webclient.go
webclient.go
+53
-0
No files found.
webclient.go
View file @
dcb21111
...
...
@@ -627,6 +627,57 @@ func rtcpUpSender(conn *upConnection) {
}
}
func
sendSR
(
conn
*
rtpDownConnection
)
error
{
packets
:=
make
([]
rtcp
.
Packet
,
0
,
len
(
conn
.
tracks
))
now
:=
time
.
Now
()
nowNTP
:=
mono
.
TimeToNTP
(
now
)
for
_
,
t
:=
range
conn
.
tracks
{
clockrate
:=
t
.
track
.
Codec
()
.
ClockRate
remote
:=
t
.
remote
remote
.
mu
.
Lock
()
srNTPTime
:=
remote
.
srNTPTime
srRTPTime
:=
remote
.
srRTPTime
remote
.
mu
.
Unlock
()
nowRTP
:=
srRTPTime
if
srNTPTime
!=
0
{
srTime
:=
mono
.
NTPToTime
(
srNTPTime
)
delay
:=
now
.
Sub
(
srTime
)
if
delay
>
0
&&
delay
<
time
.
Hour
{
d
:=
mono
.
FromDuration
(
delay
,
clockrate
)
nowRTP
=
srRTPTime
+
uint32
(
d
)
}
}
p
,
b
:=
t
.
rate
.
Totals
()
packets
=
append
(
packets
,
&
rtcp
.
SenderReport
{
SSRC
:
t
.
track
.
SSRC
(),
NTPTime
:
nowNTP
,
RTPTime
:
nowRTP
,
PacketCount
:
p
,
OctetCount
:
b
,
})
}
return
conn
.
pc
.
WriteRTCP
(
packets
)
}
func
rtcpDownSender
(
conn
*
rtpDownConnection
)
{
for
{
time
.
Sleep
(
time
.
Second
)
err
:=
sendSR
(
conn
)
if
err
!=
nil
{
if
err
==
io
.
EOF
||
err
==
io
.
ErrClosedPipe
{
return
}
log
.
Printf
(
"sendSR: %v"
,
err
)
}
}
}
func
delUpConn
(
c
*
webClient
,
id
string
)
bool
{
c
.
mu
.
Lock
()
defer
c
.
mu
.
Unlock
()
...
...
@@ -1244,6 +1295,8 @@ func addDownConnTracks(c *webClient, remote *upConnection, tracks []*upTrack) (*
}
}
go
rtcpDownSender
(
down
)
return
down
,
nil
}
...
...
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