support RTSP-over-HTTP (#433) (#768) (#887)

This commit is contained in:
Alessandro Ros
2025-09-15 19:00:50 +02:00
committed by GitHub
parent 73474c7569
commit ead4471b5c
82 changed files with 1786 additions and 610 deletions

View File

@@ -0,0 +1,71 @@
package asyncprocessor
import (
"context"
"fmt"
"testing"
"github.com/stretchr/testify/require"
)
func TestCloseBeforeStart(_ *testing.T) {
p := &Processor{
BufferSize: 8,
}
p.Initialize()
defer p.Close()
}
func TestCloseAfterError(t *testing.T) {
done := make(chan struct{})
p := &Processor{
BufferSize: 8,
OnError: func(_ context.Context, err error) {
require.EqualError(t, err, "ok")
close(done)
},
}
p.Initialize()
defer p.Close()
p.Push(func() error {
return fmt.Errorf("ok")
})
p.Start()
<-done
}
func TestCloseBeforeError(_ *testing.T) {
p := &Processor{
BufferSize: 8,
OnError: func(_ context.Context, _ error) {},
}
p.Initialize()
defer p.Close()
p.Push(func() error {
return nil
})
p.Start()
}
func TestCloseDuringError(_ *testing.T) {
p := &Processor{
BufferSize: 8,
OnError: func(ctx context.Context, _ error) {
<-ctx.Done()
},
}
p.Initialize()
defer p.Close()
p.Push(func() error {
return fmt.Errorf("ok")
})
p.Start()
}