mirror of
https://github.com/Monibuca/engine.git
synced 2025-10-13 04:13:50 +08:00
rtp判断空包,音频rtp包不判断marker
This commit is contained in:
38
util/reorder_test.go
Normal file
38
util/reorder_test.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
type stuff struct {
|
||||
seq uint16
|
||||
}
|
||||
|
||||
func (s *stuff) Clone() *stuff {
|
||||
return s
|
||||
}
|
||||
|
||||
func TestReorder(t *testing.T) {
|
||||
t.Run(t.Name(), func(t *testing.T) {
|
||||
var recoder RTPReorder[*stuff]
|
||||
for i := (uint16)(0); i < 25; i++ {
|
||||
recoder.Push(i*2, &stuff{seq: i * 2})
|
||||
}
|
||||
if recoder.Pop() != nil {
|
||||
t.Error("pop nil")
|
||||
}
|
||||
for i := (uint16)(0); i < 25; i++ {
|
||||
x := recoder.Push(i*2+1, &stuff{seq: i*2 + 1})
|
||||
if x != nil {
|
||||
t.Logf("%d", x.seq)
|
||||
}
|
||||
for {
|
||||
if x = recoder.Pop(); x == nil {
|
||||
break
|
||||
} else {
|
||||
t.Logf("%d", x.seq)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user