|
|
|
@ -25,11 +25,13 @@ import (
|
|
|
|
|
"encoding/json"
|
|
|
|
|
"fmt"
|
|
|
|
|
"github.com/pion/transport/vnet"
|
|
|
|
|
"github.com/pion/webrtc/v3"
|
|
|
|
|
"io"
|
|
|
|
|
"io/ioutil"
|
|
|
|
|
"math/rand"
|
|
|
|
|
"net/http"
|
|
|
|
|
"os"
|
|
|
|
|
"strings"
|
|
|
|
|
"sync"
|
|
|
|
|
"testing"
|
|
|
|
|
"time"
|
|
|
|
@ -58,11 +60,384 @@ func TestMain(m *testing.M) {
|
|
|
|
|
os.Exit(m.Run())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Test for https://github.com/ossrs/srs/pull/2483
|
|
|
|
|
func TestPR2483_RtcStatApi_PublisherOnly(t *testing.T) {
|
|
|
|
|
if err := filterTestError(func() error {
|
|
|
|
|
streamSuffix := fmt.Sprintf("publish-only-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
p, err := newTestPublisher(registerDefaultCodecs, func(p *testPublisher) error {
|
|
|
|
|
p.streamSuffix = streamSuffix
|
|
|
|
|
return nil
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
defer p.Close()
|
|
|
|
|
|
|
|
|
|
ctx, cancel := context.WithTimeout(logger.WithContext(context.Background()), time.Duration(*srsTimeout)*time.Millisecond)
|
|
|
|
|
if err := p.Setup(*srsVnetClientIP, func(api *testWebRTCAPI) {
|
|
|
|
|
var once sync.Once
|
|
|
|
|
api.registry.Add(newRTCPInterceptor(func(i *rtcpInterceptor) {
|
|
|
|
|
i.rtcpReader = func(buf []byte, attributes interceptor.Attributes) (int, interceptor.Attributes, error) {
|
|
|
|
|
once.Do(func() {
|
|
|
|
|
stat := newStatAPI(ctx).Streams().FilterByStreamSuffix(p.streamSuffix)
|
|
|
|
|
logger.Tf(ctx, "Check publishing, streams=%v, stream=%v", len(stat.streams), stat.stream)
|
|
|
|
|
if stat.stream != nil {
|
|
|
|
|
cancel() // done
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
return i.nextRTCPReader.Read(buf, attributes)
|
|
|
|
|
}
|
|
|
|
|
}))
|
|
|
|
|
}); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return p.Run(ctx, cancel)
|
|
|
|
|
}()); err != nil {
|
|
|
|
|
t.Errorf("err %+v", err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Veirfy https://github.com/ossrs/srs/issues/2371
|
|
|
|
|
func TestBugfix2371_PublishWithNack(t *testing.T) {
|
|
|
|
|
ctx, cancel := context.WithTimeout(logger.WithContext(context.Background()), time.Duration(*srsTimeout)*time.Millisecond)
|
|
|
|
|
if err := filterTestError(func() error {
|
|
|
|
|
streamSuffix := fmt.Sprintf("bugfix-2371-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
p, err := newTestPublisher(registerMiniCodecs, func(p *testPublisher) error {
|
|
|
|
|
p.streamSuffix = streamSuffix
|
|
|
|
|
p.onOffer = func(s *webrtc.SessionDescription) error {
|
|
|
|
|
if n := strings.Count(s.SDP, "nack"); n != 2 {
|
|
|
|
|
return errors.Errorf("invalid %v nack", n)
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
p.onAnswer = func(s *webrtc.SessionDescription) error {
|
|
|
|
|
if n := strings.Count(s.SDP, "nack"); n != 2 {
|
|
|
|
|
return errors.Errorf("invalid %v nack", n)
|
|
|
|
|
}
|
|
|
|
|
cancel()
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
defer p.Close()
|
|
|
|
|
|
|
|
|
|
if err := p.Setup(*srsVnetClientIP); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return p.Run(ctx, cancel)
|
|
|
|
|
}()); err != nil {
|
|
|
|
|
t.Errorf("err %+v", err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Veirfy https://github.com/ossrs/srs/issues/2371
|
|
|
|
|
func TestBugfix2371_PublishWithoutNack(t *testing.T) {
|
|
|
|
|
ctx, cancel := context.WithTimeout(logger.WithContext(context.Background()), time.Duration(*srsTimeout)*time.Millisecond)
|
|
|
|
|
if err := filterTestError(func() error {
|
|
|
|
|
streamSuffix := fmt.Sprintf("bugfix-2371-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
p, err := newTestPublisher(registerMiniCodecsWithoutNack, func(p *testPublisher) error {
|
|
|
|
|
p.streamSuffix = streamSuffix
|
|
|
|
|
p.onOffer = func(s *webrtc.SessionDescription) error {
|
|
|
|
|
if n := strings.Count(s.SDP, "nack"); n != 0 {
|
|
|
|
|
return errors.Errorf("invalid %v nack", n)
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
p.onAnswer = func(s *webrtc.SessionDescription) error {
|
|
|
|
|
if n := strings.Count(s.SDP, "nack"); n != 0 {
|
|
|
|
|
return errors.Errorf("invalid %v nack", n)
|
|
|
|
|
}
|
|
|
|
|
cancel()
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
defer p.Close()
|
|
|
|
|
|
|
|
|
|
if err := p.Setup(*srsVnetClientIP); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return p.Run(ctx, cancel)
|
|
|
|
|
}()); err != nil {
|
|
|
|
|
t.Errorf("err %+v", err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Veirfy https://github.com/ossrs/srs/issues/2371
|
|
|
|
|
func TestBugfix2371_PlayWithNack(t *testing.T) {
|
|
|
|
|
ctx := logger.WithContext(context.Background())
|
|
|
|
|
ctx, cancel := context.WithTimeout(ctx, time.Duration(*srsTimeout)*time.Millisecond)
|
|
|
|
|
|
|
|
|
|
var r0, r1, r2, r3 error
|
|
|
|
|
defer func(ctx context.Context) {
|
|
|
|
|
if err := filterTestError(ctx.Err(), r0, r1, r2, r3); err != nil {
|
|
|
|
|
t.Errorf("Fail for err %+v", err)
|
|
|
|
|
} else {
|
|
|
|
|
logger.Tf(ctx, "test done with err %+v", err)
|
|
|
|
|
}
|
|
|
|
|
}(ctx)
|
|
|
|
|
|
|
|
|
|
var resources []io.Closer
|
|
|
|
|
defer func() {
|
|
|
|
|
for _, resource := range resources {
|
|
|
|
|
_ = resource.Close()
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
var wg sync.WaitGroup
|
|
|
|
|
defer wg.Wait()
|
|
|
|
|
|
|
|
|
|
// The event notify.
|
|
|
|
|
var thePublisher *testPublisher
|
|
|
|
|
var thePlayer *testPlayer
|
|
|
|
|
|
|
|
|
|
mainReady, mainReadyCancel := context.WithCancel(context.Background())
|
|
|
|
|
publishReady, publishReadyCancel := context.WithCancel(context.Background())
|
|
|
|
|
|
|
|
|
|
// Objects init.
|
|
|
|
|
wg.Add(1)
|
|
|
|
|
go func() {
|
|
|
|
|
defer wg.Done()
|
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
|
|
doInit := func() (err error) {
|
|
|
|
|
streamSuffix := fmt.Sprintf("basic-publish-play-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
|
|
|
|
|
// Initialize player with private api.
|
|
|
|
|
if thePlayer, err = newTestPlayer(registerMiniCodecs, func(play *testPlayer) error {
|
|
|
|
|
play.streamSuffix = streamSuffix
|
|
|
|
|
play.onOffer = func(s *webrtc.SessionDescription) error {
|
|
|
|
|
if n := strings.Count(s.SDP, "nack"); n != 2 {
|
|
|
|
|
return errors.Errorf("invalid %v nack", n)
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
play.onAnswer = func(s *webrtc.SessionDescription) error {
|
|
|
|
|
if n := strings.Count(s.SDP, "nack"); n != 2 {
|
|
|
|
|
return errors.Errorf("invalid %v nack", n)
|
|
|
|
|
}
|
|
|
|
|
cancel()
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
resources = append(resources, play)
|
|
|
|
|
return play.Setup(*srsVnetClientIP)
|
|
|
|
|
}); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Initialize publisher with private api.
|
|
|
|
|
if thePublisher, err = newTestPublisher(registerMiniCodecs, func(pub *testPublisher) error {
|
|
|
|
|
pub.streamSuffix = streamSuffix
|
|
|
|
|
pub.iceReadyCancel = publishReadyCancel
|
|
|
|
|
resources = append(resources, pub)
|
|
|
|
|
return pub.Setup(*srsVnetClientIP)
|
|
|
|
|
}); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Init done.
|
|
|
|
|
mainReadyCancel()
|
|
|
|
|
|
|
|
|
|
<-ctx.Done()
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if err := doInit(); err != nil {
|
|
|
|
|
r1 = err
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
// Run publisher.
|
|
|
|
|
wg.Add(1)
|
|
|
|
|
go func() {
|
|
|
|
|
defer wg.Done()
|
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
|
|
select {
|
|
|
|
|
case <-ctx.Done():
|
|
|
|
|
case <-mainReady.Done():
|
|
|
|
|
r2 = thePublisher.Run(logger.WithContext(ctx), cancel)
|
|
|
|
|
logger.Tf(ctx, "pub done")
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
// Run player.
|
|
|
|
|
wg.Add(1)
|
|
|
|
|
go func() {
|
|
|
|
|
defer wg.Done()
|
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
|
|
select {
|
|
|
|
|
case <-ctx.Done():
|
|
|
|
|
case <-publishReady.Done():
|
|
|
|
|
r3 = thePlayer.Run(logger.WithContext(ctx), cancel)
|
|
|
|
|
logger.Tf(ctx, "play done")
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Veirfy https://github.com/ossrs/srs/issues/2371
|
|
|
|
|
func TestBugfix2371_PlayWithoutNack(t *testing.T) {
|
|
|
|
|
ctx := logger.WithContext(context.Background())
|
|
|
|
|
ctx, cancel := context.WithTimeout(ctx, time.Duration(*srsTimeout)*time.Millisecond)
|
|
|
|
|
|
|
|
|
|
var r0, r1, r2, r3 error
|
|
|
|
|
defer func(ctx context.Context) {
|
|
|
|
|
if err := filterTestError(ctx.Err(), r0, r1, r2, r3); err != nil {
|
|
|
|
|
t.Errorf("Fail for err %+v", err)
|
|
|
|
|
} else {
|
|
|
|
|
logger.Tf(ctx, "test done with err %+v", err)
|
|
|
|
|
}
|
|
|
|
|
}(ctx)
|
|
|
|
|
|
|
|
|
|
var resources []io.Closer
|
|
|
|
|
defer func() {
|
|
|
|
|
for _, resource := range resources {
|
|
|
|
|
_ = resource.Close()
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
var wg sync.WaitGroup
|
|
|
|
|
defer wg.Wait()
|
|
|
|
|
|
|
|
|
|
// The event notify.
|
|
|
|
|
var thePublisher *testPublisher
|
|
|
|
|
var thePlayer *testPlayer
|
|
|
|
|
|
|
|
|
|
mainReady, mainReadyCancel := context.WithCancel(context.Background())
|
|
|
|
|
publishReady, publishReadyCancel := context.WithCancel(context.Background())
|
|
|
|
|
|
|
|
|
|
// Objects init.
|
|
|
|
|
wg.Add(1)
|
|
|
|
|
go func() {
|
|
|
|
|
defer wg.Done()
|
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
|
|
doInit := func() (err error) {
|
|
|
|
|
streamSuffix := fmt.Sprintf("basic-publish-play-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
|
|
|
|
|
// Initialize player with private api.
|
|
|
|
|
if thePlayer, err = newTestPlayer(registerMiniCodecsWithoutNack, func(play *testPlayer) error {
|
|
|
|
|
play.streamSuffix = streamSuffix
|
|
|
|
|
play.onOffer = func(s *webrtc.SessionDescription) error {
|
|
|
|
|
if n := strings.Count(s.SDP, "nack"); n != 0 {
|
|
|
|
|
return errors.Errorf("invalid %v nack", n)
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
play.onAnswer = func(s *webrtc.SessionDescription) error {
|
|
|
|
|
if n := strings.Count(s.SDP, "nack"); n != 0 {
|
|
|
|
|
return errors.Errorf("invalid %v nack", n)
|
|
|
|
|
}
|
|
|
|
|
cancel()
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
resources = append(resources, play)
|
|
|
|
|
return play.Setup(*srsVnetClientIP)
|
|
|
|
|
}); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Initialize publisher with private api.
|
|
|
|
|
if thePublisher, err = newTestPublisher(registerMiniCodecs, func(pub *testPublisher) error {
|
|
|
|
|
pub.streamSuffix = streamSuffix
|
|
|
|
|
pub.iceReadyCancel = publishReadyCancel
|
|
|
|
|
resources = append(resources, pub)
|
|
|
|
|
return pub.Setup(*srsVnetClientIP)
|
|
|
|
|
}); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Init done.
|
|
|
|
|
mainReadyCancel()
|
|
|
|
|
|
|
|
|
|
<-ctx.Done()
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if err := doInit(); err != nil {
|
|
|
|
|
r1 = err
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
// Run publisher.
|
|
|
|
|
wg.Add(1)
|
|
|
|
|
go func() {
|
|
|
|
|
defer wg.Done()
|
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
|
|
select {
|
|
|
|
|
case <-ctx.Done():
|
|
|
|
|
case <-mainReady.Done():
|
|
|
|
|
r2 = thePublisher.Run(logger.WithContext(ctx), cancel)
|
|
|
|
|
logger.Tf(ctx, "pub done")
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
// Run player.
|
|
|
|
|
wg.Add(1)
|
|
|
|
|
go func() {
|
|
|
|
|
defer wg.Done()
|
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
|
|
select {
|
|
|
|
|
case <-ctx.Done():
|
|
|
|
|
case <-publishReady.Done():
|
|
|
|
|
r3 = thePlayer.Run(logger.WithContext(ctx), cancel)
|
|
|
|
|
logger.Tf(ctx, "play done")
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Veirfy https://github.com/ossrs/srs/issues/2371
|
|
|
|
|
func TestBugfix2371_RTMP2RTC_PlayWithNack(t *testing.T) {
|
|
|
|
|
if err := filterTestError(func() error {
|
|
|
|
|
ctx, cancel := context.WithTimeout(logger.WithContext(context.Background()), time.Duration(*srsTimeout)*time.Millisecond)
|
|
|
|
|
p, err := newTestPlayer(registerMiniCodecs, func(play *testPlayer) error {
|
|
|
|
|
play.onOffer = func(s *webrtc.SessionDescription) error {
|
|
|
|
|
if n := strings.Count(s.SDP, "nack"); n != 2 {
|
|
|
|
|
return errors.Errorf("invalid %v nack", n)
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
play.onAnswer = func(s *webrtc.SessionDescription) error {
|
|
|
|
|
if n := strings.Count(s.SDP, "nack"); n != 2 {
|
|
|
|
|
return errors.Errorf("invalid %v nack", n)
|
|
|
|
|
}
|
|
|
|
|
cancel()
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
defer p.Close()
|
|
|
|
|
|
|
|
|
|
if err := p.Setup(*srsVnetClientIP); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return p.Run(ctx, cancel)
|
|
|
|
|
}()); err != nil {
|
|
|
|
|
t.Errorf("err %+v", err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Basic use scenario, publish a stream.
|
|
|
|
|
func TestRtcBasic_PublishOnly(t *testing.T) {
|
|
|
|
|
if err := filterTestError(func() error {
|
|
|
|
|
streamSuffix := fmt.Sprintf("publish-only-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
p, err := newTestPublisher(createApiForPublisher, func(p *testPublisher) error {
|
|
|
|
|
p, err := newTestPublisher(registerDefaultCodecs, func(p *testPublisher) error {
|
|
|
|
|
p.streamSuffix = streamSuffix
|
|
|
|
|
return nil
|
|
|
|
|
})
|
|
|
|
@ -149,7 +524,7 @@ func TestRtcBasic_PublishPlay(t *testing.T) {
|
|
|
|
|
streamSuffix := fmt.Sprintf("basic-publish-play-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
|
|
|
|
|
// Initialize player with private api.
|
|
|
|
|
if thePlayer, err = newTestPlayer(createApiForPlayer, func(play *testPlayer) error {
|
|
|
|
|
if thePlayer, err = newTestPlayer(registerDefaultCodecs, func(play *testPlayer) error {
|
|
|
|
|
play.streamSuffix = streamSuffix
|
|
|
|
|
resources = append(resources, play)
|
|
|
|
|
|
|
|
|
@ -183,7 +558,7 @@ func TestRtcBasic_PublishPlay(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Initialize publisher with private api.
|
|
|
|
|
if thePublisher, err = newTestPublisher(createApiForPublisher, func(pub *testPublisher) error {
|
|
|
|
|
if thePublisher, err = newTestPublisher(registerDefaultCodecs, func(pub *testPublisher) error {
|
|
|
|
|
pub.streamSuffix = streamSuffix
|
|
|
|
|
pub.iceReadyCancel = publishReadyCancel
|
|
|
|
|
resources = append(resources, pub)
|
|
|
|
@ -304,7 +679,7 @@ func TestRtcBasic_Republish(t *testing.T) {
|
|
|
|
|
streamSuffix := fmt.Sprintf("basic-publish-play-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
|
|
|
|
|
// Initialize player with private api.
|
|
|
|
|
if thePlayer, err = newTestPlayer(createApiForPlayer, func(play *testPlayer) error {
|
|
|
|
|
if thePlayer, err = newTestPlayer(registerDefaultCodecs, func(play *testPlayer) error {
|
|
|
|
|
play.streamSuffix = streamSuffix
|
|
|
|
|
resources = append(resources, play)
|
|
|
|
|
|
|
|
|
@ -330,7 +705,7 @@ func TestRtcBasic_Republish(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Initialize publisher with private api.
|
|
|
|
|
if thePublisher, err = newTestPublisher(createApiForPublisher, func(pub *testPublisher) error {
|
|
|
|
|
if thePublisher, err = newTestPublisher(registerDefaultCodecs, func(pub *testPublisher) error {
|
|
|
|
|
pub.streamSuffix = streamSuffix
|
|
|
|
|
pub.iceReadyCancel = publishReadyCancel
|
|
|
|
|
resources = append(resources, pub)
|
|
|
|
@ -353,7 +728,7 @@ func TestRtcBasic_Republish(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Initialize re-publisher with private api.
|
|
|
|
|
if theRepublisher, err = newTestPublisher(createApiForPublisher, func(pub *testPublisher) error {
|
|
|
|
|
if theRepublisher, err = newTestPublisher(registerDefaultCodecs, func(pub *testPublisher) error {
|
|
|
|
|
pub.streamSuffix = streamSuffix
|
|
|
|
|
pub.iceReadyCancel = republishReadyCancel
|
|
|
|
|
resources = append(resources, pub)
|
|
|
|
@ -419,7 +794,7 @@ func TestRtcBasic_Republish(t *testing.T) {
|
|
|
|
|
func TestRtcDTLS_ClientActive_Default(t *testing.T) {
|
|
|
|
|
if err := filterTestError(func() error {
|
|
|
|
|
streamSuffix := fmt.Sprintf("dtls-passive-no-arq-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
p, err := newTestPublisher(createApiForPublisher, func(p *testPublisher) error {
|
|
|
|
|
p, err := newTestPublisher(registerDefaultCodecs, func(p *testPublisher) error {
|
|
|
|
|
p.streamSuffix = streamSuffix
|
|
|
|
|
p.onOffer = testUtilSetupActive
|
|
|
|
|
return nil
|
|
|
|
@ -474,7 +849,7 @@ func TestRtcDTLS_ClientActive_Default(t *testing.T) {
|
|
|
|
|
func TestRtcDTLS_ClientPassive_Default(t *testing.T) {
|
|
|
|
|
if err := filterTestError(func() error {
|
|
|
|
|
streamSuffix := fmt.Sprintf("dtls-active-no-arq-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
p, err := newTestPublisher(createApiForPublisher, func(p *testPublisher) error {
|
|
|
|
|
p, err := newTestPublisher(registerDefaultCodecs, func(p *testPublisher) error {
|
|
|
|
|
p.streamSuffix = streamSuffix
|
|
|
|
|
p.onOffer = testUtilSetupPassive
|
|
|
|
|
return nil
|
|
|
|
@ -526,7 +901,7 @@ func TestRtcDTLS_ClientPassive_Default(t *testing.T) {
|
|
|
|
|
func TestRtcDTLS_ClientActive_Duplicated_Alert(t *testing.T) {
|
|
|
|
|
if err := filterTestError(func() error {
|
|
|
|
|
streamSuffix := fmt.Sprintf("dtls-active-no-arq-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
p, err := newTestPublisher(createApiForPublisher, func(p *testPublisher) error {
|
|
|
|
|
p, err := newTestPublisher(registerDefaultCodecs, func(p *testPublisher) error {
|
|
|
|
|
p.streamSuffix = streamSuffix
|
|
|
|
|
p.onOffer = testUtilSetupActive
|
|
|
|
|
return nil
|
|
|
|
@ -585,7 +960,7 @@ func TestRtcDTLS_ClientActive_Duplicated_Alert(t *testing.T) {
|
|
|
|
|
func TestRtcDTLS_ClientPassive_Duplicated_Alert(t *testing.T) {
|
|
|
|
|
if err := filterTestError(func() error {
|
|
|
|
|
streamSuffix := fmt.Sprintf("dtls-active-no-arq-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
p, err := newTestPublisher(createApiForPublisher, func(p *testPublisher) error {
|
|
|
|
|
p, err := newTestPublisher(registerDefaultCodecs, func(p *testPublisher) error {
|
|
|
|
|
p.streamSuffix = streamSuffix
|
|
|
|
|
p.onOffer = testUtilSetupPassive
|
|
|
|
|
return nil
|
|
|
|
@ -651,7 +1026,7 @@ func TestRtcDTLS_ClientActive_ARQ_ClientHello_ByDropped_ClientHello(t *testing.T
|
|
|
|
|
var r0 error
|
|
|
|
|
err := func() error {
|
|
|
|
|
streamSuffix := fmt.Sprintf("dtls-active-arq-client-hello-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
p, err := newTestPublisher(createApiForPublisher, func(p *testPublisher) error {
|
|
|
|
|
p, err := newTestPublisher(registerDefaultCodecs, func(p *testPublisher) error {
|
|
|
|
|
p.streamSuffix = streamSuffix
|
|
|
|
|
p.onOffer = testUtilSetupActive
|
|
|
|
|
return nil
|
|
|
|
@ -729,7 +1104,7 @@ func TestRtcDTLS_ClientPassive_ARQ_ClientHello_ByDropped_ClientHello(t *testing.
|
|
|
|
|
var r0 error
|
|
|
|
|
err := func() error {
|
|
|
|
|
streamSuffix := fmt.Sprintf("dtls-passive-arq-client-hello-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
p, err := newTestPublisher(createApiForPublisher, func(p *testPublisher) error {
|
|
|
|
|
p, err := newTestPublisher(registerDefaultCodecs, func(p *testPublisher) error {
|
|
|
|
|
p.streamSuffix = streamSuffix
|
|
|
|
|
p.onOffer = testUtilSetupPassive
|
|
|
|
|
return nil
|
|
|
|
@ -806,7 +1181,7 @@ func TestRtcDTLS_ClientActive_ARQ_ClientHello_ByDropped_ServerHello(t *testing.T
|
|
|
|
|
var r0, r1 error
|
|
|
|
|
err := func() error {
|
|
|
|
|
streamSuffix := fmt.Sprintf("dtls-active-arq-client-hello-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
p, err := newTestPublisher(createApiForPublisher, func(p *testPublisher) error {
|
|
|
|
|
p, err := newTestPublisher(registerDefaultCodecs, func(p *testPublisher) error {
|
|
|
|
|
p.streamSuffix = streamSuffix
|
|
|
|
|
p.onOffer = testUtilSetupActive
|
|
|
|
|
return nil
|
|
|
|
@ -894,7 +1269,7 @@ func TestRtcDTLS_ClientPassive_ARQ_ClientHello_ByDropped_ServerHello(t *testing.
|
|
|
|
|
var r0, r1 error
|
|
|
|
|
err := func() error {
|
|
|
|
|
streamSuffix := fmt.Sprintf("dtls-passive-arq-client-hello-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
p, err := newTestPublisher(createApiForPublisher, func(p *testPublisher) error {
|
|
|
|
|
p, err := newTestPublisher(registerDefaultCodecs, func(p *testPublisher) error {
|
|
|
|
|
p.streamSuffix = streamSuffix
|
|
|
|
|
p.onOffer = testUtilSetupPassive
|
|
|
|
|
return nil
|
|
|
|
@ -979,7 +1354,7 @@ func TestRtcDTLS_ClientActive_ARQ_Certificate_ByDropped_Certificate(t *testing.T
|
|
|
|
|
var r0 error
|
|
|
|
|
err := func() error {
|
|
|
|
|
streamSuffix := fmt.Sprintf("dtls-active-arq-certificate-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
p, err := newTestPublisher(createApiForPublisher, func(p *testPublisher) error {
|
|
|
|
|
p, err := newTestPublisher(registerDefaultCodecs, func(p *testPublisher) error {
|
|
|
|
|
p.streamSuffix = streamSuffix
|
|
|
|
|
p.onOffer = testUtilSetupActive
|
|
|
|
|
return nil
|
|
|
|
@ -1056,7 +1431,7 @@ func TestRtcDTLS_ClientPassive_ARQ_Certificate_ByDropped_Certificate(t *testing.
|
|
|
|
|
var r0 error
|
|
|
|
|
err := func() error {
|
|
|
|
|
streamSuffix := fmt.Sprintf("dtls-passive-arq-certificate-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
p, err := newTestPublisher(createApiForPublisher, func(p *testPublisher) error {
|
|
|
|
|
p, err := newTestPublisher(registerDefaultCodecs, func(p *testPublisher) error {
|
|
|
|
|
p.streamSuffix = streamSuffix
|
|
|
|
|
p.onOffer = testUtilSetupPassive
|
|
|
|
|
return nil
|
|
|
|
@ -1133,7 +1508,7 @@ func TestRtcDTLS_ClientActive_ARQ_Certificate_ByDropped_ChangeCipherSpec(t *test
|
|
|
|
|
var r0, r1 error
|
|
|
|
|
err := func() error {
|
|
|
|
|
streamSuffix := fmt.Sprintf("dtls-active-arq-certificate-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
p, err := newTestPublisher(createApiForPublisher, func(p *testPublisher) error {
|
|
|
|
|
p, err := newTestPublisher(registerDefaultCodecs, func(p *testPublisher) error {
|
|
|
|
|
p.streamSuffix = streamSuffix
|
|
|
|
|
p.onOffer = testUtilSetupActive
|
|
|
|
|
return nil
|
|
|
|
@ -1219,7 +1594,7 @@ func TestRtcDTLS_ClientPassive_ARQ_Certificate_ByDropped_ChangeCipherSpec(t *tes
|
|
|
|
|
var r0, r1 error
|
|
|
|
|
err := func() error {
|
|
|
|
|
streamSuffix := fmt.Sprintf("dtls-passive-arq-certificate-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
p, err := newTestPublisher(createApiForPublisher, func(p *testPublisher) error {
|
|
|
|
|
p, err := newTestPublisher(registerDefaultCodecs, func(p *testPublisher) error {
|
|
|
|
|
p.streamSuffix = streamSuffix
|
|
|
|
|
p.onOffer = testUtilSetupPassive
|
|
|
|
|
return nil
|
|
|
|
@ -1296,7 +1671,7 @@ func TestRtcDTLS_ClientPassive_ARQ_Certificate_ByDropped_ChangeCipherSpec(t *tes
|
|
|
|
|
func TestRtcDTLS_ClientPassive_ARQ_DropAllAfter_ClientHello(t *testing.T) {
|
|
|
|
|
if err := filterTestError(func() error {
|
|
|
|
|
streamSuffix := fmt.Sprintf("dtls-passive-no-arq-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
p, err := newTestPublisher(createApiForPublisher, func(p *testPublisher) error {
|
|
|
|
|
p, err := newTestPublisher(registerDefaultCodecs, func(p *testPublisher) error {
|
|
|
|
|
p.streamSuffix = streamSuffix
|
|
|
|
|
p.onOffer = testUtilSetupPassive
|
|
|
|
|
return nil
|
|
|
|
@ -1349,7 +1724,7 @@ func TestRtcDTLS_ClientPassive_ARQ_DropAllAfter_ClientHello(t *testing.T) {
|
|
|
|
|
func TestRtcDTLS_ClientPassive_ARQ_DropAllAfter_ServerHello(t *testing.T) {
|
|
|
|
|
if err := filterTestError(func() error {
|
|
|
|
|
streamSuffix := fmt.Sprintf("dtls-passive-no-arq-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
p, err := newTestPublisher(createApiForPublisher, func(p *testPublisher) error {
|
|
|
|
|
p, err := newTestPublisher(registerDefaultCodecs, func(p *testPublisher) error {
|
|
|
|
|
p.streamSuffix = streamSuffix
|
|
|
|
|
p.onOffer = testUtilSetupPassive
|
|
|
|
|
return nil
|
|
|
|
@ -1402,7 +1777,7 @@ func TestRtcDTLS_ClientPassive_ARQ_DropAllAfter_ServerHello(t *testing.T) {
|
|
|
|
|
func TestRtcDTLS_ClientPassive_ARQ_DropAllAfter_Certificate(t *testing.T) {
|
|
|
|
|
if err := filterTestError(func() error {
|
|
|
|
|
streamSuffix := fmt.Sprintf("dtls-passive-no-arq-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
p, err := newTestPublisher(createApiForPublisher, func(p *testPublisher) error {
|
|
|
|
|
p, err := newTestPublisher(registerDefaultCodecs, func(p *testPublisher) error {
|
|
|
|
|
p.streamSuffix = streamSuffix
|
|
|
|
|
p.onOffer = testUtilSetupPassive
|
|
|
|
|
return nil
|
|
|
|
@ -1455,7 +1830,7 @@ func TestRtcDTLS_ClientPassive_ARQ_DropAllAfter_Certificate(t *testing.T) {
|
|
|
|
|
func TestRtcDTLS_ClientPassive_ARQ_DropAllAfter_ChangeCipherSpec(t *testing.T) {
|
|
|
|
|
if err := filterTestError(func() error {
|
|
|
|
|
streamSuffix := fmt.Sprintf("dtls-passive-no-arq-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
p, err := newTestPublisher(createApiForPublisher, func(p *testPublisher) error {
|
|
|
|
|
p, err := newTestPublisher(registerDefaultCodecs, func(p *testPublisher) error {
|
|
|
|
|
p.streamSuffix = streamSuffix
|
|
|
|
|
p.onOffer = testUtilSetupPassive
|
|
|
|
|
return nil
|
|
|
|
@ -1509,7 +1884,7 @@ func TestRtcDTLS_ClientPassive_ARQ_DropAllAfter_ChangeCipherSpec(t *testing.T) {
|
|
|
|
|
func TestRtcDTLS_ClientPassive_ARQ_VeryBadNetwork(t *testing.T) {
|
|
|
|
|
if err := filterTestError(func() error {
|
|
|
|
|
streamSuffix := fmt.Sprintf("dtls-passive-no-arq-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
p, err := newTestPublisher(createApiForPublisher, func(p *testPublisher) error {
|
|
|
|
|
p, err := newTestPublisher(registerDefaultCodecs, func(p *testPublisher) error {
|
|
|
|
|
p.streamSuffix = streamSuffix
|
|
|
|
|
p.onOffer = testUtilSetupPassive
|
|
|
|
|
return nil
|
|
|
|
@ -1587,7 +1962,7 @@ func TestRtcDTLS_ClientPassive_ARQ_Certificate_After_ClientHello(t *testing.T) {
|
|
|
|
|
var r0 error
|
|
|
|
|
err := func() error {
|
|
|
|
|
streamSuffix := fmt.Sprintf("dtls-passive-no-arq-%v-%v", os.Getpid(), rand.Int())
|
|
|
|
|
p, err := newTestPublisher(createApiForPublisher, func(p *testPublisher) error {
|
|
|
|
|
p, err := newTestPublisher(registerDefaultCodecs, func(p *testPublisher) error {
|
|
|
|
|
p.streamSuffix = streamSuffix
|
|
|
|
|
p.onOffer = testUtilSetupPassive
|
|
|
|
|
return nil
|
|
|
|
|