mirror of
https://github.com/jech/galene.git
synced 2024-11-22 00:25:58 +01:00
Use bytes.Clone in codecs_test.
This commit is contained in:
parent
54c5d040d1
commit
45bbb138c6
1 changed files with 7 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
||||||
package codecs
|
package codecs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/pion/rtp"
|
"github.com/pion/rtp"
|
||||||
|
@ -147,7 +148,7 @@ var emptyVP8 = []byte{
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPacketFlagsVP8(t *testing.T) {
|
func TestPacketFlagsVP8(t *testing.T) {
|
||||||
buf := append([]byte{}, vp8...)
|
buf := bytes.Clone(vp8)
|
||||||
flags, err := PacketFlags("video/vp8", buf)
|
flags, err := PacketFlags("video/vp8", buf)
|
||||||
if flags.Seqno != 42 || !flags.Start || flags.Pid != 57 ||
|
if flags.Seqno != 42 || !flags.Start || flags.Pid != 57 ||
|
||||||
flags.Sid != 0 || flags.Tid != 0 ||
|
flags.Sid != 0 || flags.Tid != 0 ||
|
||||||
|
@ -160,7 +161,7 @@ func TestPacketFlagsVP8(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEmptyPacketFlagsVP8(t *testing.T) {
|
func TestEmptyPacketFlagsVP8(t *testing.T) {
|
||||||
buf := append([]byte{}, emptyVP8...)
|
buf := bytes.Clone(emptyVP8)
|
||||||
flags, err := PacketFlags("video/vp8", buf)
|
flags, err := PacketFlags("video/vp8", buf)
|
||||||
if flags.Seqno != 42 || flags.Start ||
|
if flags.Seqno != 42 || flags.Start ||
|
||||||
flags.Sid != 0 || flags.Tid != 0 ||
|
flags.Sid != 0 || flags.Tid != 0 ||
|
||||||
|
@ -174,7 +175,7 @@ func TestEmptyPacketFlagsVP8(t *testing.T) {
|
||||||
|
|
||||||
func TestRewriteVP8(t *testing.T) {
|
func TestRewriteVP8(t *testing.T) {
|
||||||
for i := uint16(0); i < 0x7fff; i++ {
|
for i := uint16(0); i < 0x7fff; i++ {
|
||||||
buf := append([]byte{}, vp8...)
|
buf := bytes.Clone(vp8)
|
||||||
err := RewritePacket("video/vp8", buf, true, i, i)
|
err := RewritePacket("video/vp8", buf, true, i, i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("rewrite: %v", err)
|
t.Errorf("rewrite: %v", err)
|
||||||
|
@ -192,7 +193,7 @@ func TestRewriteVP8(t *testing.T) {
|
||||||
|
|
||||||
func TestRewriteEmptyVP8(t *testing.T) {
|
func TestRewriteEmptyVP8(t *testing.T) {
|
||||||
for i := uint16(0); i < 0x7fff; i++ {
|
for i := uint16(0); i < 0x7fff; i++ {
|
||||||
buf := append([]byte{}, emptyVP8...)
|
buf := bytes.Clone(emptyVP8)
|
||||||
err := RewritePacket("video/vp8", buf, true, i, i)
|
err := RewritePacket("video/vp8", buf, true, i, i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("rewrite: %v", err)
|
t.Errorf("rewrite: %v", err)
|
||||||
|
@ -217,7 +218,7 @@ var vp9 = []byte{
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPacketFlagsVP9(t *testing.T) {
|
func TestPacketFlagsVP9(t *testing.T) {
|
||||||
buf := append([]byte{}, vp9...)
|
buf := bytes.Clone(vp9)
|
||||||
flags, err := PacketFlags("video/vp9", buf)
|
flags, err := PacketFlags("video/vp9", buf)
|
||||||
if flags.Seqno != 42 || !flags.Start || flags.Pid != 0 ||
|
if flags.Seqno != 42 || !flags.Start || flags.Pid != 0 ||
|
||||||
flags.Sid != 0 || flags.Tid != 0 ||
|
flags.Sid != 0 || flags.Tid != 0 ||
|
||||||
|
@ -231,7 +232,7 @@ func TestPacketFlagsVP9(t *testing.T) {
|
||||||
|
|
||||||
func TestRewriteVP9(t *testing.T) {
|
func TestRewriteVP9(t *testing.T) {
|
||||||
for i := uint16(0); i < 0x7fff; i++ {
|
for i := uint16(0); i < 0x7fff; i++ {
|
||||||
buf := append([]byte{}, vp9...)
|
buf := bytes.Clone(vp9)
|
||||||
err := RewritePacket("video/vp9", buf, true, i, i)
|
err := RewritePacket("video/vp9", buf, true, i, i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("rewrite: %v", err)
|
t.Errorf("rewrite: %v", err)
|
||||||
|
|
Loading…
Reference in a new issue