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
4fde2c40
Commit
4fde2c40
authored
Dec 19, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run gofmt.
parent
325f2881
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
39 deletions
+38
-39
estimator/estimator_test.go
estimator/estimator_test.go
+1
-1
group/client_test.go
group/client_test.go
+2
-2
packetcache/packetcache_test.go
packetcache/packetcache_test.go
+1
-1
rtpconn/rtpconn.go
rtpconn/rtpconn.go
+1
-1
rtpconn/webclient.go
rtpconn/webclient.go
+27
-28
rtptime/rtptime.go
rtptime/rtptime.go
+2
-2
rtptime/rtptime_test.go
rtptime/rtptime_test.go
+4
-4
No files found.
estimator/estimator_test.go
View file @
4fde2c40
...
...
@@ -15,7 +15,7 @@ func TestEstimator(t *testing.T) {
e
.
Accumulate
(
128
)
e
.
estimate
(
now
+
rtptime
.
JiffiesPerSec
)
rate
,
packetRate
:=
e
.
estimate
(
now
+
(
rtptime
.
JiffiesPerSec
*
1001
)
/
1000
)
e
.
estimate
(
now
+
(
rtptime
.
JiffiesPerSec
*
1001
)
/
1000
)
if
rate
!=
42
+
128
{
t
.
Errorf
(
"Expected %v, got %v"
,
42
+
128
,
rate
)
...
...
group/client_test.go
View file @
4fde2c40
...
...
@@ -69,7 +69,7 @@ func TestJSON(t *testing.T) {
}
func
BenchmarkPlain
(
b
*
testing
.
B
)
{
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
match
,
err
:=
pw2
.
Match
(
"bad"
)
if
err
!=
nil
||
match
{
b
.
Errorf
(
"pw2 matched"
)
...
...
@@ -78,7 +78,7 @@ func BenchmarkPlain(b *testing.B) {
}
func
BenchmarkPBKDF2
(
b
*
testing
.
B
)
{
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
match
,
err
:=
pw3
.
Match
(
"bad"
)
if
err
!=
nil
||
match
{
b
.
Errorf
(
"pw3 matched"
)
...
...
packetcache/packetcache_test.go
View file @
4fde2c40
...
...
@@ -350,7 +350,7 @@ func TestBitmapPacket(t *testing.T) {
}
p
:=
rtcp
.
NackPair
{
first
,
rtcp
.
PacketBitmap
(
bitmap
)}
p
.
Range
(
func
(
s
uint16
)
bool
{
p
.
Range
(
func
(
s
uint16
)
bool
{
if
s
<
42
||
s
>=
42
+
64
{
if
(
value
&
(
1
<<
(
s
-
42
)))
!=
0
{
t
.
Errorf
(
"Bit %v unexpectedly set"
,
s
-
42
)
...
...
rtpconn/rtpconn.go
View file @
4fde2c40
...
...
@@ -574,7 +574,7 @@ func gotNACK(conn *rtpDownConnection, track *rtpDownTrack, p *rtcp.TransportLaye
var
packet
rtp
.
Packet
buf
:=
make
([]
byte
,
packetcache
.
BufSize
)
for
_
,
nack
:=
range
p
.
Nacks
{
nack
.
Range
(
func
(
seqno
uint16
)
bool
{
nack
.
Range
(
func
(
seqno
uint16
)
bool
{
l
:=
track
.
remote
.
GetRTP
(
seqno
,
buf
)
if
l
==
0
{
unhandled
=
append
(
unhandled
,
seqno
)
...
...
rtpconn/webclient.go
View file @
4fde2c40
...
...
@@ -29,11 +29,11 @@ func errorToWSCloseMessage(id string, err error) (*clientMessage, []byte) {
code
=
websocket
.
CloseProtocolError
s
:=
e
.
Error
()
m
=
&
clientMessage
{
Type
:
"usermessage"
,
Kind
:
"error"
,
Dest
:
id
,
Privileged
:
true
,
Value
:
&
s
,
Type
:
"usermessage"
,
Kind
:
"error"
,
Dest
:
id
,
Privileged
:
true
,
Value
:
&
s
,
}
text
=
e
.
Error
()
case
group
.
UserError
,
group
.
KickError
:
...
...
@@ -708,7 +708,7 @@ func StartClient(conn *websocket.Conn) (err error) {
}
type
pushConnAction
struct
{
group
*
group
.
Group
group
*
group
.
Group
id
string
conn
conn
.
Up
tracks
[]
conn
.
UpTrack
...
...
@@ -720,7 +720,7 @@ type addLabelAction struct {
}
type
pushConnsAction
struct
{
group
*
group
.
Group
group
*
group
.
Group
client
group
.
Client
}
...
...
@@ -943,7 +943,6 @@ func leaveGroup(c *webClient) {
c
.
group
=
nil
}
func
failDownConnection
(
c
*
webClient
,
id
string
,
message
string
)
error
{
if
id
!=
""
{
err
:=
c
.
write
(
clientMessage
{
...
...
@@ -1178,14 +1177,14 @@ func handleClientMessage(c *webClient, m clientMessage) error {
}
}
mm
:=
clientMessage
{
Type
:
m
.
Type
,
Id
:
m
.
Id
,
Dest
:
m
.
Dest
,
Username
:
m
.
Username
,
Privileged
:
c
.
permissions
.
Op
,
Time
:
tm
,
Kind
:
m
.
Kind
,
Value
:
m
.
Value
,
Type
:
m
.
Type
,
Id
:
m
.
Id
,
Dest
:
m
.
Dest
,
Username
:
m
.
Username
,
Privileged
:
c
.
permissions
.
Op
,
Time
:
tm
,
Kind
:
m
.
Kind
,
Value
:
m
.
Value
,
}
if
m
.
Dest
==
""
{
clients
:=
g
.
GetClients
(
nil
)
...
...
@@ -1428,11 +1427,11 @@ func errorMessage(id string, err error) *clientMessage {
case
group
.
UserError
:
message
:=
e
.
Error
()
return
&
clientMessage
{
Type
:
"usermessage"
,
Kind
:
"error"
,
Dest
:
id
,
Privileged
:
true
,
Value
:
&
message
,
Type
:
"usermessage"
,
Kind
:
"error"
,
Dest
:
id
,
Privileged
:
true
,
Value
:
&
message
,
}
case
group
.
KickError
:
message
:=
e
.
Message
...
...
@@ -1440,13 +1439,13 @@ func errorMessage(id string, err error) *clientMessage {
message
=
"you have been kicked out"
}
return
&
clientMessage
{
Type
:
"usermessage"
,
Kind
:
"error"
,
Id
:
e
.
Id
,
Username
:
e
.
Username
,
Dest
:
id
,
Privileged
:
true
,
Value
:
&
message
,
Type
:
"usermessage"
,
Kind
:
"error"
,
Id
:
e
.
Id
,
Username
:
e
.
Username
,
Dest
:
id
,
Privileged
:
true
,
Value
:
&
message
,
}
default
:
return
nil
...
...
rtptime/rtptime.go
View file @
4fde2c40
...
...
@@ -39,7 +39,7 @@ func NTPToTime(ntp uint64) time.Time {
sec
:=
uint32
(
ntp
>>
32
)
frac
:=
uint32
(
ntp
&
0xFFFFFFFF
)
return
ntpEpoch
.
Add
(
time
.
Duration
(
sec
)
*
time
.
Second
+
time
.
Duration
(
sec
)
*
time
.
Second
+
((
time
.
Duration
(
frac
)
*
time
.
Second
)
>>
32
),
)
}
...
...
@@ -48,5 +48,5 @@ func TimeToNTP(tm time.Time) uint64 {
d
:=
tm
.
Sub
(
ntpEpoch
)
sec
:=
uint32
(
d
/
time
.
Second
)
frac
:=
uint32
(
d
%
time
.
Second
)
return
(
uint64
(
sec
)
<<
32
)
+
(
uint64
(
frac
)
<<
32
)
/
uint64
(
time
.
Second
)
return
(
uint64
(
sec
)
<<
32
)
+
(
uint64
(
frac
)
<<
32
)
/
uint64
(
time
.
Second
)
}
rtptime/rtptime_test.go
View file @
4fde2c40
...
...
@@ -21,15 +21,15 @@ func differs(a, b, delta uint64) bool {
if
a
<
b
{
a
,
b
=
b
,
a
}
return
a
-
b
>=
delta
return
a
-
b
>=
delta
}
func
TestTime
(
t
*
testing
.
T
)
{
a
:=
Now
(
48000
)
time
.
Sleep
(
4
*
time
.
Millisecond
)
b
:=
Now
(
48000
)
-
a
if
differs
(
b
,
4
*
48
,
16
)
{
t
.
Errorf
(
"Expected %v, got %v"
,
4
*
48
,
b
)
if
differs
(
b
,
4
*
48
,
16
)
{
t
.
Errorf
(
"Expected %v, got %v"
,
4
*
48
,
b
)
}
c
:=
Microseconds
()
...
...
@@ -68,7 +68,7 @@ func TestNTP(t *testing.T) {
}
if
diff2
>
(
1
<<
8
)
{
t
.
Errorf
(
"Expected %v, got %v (diff=%v)"
,
ntp
,
ntp2
,
float64
(
diff2
)
/
float64
(
1
<<
32
))
ntp
,
ntp2
,
float64
(
diff2
)
/
float64
(
1
<<
32
))
}
}
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