Live video on the AT Protocol
1package media
2
3import (
4 "bytes"
5 "context"
6 "testing"
7
8 "github.com/stretchr/testify/require"
9 "golang.org/x/sync/errgroup"
10)
11
12func TestClip(t *testing.T) {
13 withNoGSTLeaks(t, func() {
14 g, _ := errgroup.WithContext(context.Background())
15 for range streamplaceTestCount {
16 g.Go(func() error {
17 return innerTestClip(t)
18 })
19 }
20 err := g.Wait()
21 require.NoError(t, err)
22 })
23}
24
25func innerTestClip(t *testing.T) error {
26 fName := getFixture("sample-segment.mp4")
27 inputFiles := []string{fName, fName, fName}
28 buf := bytes.NewBuffer(nil)
29 err := Clip(context.Background(), inputFiles, buf)
30 require.NoError(t, err)
31 require.Greater(t, buf.Len(), 2900000)
32 require.Less(t, buf.Len(), 3100000)
33 return nil
34}