mirror of
https://github.com/datarhei/core.git
synced 2025-10-05 16:07:07 +08:00
68 lines
1.2 KiB
Go
68 lines
1.2 KiB
Go
package api
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/datarhei/core/v16/restream/app"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestAVStreamIO(t *testing.T) {
|
|
original := app.AVstreamIO{
|
|
State: "xxx",
|
|
Packet: 100,
|
|
Time: 42,
|
|
Size: 95744,
|
|
}
|
|
|
|
p := AVstreamIO{}
|
|
p.Unmarshal(&original)
|
|
restored := p.Marshal()
|
|
|
|
require.Equal(t, original, restored)
|
|
}
|
|
|
|
func TestAVStream(t *testing.T) {
|
|
original := app.AVstream{
|
|
Input: app.AVstreamIO{
|
|
State: "xxx",
|
|
Packet: 100,
|
|
Time: 42,
|
|
Size: 95744,
|
|
},
|
|
Output: app.AVstreamIO{
|
|
State: "yyy",
|
|
Packet: 7473,
|
|
Time: 57634,
|
|
Size: 363,
|
|
},
|
|
Aqueue: 3829,
|
|
Queue: 4398,
|
|
Dup: 47,
|
|
Drop: 85,
|
|
Enc: 4578,
|
|
Looping: true,
|
|
LoopingRuntime: 483,
|
|
Duplicating: true,
|
|
GOP: "gop",
|
|
Mode: "mode",
|
|
Codec: "h264",
|
|
Profile: 858,
|
|
Level: 64,
|
|
Pixfmt: "yuv420p",
|
|
Width: 1920,
|
|
Height: 1080,
|
|
Samplefmt: "fltp",
|
|
Sampling: 44100,
|
|
Layout: "stereo",
|
|
Channels: 42,
|
|
}
|
|
|
|
p := AVstream{}
|
|
p.Unmarshal(&original)
|
|
restored := p.Marshal()
|
|
|
|
require.Equal(t, &original, restored)
|
|
}
|