mirror of
https://github.com/bluenviron/mediamtx
synced 2025-01-28 10:02:58 +00:00
9e6abc6e9f
* rtmp: improve MsgCommandAMF0 * rtmp: fix MsgSetPeerBandwidth * rtmp: add message tests * rtmp: replace implementation with new one * rtmp: rename handshake functions * rtmp: avoid calling useless function * rtmp: use time.Duration for PTSDelta * rtmp: fix decoding chunks with relevant size * rtmp: rewrite implementation of rtmp connection * rtmp: fix tests * rtmp: improve error message * rtmp: replace h264 config implementation * link against github.com/notedit/rtmp * normalize MessageStreamID * rtmp: make acknowledge optional * rtmp: fix decoding of chunk2 + chunk3 * avoid using encoding/binary
30 lines
551 B
Go
30 lines
551 B
Go
package h264conf
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
var decoded = Conf{
|
|
SPS: []byte{0x45, 0x32, 0xA3, 0x08},
|
|
PPS: []byte{0x45, 0x34},
|
|
}
|
|
|
|
var encoded = []byte{
|
|
0x1, 0x32, 0xa3, 0x8, 0xff, 0xe1, 0x0, 0x4, 0x45, 0x32, 0xa3, 0x8, 0x1, 0x0, 0x2, 0x45, 0x34,
|
|
}
|
|
|
|
func TestUnmarshal(t *testing.T) {
|
|
var dec Conf
|
|
err := dec.Unmarshal(encoded)
|
|
require.NoError(t, err)
|
|
require.Equal(t, decoded, dec)
|
|
}
|
|
|
|
func TestMarshal(t *testing.T) {
|
|
enc, err := decoded.Marshal()
|
|
require.NoError(t, err)
|
|
require.Equal(t, encoded, enc)
|
|
}
|