1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

TEST: Upgrade pion to v3.2.9. (#3567)

------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
This commit is contained in:
Winlin 2023-06-05 11:25:04 +08:00 committed by winlin
parent 900c4cdd97
commit 1545425e06
1383 changed files with 118469 additions and 41421 deletions

View file

@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2021 Winlin
// # Copyright (c) 2021 Winlin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in

View file

@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2021 Winlin
// # Copyright (c) 2021 Winlin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in

View file

@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2021 Winlin
// # Copyright (c) 2021 Winlin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
@ -28,6 +28,14 @@ import (
type rtpInterceptorOptionFunc func(i *rtpInterceptor)
type rtpInteceptorFactory struct {
p *rtpInterceptor
}
func (v *rtpInteceptorFactory) NewInterceptor(id string) (interceptor.Interceptor, error) {
return v.p, nil
}
// Common RTP packet interceptor for benchmark.
// @remark Should never merge with rtcpInterceptor, because they has the same Write interface.
type rtpInterceptor struct {
@ -41,12 +49,12 @@ type rtpInterceptor struct {
bypassInterceptor
}
func newRTPInterceptor(options ...rtpInterceptorOptionFunc) *rtpInterceptor {
func newRTPInterceptor(options ...rtpInterceptorOptionFunc) *rtpInteceptorFactory {
v := &rtpInterceptor{}
for _, opt := range options {
opt(v)
}
return v
return &rtpInteceptorFactory{v}
}
func (v *rtpInterceptor) BindLocalStream(info *interceptor.StreamInfo, writer interceptor.RTPWriter) interceptor.RTPWriter {
@ -81,6 +89,14 @@ func (v *rtpInterceptor) UnbindRemoteStream(info *interceptor.StreamInfo) {
type rtcpInterceptorOptionFunc func(i *rtcpInterceptor)
type rtcpInteceptorFactory struct {
p *rtcpInterceptor
}
func (v *rtcpInteceptorFactory) NewInterceptor(id string) (interceptor.Interceptor, error) {
return v.p, nil
}
// Common RTCP packet interceptor for benchmark.
// @remark Should never merge with rtpInterceptor, because they has the same Write interface.
type rtcpInterceptor struct {
@ -94,12 +110,12 @@ type rtcpInterceptor struct {
bypassInterceptor
}
func newRTCPInterceptor(options ...rtcpInterceptorOptionFunc) *rtcpInterceptor {
func newRTCPInterceptor(options ...rtcpInterceptorOptionFunc) *rtcpInteceptorFactory {
v := &rtcpInterceptor{}
for _, opt := range options {
opt(v)
}
return v
return &rtcpInteceptorFactory{v}
}
func (v *rtcpInterceptor) BindRTCPReader(reader interceptor.RTCPReader) interceptor.RTCPReader {

View file

@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2021 Winlin
// # Copyright (c) 2021 Winlin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in

View file

@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2021 Winlin
// # Copyright (c) 2021 Winlin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in

View file

@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2021 Winlin
// # Copyright (c) 2021 Winlin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
@ -97,11 +97,11 @@ func startPublish(ctx context.Context, r, sourceAudio, sourceVideo string, fps i
if sourceAudio != "" {
aIngester = newAudioIngester(sourceAudio)
registry.Add(aIngester.audioLevelInterceptor)
registry.Add(&rtpInteceptorFactory{aIngester.audioLevelInterceptor})
}
if sourceVideo != "" {
vIngester = newVideoIngester(sourceVideo)
registry.Add(vIngester.markerInterceptor)
registry.Add(&rtpInteceptorFactory{vIngester.markerInterceptor})
}
api := webrtc.NewAPI(webrtc.WithMediaEngine(m), webrtc.WithInterceptorRegistry(registry))

View file

@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2021 Winlin
// # Copyright (c) 2021 Winlin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
@ -44,7 +44,7 @@ import (
"github.com/pion/interceptor"
"github.com/pion/logging"
"github.com/pion/rtcp"
"github.com/pion/transport/vnet"
"github.com/pion/transport/v2/vnet"
"github.com/pion/webrtc/v3"
"github.com/pion/webrtc/v3/pkg/media/h264reader"
)
@ -636,9 +636,12 @@ func (v *testWebRTCAPI) Setup(vnetClientIP string, options ...testWebRTCAPIOptio
// Each api should bind to a network, however, it's possible to share it
// for different apis.
v.network = vnet.NewNet(&vnet.NetConfig{
v.network, err = vnet.NewNet(&vnet.NetConfig{
StaticIP: vnetClientIP,
})
if err != nil {
return errors.Wrapf(err, "create network for api")
}
if err = v.router.AddNet(v.network); err != nil {
return errors.Wrapf(err, "create network for api")
@ -892,14 +895,14 @@ func newTestPublisher(options ...testPublisherOptionFunc) (*testPublisher, error
rtcpInterceptor.rtcpWriter = func(pkts []rtcp.Packet, attributes interceptor.Attributes) (int, error) {
return rtcpInterceptor.nextRTCPWriter.Write(pkts, attributes)
}
api.registry.Add(rtcpInterceptor)
api.registry.Add(&rtcpInteceptorFactory{rtcpInterceptor})
// Filter for ingesters.
if sourceAudio != "" {
api.registry.Add(v.aIngester.audioLevelInterceptor)
api.registry.Add(&rtpInteceptorFactory{v.aIngester.audioLevelInterceptor})
}
if sourceVideo != "" {
api.registry.Add(v.vIngester.markerInterceptor)
api.registry.Add(&rtpInteceptorFactory{v.vIngester.markerInterceptor})
}
})

View file

@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2021 Winlin
// # Copyright (c) 2021 Winlin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in