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
435f46c5
Commit
435f46c5
authored
May 14, 2021
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for codec manipulation and rtpconn data stuctures.
parent
6f9d7fc3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
0 deletions
+79
-0
rtpconn/codec_test.go
rtpconn/codec_test.go
+43
-0
rtpconn/rtpconn_test.go
rtpconn/rtpconn_test.go
+36
-0
No files found.
rtpconn/codec_test.go
0 → 100644
View file @
435f46c5
package
rtpconn
import
(
"testing"
)
var
vp8
=
[]
byte
{
0x80
,
0
,
0
,
42
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0x90
,
0x80
,
0x80
,
57
,
0
,
0
,
0
,
0
,
}
func
TestPacketFlags
(
t
*
testing
.
T
)
{
buf
:=
append
([]
byte
{},
vp8
...
)
seqno
,
start
,
pid
,
tid
,
sid
,
layersync
,
discardable
,
err
:=
packetFlags
(
"video/vp8"
,
buf
)
if
seqno
!=
42
||
!
start
||
pid
!=
57
||
sid
!=
0
||
tid
!=
0
||
layersync
||
discardable
||
err
!=
nil
{
t
.
Errorf
(
"Got %v, %v, %v, %v, %v, %v (%v)"
,
seqno
,
start
,
pid
,
sid
,
layersync
,
discardable
,
err
,
)
}
}
func
TestRewrite
(
t
*
testing
.
T
)
{
for
i
:=
uint16
(
0
);
i
<
0x7fff
;
i
++
{
buf
:=
append
([]
byte
{},
vp8
...
)
err
:=
rewritePacket
(
"video/vp8"
,
buf
,
i
,
i
)
if
err
!=
nil
{
t
.
Errorf
(
"rewrite: %v"
,
err
)
continue
}
seqno
,
_
,
pid
,
_
,
_
,
_
,
_
,
err
:=
packetFlags
(
"video/vp8"
,
buf
)
if
err
!=
nil
||
seqno
!=
i
||
pid
!=
(
57
+
i
)
&
0x7FFF
{
t
.
Errorf
(
"Expected %v %v, got %v %v (%v)"
,
i
,
(
57
+
i
)
&
0x7FFF
,
seqno
,
pid
,
err
)
}
}
}
rtpconn/rtpconn_test.go
0 → 100644
View file @
435f46c5
package
rtpconn
import
(
"testing"
"github.com/jech/galene/rtptime"
)
func
TestDownTrackAtomics
(
t
*
testing
.
T
)
{
down
:=
&
rtpDownTrack
{
atomics
:
&
downTrackAtomics
{},
maxBitrate
:
new
(
bitrate
),
maxREMBBitrate
:
new
(
bitrate
),
}
down
.
SetTimeOffset
(
1
,
2
)
down
.
setRTT
(
3
)
down
.
setSRTime
(
4
,
5
)
down
.
maxBitrate
.
Set
(
6
,
rtptime
.
Jiffies
())
down
.
maxREMBBitrate
.
Set
(
7
,
rtptime
.
Jiffies
())
down
.
setLayerInfo
(
8
,
9
,
10
)
ntp
,
rtp
:=
down
.
getTimeOffset
()
rtt
:=
down
.
getRTT
()
sr
,
srntp
:=
down
.
getSRTime
()
br
,
lbr
:=
down
.
GetMaxBitrate
()
l
,
w
,
m
:=
down
.
getLayerInfo
()
if
ntp
!=
1
||
rtp
!=
2
||
rtt
!=
3
||
sr
!=
4
||
srntp
!=
5
||
br
!=
6
||
lbr
!=
8
||
l
!=
8
||
w
!=
9
||
m
!=
10
{
t
.
Errorf
(
"Expected 1 2 3 4 5 6 8 8 9 10, "
+
"got %v %v %v %v %v %v %v %v %v %v"
,
ntp
,
rtp
,
rtt
,
sr
,
srntp
,
br
,
lbr
,
l
,
w
,
m
,
)
}
}
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