2023-05-18 16:00:53 +00:00
|
|
|
package formatprocessor
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/bluenviron/gortsplib/v3/pkg/formats"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
2023-07-30 20:55:13 +00:00
|
|
|
func TestAV1KeyFrameWarning(t *testing.T) { //nolint:dupl
|
2023-05-18 16:00:53 +00:00
|
|
|
forma := &formats.AV1{
|
|
|
|
PayloadTyp: 96,
|
|
|
|
}
|
|
|
|
|
|
|
|
w := &testLogWriter{recv: make(chan string, 1)}
|
|
|
|
p, err := New(1472, forma, true, w)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
ntp := time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)
|
|
|
|
err = p.Process(&UnitAV1{
|
2023-07-30 20:55:13 +00:00
|
|
|
BaseUnit: BaseUnit{
|
|
|
|
NTP: ntp,
|
|
|
|
},
|
2023-05-18 16:00:53 +00:00
|
|
|
OBUs: [][]byte{
|
|
|
|
{0x01},
|
|
|
|
},
|
|
|
|
}, false)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
ntp = ntp.Add(30 * time.Second)
|
|
|
|
err = p.Process(&UnitAV1{
|
2023-07-30 20:55:13 +00:00
|
|
|
BaseUnit: BaseUnit{
|
|
|
|
NTP: ntp,
|
|
|
|
},
|
2023-05-18 16:00:53 +00:00
|
|
|
OBUs: [][]byte{
|
|
|
|
{0x01},
|
|
|
|
},
|
|
|
|
}, false)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
logl := <-w.recv
|
|
|
|
require.Equal(t, "no AV1 key frames received in 10s, stream can't be decoded", logl)
|
|
|
|
}
|