From 81376b2ca85434825c45a2d9704fcc330aa2b261 Mon Sep 17 00:00:00 2001 From: cnderrauber Date: Fri, 30 Sep 2022 14:07:41 +0800 Subject: [PATCH 01/23] Fix generated Mid conflict with user set Mid Inside one cycle renegotiation, if user both has manually set Mid and auto generated Mid for transceivers, CreateOffer will failed for Mid conflict. --- peerconnection.go | 8 +++++- peerconnection_renegotiation_test.go | 41 ++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/peerconnection.go b/peerconnection.go index 6f9e77d37f8..668b86a146b 100644 --- a/peerconnection.go +++ b/peerconnection.go @@ -659,7 +659,13 @@ func (pc *PeerConnection) CreateOffer(options *OfferOptions) (SessionDescription } } for _, t := range currentTransceivers { - if t.Mid() != "" { + if mid := t.Mid(); mid != "" { + numericMid, errMid := strconv.Atoi(mid) + if errMid == nil { + if numericMid > pc.greaterMid { + pc.greaterMid = numericMid + } + } continue } pc.greaterMid++ diff --git a/peerconnection_renegotiation_test.go b/peerconnection_renegotiation_test.go index ef7e0e3aa00..e5382ff0c94 100644 --- a/peerconnection_renegotiation_test.go +++ b/peerconnection_renegotiation_test.go @@ -1192,3 +1192,44 @@ func TestPeerConnection_Regegotiation_ReuseTransceiver(t *testing.T) { closePairNow(t, pcOffer, pcAnswer) } + +func TestPeerConnection_Renegotiation_MidConflict(t *testing.T) { + lim := test.TimeOut(time.Second * 30) + defer lim.Stop() + + report := test.CheckRoutines(t) + defer report() + + offerPC, err := NewPeerConnection(Configuration{}) + assert.NoError(t, err) + answerPC, err := NewPeerConnection(Configuration{}) + assert.NoError(t, err) + _, err = offerPC.CreateDataChannel("test", nil) + assert.NoError(t, err) + + _, err = offerPC.AddTransceiverFromKind(RTPCodecTypeVideo, RtpTransceiverInit{Direction: RTPTransceiverDirectionSendonly}) + assert.NoError(t, err) + _, err = offerPC.AddTransceiverFromKind(RTPCodecTypeAudio, RtpTransceiverInit{Direction: RTPTransceiverDirectionSendonly}) + assert.NoError(t, err) + + offer, err := offerPC.CreateOffer(nil) + assert.NoError(t, err) + assert.NoError(t, offerPC.SetLocalDescription(offer)) + assert.NoError(t, answerPC.SetRemoteDescription(offer), offer.SDP) + answer, err := answerPC.CreateAnswer(nil) + assert.NoError(t, err) + assert.NoError(t, answerPC.SetLocalDescription(answer)) + assert.NoError(t, offerPC.SetRemoteDescription(answer)) + assert.Equal(t, SignalingStateStable, offerPC.SignalingState()) + + tr, err := offerPC.AddTransceiverFromKind(RTPCodecTypeVideo, RtpTransceiverInit{Direction: RTPTransceiverDirectionSendonly}) + assert.NoError(t, err) + assert.NoError(t, tr.SetMid("3")) + _, err = offerPC.AddTransceiverFromKind(RTPCodecTypeVideo, RtpTransceiverInit{Direction: RTPTransceiverDirectionSendrecv}) + assert.NoError(t, err) + _, err = offerPC.CreateOffer(nil) + assert.NoError(t, err) + + assert.NoError(t, offerPC.Close()) + assert.NoError(t, answerPC.Close()) +} From 9509f736becb0abcd1ecac06fdb3aa49e87865df Mon Sep 17 00:00:00 2001 From: Yoon SeungYong Date: Thu, 29 Sep 2022 16:25:19 +0900 Subject: [PATCH 02/23] Fix panics in ICEGatherer when it's already closed ICEGatherer throws panics in GetLocalCandidates(), GetLocalParameters() when it is already closed. Fix them. Resolves pion#2261 --- icegatherer.go | 22 +++++++++++++----- icegatherer_test.go | 55 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 6 deletions(-) diff --git a/icegatherer.go b/icegatherer.go index 5e94368a939..ab7e76db98d 100644 --- a/icegatherer.go +++ b/icegatherer.go @@ -142,10 +142,7 @@ func (g *ICEGatherer) Gather() error { return err } - g.lock.Lock() - agent := g.agent - g.lock.Unlock() - + agent := g.getAgent() // it is possible agent had just been closed if agent == nil { return fmt.Errorf("%w: unable to gather", errICEAgentNotExist) @@ -205,7 +202,13 @@ func (g *ICEGatherer) GetLocalParameters() (ICEParameters, error) { return ICEParameters{}, err } - frag, pwd, err := g.agent.GetLocalUserCredentials() + agent := g.getAgent() + // it is possible agent had just been closed + if agent == nil { + return ICEParameters{}, fmt.Errorf("%w: unable to get local parameters", errICEAgentNotExist) + } + + frag, pwd, err := agent.GetLocalUserCredentials() if err != nil { return ICEParameters{}, err } @@ -222,7 +225,14 @@ func (g *ICEGatherer) GetLocalCandidates() ([]ICECandidate, error) { if err := g.createAgent(); err != nil { return nil, err } - iceCandidates, err := g.agent.GetLocalCandidates() + + agent := g.getAgent() + // it is possible agent had just been closed + if agent == nil { + return nil, fmt.Errorf("%w: unable to get local candidates", errICEAgentNotExist) + } + + iceCandidates, err := agent.GetLocalCandidates() if err != nil { return nil, err } diff --git a/icegatherer_test.go b/icegatherer_test.go index 9e37a59da6c..280f1a4c980 100644 --- a/icegatherer_test.go +++ b/icegatherer_test.go @@ -98,3 +98,58 @@ func TestICEGather_mDNSCandidateGathering(t *testing.T) { <-gotMulticastDNSCandidate.Done() assert.NoError(t, gatherer.Close()) } + +func TestICEGatherer_AlreadyClosed(t *testing.T) { + // Limit runtime in case of deadlocks + lim := test.TimeOut(time.Second * 20) + defer lim.Stop() + + report := test.CheckRoutines(t) + defer report() + + opts := ICEGatherOptions{ + ICEServers: []ICEServer{{URLs: []string{"stun:stun.l.google.com:19302"}}}, + } + + t.Run("Gather", func(t *testing.T) { + gatherer, err := NewAPI().NewICEGatherer(opts) + assert.NoError(t, err) + + err = gatherer.createAgent() + assert.NoError(t, err) + + err = gatherer.Close() + assert.NoError(t, err) + + err = gatherer.Gather() + assert.ErrorIs(t, err, errICEAgentNotExist) + }) + + t.Run("GetLocalParameters", func(t *testing.T) { + gatherer, err := NewAPI().NewICEGatherer(opts) + assert.NoError(t, err) + + err = gatherer.createAgent() + assert.NoError(t, err) + + err = gatherer.Close() + assert.NoError(t, err) + + _, err = gatherer.GetLocalParameters() + assert.ErrorIs(t, err, errICEAgentNotExist) + }) + + t.Run("GetLocalCandidates", func(t *testing.T) { + gatherer, err := NewAPI().NewICEGatherer(opts) + assert.NoError(t, err) + + err = gatherer.createAgent() + assert.NoError(t, err) + + err = gatherer.Close() + assert.NoError(t, err) + + _, err = gatherer.GetLocalCandidates() + assert.ErrorIs(t, err, errICEAgentNotExist) + }) +} From 5c13a6ecd6ff37c7958a059d1850baa96356af17 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 2 Oct 2022 08:28:09 +0000 Subject: [PATCH 03/23] Update golang.org/x/net digest to bcab684 Generated by renovateBot --- AUTHORS.txt | 1 + go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index f73f8863000..fcd8b1faa1a 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -177,6 +177,7 @@ Will Forcey Will Watson Woodrow Douglass xsbchen +Yoon SeungYong Yuki Igarashi yusuke Yutaka Takeda diff --git a/go.mod b/go.mod index f1bd091a189..b1e933b74a1 100644 --- a/go.mod +++ b/go.mod @@ -20,6 +20,6 @@ require ( github.com/sclevine/agouti v3.0.0+incompatible github.com/stretchr/testify v1.7.1 golang.org/x/crypto v0.0.0-20220926161630-eccd6366d1be // indirect - golang.org/x/net v0.0.0-20220927171203-f486391704dc + golang.org/x/net v0.0.0-20221002022538-bcab6841153b golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec // indirect ) diff --git a/go.sum b/go.sum index fc7a89f31da..27e7eddc41d 100644 --- a/go.sum +++ b/go.sum @@ -108,8 +108,8 @@ golang.org/x/net v0.0.0-20211201190559-0a0e4e1bb54c/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220531201128-c960675eff93/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.0.0-20220927171203-f486391704dc h1:FxpXZdoBqT8RjqTy6i1E8nXHhW21wK7ptQ/EPIGxzPQ= -golang.org/x/net v0.0.0-20220927171203-f486391704dc/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.0.0-20221002022538-bcab6841153b h1:6e93nYa3hNqAvLr0pD4PN1fFS+gKzp2zAXqrnTCstqU= +golang.org/x/net v0.0.0-20221002022538-bcab6841153b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From 9030083fa582b13dfca2e7cceba8c8237fe06659 Mon Sep 17 00:00:00 2001 From: cnderrauber Date: Tue, 11 Oct 2022 16:38:10 +0800 Subject: [PATCH 04/23] Update pion/ice for UDPMux Update pion/ice for UDPMux, also update example --- examples/ice-single-port/main.go | 21 ++++++++------------- go.mod | 8 ++++---- go.sum | 16 ++++++++-------- icemux.go | 4 ++-- 4 files changed, 22 insertions(+), 27 deletions(-) diff --git a/examples/ice-single-port/main.go b/examples/ice-single-port/main.go index 21f8e50a775..4de48c6900e 100644 --- a/examples/ice-single-port/main.go +++ b/examples/ice-single-port/main.go @@ -6,10 +6,10 @@ package main import ( "encoding/json" "fmt" - "net" "net/http" "time" + "github.com/pion/ice/v2" "github.com/pion/webrtc/v3" ) @@ -75,24 +75,19 @@ func doSignaling(w http.ResponseWriter, r *http.Request) { } func main() { - // Listen on UDP Port 8443, will be used for all WebRTC traffic - udpListener, err := net.ListenUDP("udp", &net.UDPAddr{ - IP: net.IP{0, 0, 0, 0}, - Port: 8443, - }) - if err != nil { - panic(err) - } - - fmt.Printf("Listening for WebRTC traffic at %s\n", udpListener.LocalAddr()) - // Create a SettingEngine, this allows non-standard WebRTC behavior settingEngine := webrtc.SettingEngine{} // Configure our SettingEngine to use our UDPMux. By default a PeerConnection has // no global state. The API+SettingEngine allows the user to share state between them. // In this case we are sharing our listening port across many. - settingEngine.SetICEUDPMux(webrtc.NewICEUDPMux(nil, udpListener)) + // Listen on UDP Port 8443, will be used for all WebRTC traffic + mux, err := ice.NewMultiUDPMuxFromPort(8443) + if err != nil { + panic(err) + } + fmt.Printf("Listening for WebRTC traffic at %d\n", 8443) + settingEngine.SetICEUDPMux(mux) // Create a new API using our SettingEngine api = webrtc.NewAPI(webrtc.WithSettingEngine(settingEngine)) diff --git a/go.mod b/go.mod index b1e933b74a1..448534374f1 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/onsi/gomega v1.17.0 // indirect github.com/pion/datachannel v1.5.2 github.com/pion/dtls/v2 v2.1.5 - github.com/pion/ice/v2 v2.2.10 + github.com/pion/ice/v2 v2.2.11 github.com/pion/interceptor v0.1.11 github.com/pion/logging v0.2.2 github.com/pion/randutil v0.1.0 @@ -19,7 +19,7 @@ require ( github.com/pion/transport v0.13.1 github.com/sclevine/agouti v3.0.0+incompatible github.com/stretchr/testify v1.7.1 - golang.org/x/crypto v0.0.0-20220926161630-eccd6366d1be // indirect - golang.org/x/net v0.0.0-20221002022538-bcab6841153b - golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec // indirect + golang.org/x/crypto v0.0.0-20221010152910-d6f0a8c073c2 // indirect + golang.org/x/net v0.0.0-20221004154528-8021a29435af + golang.org/x/sys v0.0.0-20221010170243-090e33056c14 // indirect ) diff --git a/go.sum b/go.sum index 27e7eddc41d..4aaed5f7730 100644 --- a/go.sum +++ b/go.sum @@ -44,8 +44,8 @@ github.com/pion/datachannel v1.5.2 h1:piB93s8LGmbECrpO84DnkIVWasRMk3IimbcXkTQLE6 github.com/pion/datachannel v1.5.2/go.mod h1:FTGQWaHrdCwIJ1rw6xBIfZVkslikjShim5yr05XFuCQ= github.com/pion/dtls/v2 v2.1.5 h1:jlh2vtIyUBShchoTDqpCCqiYCyRFJ/lvf/gQ8TALs+c= github.com/pion/dtls/v2 v2.1.5/go.mod h1:BqCE7xPZbPSubGasRoDFJeTsyJtdD1FanJYL0JGheqY= -github.com/pion/ice/v2 v2.2.10 h1:i8rn0iIN8wHlS9wosoHS3Du4hYwx+TjBEluisXYtQVE= -github.com/pion/ice/v2 v2.2.10/go.mod h1:J6HhupoMLTOv0yALipuOHEPoSMk7dm1ofwUI1KHVHk8= +github.com/pion/ice/v2 v2.2.11 h1:wiAy7TSrVZ4KdyjC0CcNTkwltz9ywetbe4wbHLKUbIg= +github.com/pion/ice/v2 v2.2.11/go.mod h1:NqUDUao6SjSs1+4jrqpexDmFlptlVhGxQjcymXLaVvE= github.com/pion/interceptor v0.1.11 h1:00U6OlqxA3FFB50HSg25J/8cWi7P6FbSzw4eFn24Bvs= github.com/pion/interceptor v0.1.11/go.mod h1:tbtKjZY14awXd7Bq0mmWvgtHB5MDaRN7HV3OZ/uy7s8= github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY= @@ -92,8 +92,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220926161630-eccd6366d1be h1:fmw3UbQh+nxngCAHrDCCztao/kbYFnWjoqop8dHx05A= -golang.org/x/crypto v0.0.0-20220926161630-eccd6366d1be/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20221010152910-d6f0a8c073c2 h1:x8vtB3zMecnlqZIwJNUUpwYKYSqCz5jXbiyv0ZJJZeI= +golang.org/x/crypto v0.0.0-20221010152910-d6f0a8c073c2/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -107,9 +107,9 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211201190559-0a0e4e1bb54c/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220531201128-c960675eff93/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.0.0-20221002022538-bcab6841153b h1:6e93nYa3hNqAvLr0pD4PN1fFS+gKzp2zAXqrnTCstqU= golang.org/x/net v0.0.0-20221002022538-bcab6841153b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.0.0-20221004154528-8021a29435af h1:wv66FM3rLZGPdxpYL+ApnDe2HzHcTFta3z5nsc13wI4= +golang.org/x/net v0.0.0-20221004154528-8021a29435af/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -130,8 +130,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220608164250-635b8c9b7f68/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec h1:BkDtF2Ih9xZ7le9ndzTA7KJow28VbQW3odyk/8drmuI= -golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20221010170243-090e33056c14 h1:k5II8e6QD8mITdi+okbbmR/cIyEbeXLBhy5Ha4nevyc= +golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/icemux.go b/icemux.go index 5d8f49dd351..8291a6c8b98 100644 --- a/icemux.go +++ b/icemux.go @@ -18,8 +18,8 @@ func NewICETCPMux(logger logging.LeveledLogger, listener net.Listener, readBuffe } // NewICEUDPMux creates a new instance of ice.UDPMuxDefault. It allows many PeerConnections to be served -// by a single UDP Port. net.UDPConn satisfies ice.UDPMuxConn, can be passed in directly. -func NewICEUDPMux(logger logging.LeveledLogger, udpConn ice.UDPMuxConn) ice.UDPMux { +// by a single UDP Port. +func NewICEUDPMux(logger logging.LeveledLogger, udpConn net.PacketConn) ice.UDPMux { return ice.NewUDPMuxDefault(ice.UDPMuxParams{ UDPConn: udpConn, Logger: logger, From 42dc0d47883bb32266325502f3e052ff9afb3f78 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 16 Oct 2022 21:54:24 +0000 Subject: [PATCH 05/23] Update module github.com/pion/sctp to v1.8.3 Generated by renovateBot --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 448534374f1..0079d6a9e4e 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/pion/randutil v0.1.0 github.com/pion/rtcp v1.2.10 github.com/pion/rtp v1.7.13 - github.com/pion/sctp v1.8.2 + github.com/pion/sctp v1.8.3 github.com/pion/sdp/v3 v3.0.6 github.com/pion/srtp/v2 v2.0.10 github.com/pion/transport v0.13.1 diff --git a/go.sum b/go.sum index 4aaed5f7730..3f705602e90 100644 --- a/go.sum +++ b/go.sum @@ -60,8 +60,8 @@ github.com/pion/rtcp v1.2.10/go.mod h1:ztfEwXZNLGyF1oQDttz/ZKIBaeeg/oWbRYqzBM9TL github.com/pion/rtp v1.7.13 h1:qcHwlmtiI50t1XivvoawdCGTP4Uiypzfrsap+bijcoA= github.com/pion/rtp v1.7.13/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko= github.com/pion/sctp v1.8.0/go.mod h1:xFe9cLMZ5Vj6eOzpyiKjT9SwGM4KpK/8Jbw5//jc+0s= -github.com/pion/sctp v1.8.2 h1:yBBCIrUMJ4yFICL3RIvR4eh/H2BTTvlligmSTy+3kiA= -github.com/pion/sctp v1.8.2/go.mod h1:xFe9cLMZ5Vj6eOzpyiKjT9SwGM4KpK/8Jbw5//jc+0s= +github.com/pion/sctp v1.8.3 h1:LWcciN2ptLkw9Ugp/Ks2E76fiWy7yk3Wm79D6oFbFNo= +github.com/pion/sctp v1.8.3/go.mod h1:OHbDjdk7kg+L+7TJim9q/qGVefdEJohuA2SZyihccgI= github.com/pion/sdp/v3 v3.0.6 h1:WuDLhtuFUUVpTfus9ILC4HRyHsW6TdugjEX/QY9OiUw= github.com/pion/sdp/v3 v3.0.6/go.mod h1:iiFWFpQO8Fy3S5ldclBkpXqmWy02ns78NOKoLLL0YQw= github.com/pion/srtp/v2 v2.0.10 h1:b8ZvEuI+mrL8hbr/f1YiJFB34UMrOac3R3N1yq2UN0w= From e66501e35948296e4b4d9b7ba202fbd78975ce02 Mon Sep 17 00:00:00 2001 From: Pion <59523206+pionbot@users.noreply.github.com> Date: Thu, 20 Oct 2022 16:38:44 +0000 Subject: [PATCH 06/23] Update CI configs to v0.8.0 Update lint scripts and CI configs. --- .github/workflows/release.yml | 25 +++++++++++++++++++++++++ .github/workflows/test.yaml | 6 +++--- .github/workflows/tidy-check.yaml | 2 ++ .goreleaser.yml | 2 ++ renovate.json | 25 ++----------------------- 5 files changed, 34 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000000..b5b64e019bd --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,25 @@ +name: release +on: + push: + tags: + - 'v*' + +jobs: + release: + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-go@v3 + with: + go-version: '1.18' # auto-update/latest-go-version + - name: Build and release + uses: goreleaser/goreleaser-action@v3 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 300fac6a2a0..93d0406ac0f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -26,7 +26,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go: ["1.17", "1.18"] + go: ["1.17", "1.18"] # auto-update/supported-go-version-list fail-fast: false name: Go ${{ matrix.go }} steps: @@ -89,7 +89,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go: ["1.17", "1.18"] + go: ["1.17", "1.18"] # auto-update/supported-go-version-list fail-fast: false name: Go i386 ${{ matrix.go }} steps: @@ -145,7 +145,7 @@ jobs: - name: Download Go run: curl -sSfL https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz | tar -C ~ -xzf - env: - GO_VERSION: 1.17 + GO_VERSION: 1.17 # auto-update/latest-go-version - name: Set Go Root run: echo "GOROOT=${HOME}/go" >> $GITHUB_ENV diff --git a/.github/workflows/tidy-check.yaml b/.github/workflows/tidy-check.yaml index fa52ce94373..ff2ef50dbda 100644 --- a/.github/workflows/tidy-check.yaml +++ b/.github/workflows/tidy-check.yaml @@ -29,6 +29,8 @@ jobs: uses: actions/checkout@v3 - name: Setup Go uses: actions/setup-go@v3 + with: + go-version: 1.17 # auto-update/latest-go-version - name: check run: | go mod download diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 00000000000..2caa5fbd3b5 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,2 @@ +builds: +- skip: true diff --git a/renovate.json b/renovate.json index f1614058a70..f1bb98c6ad0 100644 --- a/renovate.json +++ b/renovate.json @@ -1,27 +1,6 @@ { + "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": [ - "config:base", - ":disableDependencyDashboard" - ], - "postUpdateOptions": [ - "gomodTidy" - ], - "commitBody": "Generated by renovateBot", - "packageRules": [ - { - "matchUpdateTypes": ["minor", "patch", "pin", "digest"], - "automerge": true - }, - { - "packagePatterns": ["^golang.org/x/"], - "schedule": ["on the first day of the month"] - } - ], - "ignorePaths": [ - ".github/workflows/generate-authors.yml", - ".github/workflows/lint.yaml", - ".github/workflows/renovate-go-mod-fix.yaml", - ".github/workflows/test.yaml", - ".github/workflows/tidy-check.yaml" + "github>pion/renovate-config" ] } From 9c47fea3f2514dc6021323e66e628a3b99f6911e Mon Sep 17 00:00:00 2001 From: Sean DuBois Date: Mon, 24 Oct 2022 22:30:18 -0400 Subject: [PATCH 07/23] Remove `new RTCSessionDescription` pattern SetRemoteDescription accepts a RTCSessionDescriptionInit so this is no longer needed Resolves #2324 --- AUTHORS.txt | 1 + e2e/e2e_test.go | 4 ++-- examples/broadcast/README.md | 2 +- examples/broadcast/jsfiddle/demo.js | 2 +- examples/data-channels/README.md | 2 +- examples/data-channels/jsfiddle/demo.js | 2 +- examples/insertable-streams/README.md | 2 +- examples/insertable-streams/jsfiddle/demo.js | 2 +- examples/play-from-disk/README.md | 2 +- examples/play-from-disk/jsfiddle/demo.js | 2 +- examples/reflect/README.md | 2 +- examples/reflect/jsfiddle/demo.js | 2 +- examples/rtcp-processing/README.md | 2 +- examples/rtcp-processing/jsfiddle/demo.js | 2 +- examples/rtp-forwarder/README.md | 2 +- examples/rtp-forwarder/jsfiddle/demo.js | 2 +- examples/save-to-disk/README.md | 2 +- examples/save-to-disk/jsfiddle/demo.js | 2 +- examples/simulcast/README.md | 2 +- examples/simulcast/jsfiddle/demo.js | 2 +- examples/swap-tracks/README.md | 2 +- examples/swap-tracks/jsfiddle/demo.js | 2 +- 22 files changed, 23 insertions(+), 22 deletions(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index fcd8b1faa1a..4e39c49571d 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -150,6 +150,7 @@ ronan Ryan Shumate salmān aljammāz Sam Lancia +Sean DuBois Sean DuBois Sean DuBois Sean DuBois diff --git a/e2e/e2e_test.go b/e2e/e2e_test.go index 8cc51278ad1..c19fe39e068 100644 --- a/e2e/e2e_test.go +++ b/e2e/e2e_test.go @@ -91,7 +91,7 @@ func TestE2E_Audio(t *testing.T) { } var result string if err := page.RunScript( - "pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(answer)))", + "pc.setRemoteDescription(JSON.parse(answer))", map[string]interface{}{"answer": string(answerBytes)}, &result, ); err != nil { @@ -231,7 +231,7 @@ func TestE2E_DataChannel(t *testing.T) { } var result string if err := page.RunScript( - "pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(answer)))", + "pc.setRemoteDescription(JSON.parse(answer))", map[string]interface{}{"answer": string(answerBytes)}, &result, ); err != nil { diff --git a/examples/broadcast/README.md b/examples/broadcast/README.md index 07fe41e2be3..8fc5dd8362c 100644 --- a/examples/broadcast/README.md +++ b/examples/broadcast/README.md @@ -11,7 +11,7 @@ go get github.com/pion/webrtc/v3/examples/broadcast ``` ### Open broadcast example page -[jsfiddle.net](https://jsfiddle.net/ypcsbnu3/) You should see two buttons `Publish a Broadcast` and `Join a Broadcast` +[jsfiddle.net](https://jsfiddle.net/us4h58jx/) You should see two buttons `Publish a Broadcast` and `Join a Broadcast` ### Run Broadcast #### Linux/macOS diff --git a/examples/broadcast/jsfiddle/demo.js b/examples/broadcast/jsfiddle/demo.js index 946a5551ab7..49734bbc3c5 100644 --- a/examples/broadcast/jsfiddle/demo.js +++ b/examples/broadcast/jsfiddle/demo.js @@ -48,7 +48,7 @@ window.createSession = isPublisher => { } try { - pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(atob(sd)))) + pc.setRemoteDescription(JSON.parse(atob(sd))) } catch (e) { alert(e) } diff --git a/examples/data-channels/README.md b/examples/data-channels/README.md index c9d9c45d351..49b9130b5cb 100644 --- a/examples/data-channels/README.md +++ b/examples/data-channels/README.md @@ -9,7 +9,7 @@ go get github.com/pion/webrtc/v3/examples/data-channels ``` ### Open data-channels example page -[jsfiddle.net](https://jsfiddle.net/t3johb5g/2/) +[jsfiddle.net](https://jsfiddle.net/e41tgovp/) ### Run data-channels, with your browsers SessionDescription as stdin In the jsfiddle the top textarea is your browser's session description, press `Copy browser SDP to clipboard` or copy the base64 string manually and: diff --git a/examples/data-channels/jsfiddle/demo.js b/examples/data-channels/jsfiddle/demo.js index c0e88a69522..5dc394dcb4e 100644 --- a/examples/data-channels/jsfiddle/demo.js +++ b/examples/data-channels/jsfiddle/demo.js @@ -42,7 +42,7 @@ window.startSession = () => { } try { - pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(atob(sd)))) + pc.setRemoteDescription(JSON.parse(atob(sd))) } catch (e) { alert(e) } diff --git a/examples/insertable-streams/README.md b/examples/insertable-streams/README.md index c4bf0795173..6f077f06aa0 100644 --- a/examples/insertable-streams/README.md +++ b/examples/insertable-streams/README.md @@ -19,7 +19,7 @@ go get github.com/pion/webrtc/v3/examples/insertable-streams ``` ### Open insertable-streams example page -[jsfiddle.net](https://jsfiddle.net/uqr80Lak/) you should see two text-areas and a 'Start Session' button. You will also have a 'Decrypt' checkbox. +[jsfiddle.net](https://jsfiddle.net/t5xoaryc/) you should see two text-areas and a 'Start Session' button. You will also have a 'Decrypt' checkbox. When unchecked the browser will not decrypt the incoming video stream, so it will stop playing or display certificates. ### Run insertable-streams with your browsers SessionDescription as stdin diff --git a/examples/insertable-streams/jsfiddle/demo.js b/examples/insertable-streams/jsfiddle/demo.js index ff2be92d135..9e9d5861558 100644 --- a/examples/insertable-streams/jsfiddle/demo.js +++ b/examples/insertable-streams/jsfiddle/demo.js @@ -60,7 +60,7 @@ window.startSession = () => { } try { - pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(atob(sd)))) + pc.setRemoteDescription(JSON.parse(atob(sd))) } catch (e) { alert(e) } diff --git a/examples/play-from-disk/README.md b/examples/play-from-disk/README.md index 15204ec9445..2dfe70e368f 100644 --- a/examples/play-from-disk/README.md +++ b/examples/play-from-disk/README.md @@ -20,7 +20,7 @@ go get github.com/pion/webrtc/v3/examples/play-from-disk ``` ### Open play-from-disk example page -[jsfiddle.net](https://jsfiddle.net/a1cz42op/) you should see two text-areas, 'Start Session' button and 'Copy browser SessionDescription to clipboard' +[jsfiddle.net](https://jsfiddle.net/8kup9mvn/) you should see two text-areas, 'Start Session' button and 'Copy browser SessionDescription to clipboard' ### Run play-from-disk with your browsers Session Description as stdin The `output.ivf` you created should be in the same directory as `play-from-disk`. In the jsfiddle press 'Copy browser Session Description to clipboard' or copy the base64 string manually. diff --git a/examples/play-from-disk/jsfiddle/demo.js b/examples/play-from-disk/jsfiddle/demo.js index f9afa945c9b..d3c3dd6360b 100644 --- a/examples/play-from-disk/jsfiddle/demo.js +++ b/examples/play-from-disk/jsfiddle/demo.js @@ -42,7 +42,7 @@ window.startSession = () => { } try { - pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(atob(sd)))) + pc.setRemoteDescription(JSON.parse(atob(sd))) } catch (e) { alert(e) } diff --git a/examples/reflect/README.md b/examples/reflect/README.md index 96e25a5aa9b..32a35faa0f4 100644 --- a/examples/reflect/README.md +++ b/examples/reflect/README.md @@ -9,7 +9,7 @@ go get github.com/pion/webrtc/v3/examples/reflect ``` ### Open reflect example page -[jsfiddle.net](https://jsfiddle.net/ogs7muqh/1/) you should see two text-areas and a 'Start Session' button. +[jsfiddle.net](https://jsfiddle.net/g643ft1k/) you should see two text-areas and a 'Start Session' button. ### Run reflect, with your browsers SessionDescription as stdin In the jsfiddle the top textarea is your browser's Session Description. Press `Copy browser SDP to clipboard` or copy the base64 string manually. diff --git a/examples/reflect/jsfiddle/demo.js b/examples/reflect/jsfiddle/demo.js index 7c1b68580a9..ced45c4ce62 100644 --- a/examples/reflect/jsfiddle/demo.js +++ b/examples/reflect/jsfiddle/demo.js @@ -39,7 +39,7 @@ window.startSession = () => { } try { - pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(atob(sd)))) + pc.setRemoteDescription(JSON.parse(atob(sd))) } catch (e) { alert(e) } diff --git a/examples/rtcp-processing/README.md b/examples/rtcp-processing/README.md index 775bcc41b8f..5ee354b7662 100644 --- a/examples/rtcp-processing/README.md +++ b/examples/rtcp-processing/README.md @@ -16,7 +16,7 @@ go get github.com/pion/webrtc/v3/examples/rtcp-processing ``` ### Open rtcp-processing example page -[jsfiddle.net](https://jsfiddle.net/Le3zg7sd/) you should see two text-areas, 'Start Session' button and 'Copy browser SessionDescription to clipboard' +[jsfiddle.net](https://jsfiddle.net/zurq6j7x/) you should see two text-areas, 'Start Session' button and 'Copy browser SessionDescription to clipboard' ### Run rtcp-processing with your browsers Session Description as stdin In the jsfiddle press 'Copy browser Session Description to clipboard' or copy the base64 string manually. diff --git a/examples/rtcp-processing/jsfiddle/demo.js b/examples/rtcp-processing/jsfiddle/demo.js index 41cd47c1434..6f788f65bae 100644 --- a/examples/rtcp-processing/jsfiddle/demo.js +++ b/examples/rtcp-processing/jsfiddle/demo.js @@ -40,7 +40,7 @@ window.startSession = () => { } try { - pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(atob(sd)))) + pc.setRemoteDescription(JSON.parse(atob(sd))) } catch (e) { alert(e) } diff --git a/examples/rtp-forwarder/README.md b/examples/rtp-forwarder/README.md index 27f59613e06..a2d59036d6d 100644 --- a/examples/rtp-forwarder/README.md +++ b/examples/rtp-forwarder/README.md @@ -9,7 +9,7 @@ go get github.com/pion/webrtc/v3/examples/rtp-forwarder ``` ### Open rtp-forwarder example page -[jsfiddle.net](https://jsfiddle.net/xjcve6d3/) you should see your Webcam, two text-areas and `Copy browser SDP to clipboard`, `Start Session` buttons +[jsfiddle.net](https://jsfiddle.net/fm7btvr3/) you should see your Webcam, two text-areas and `Copy browser SDP to clipboard`, `Start Session` buttons ### Run rtp-forwarder, with your browsers SessionDescription as stdin In the jsfiddle the top textarea is your browser's Session Description. Press `Copy browser SDP to clipboard` or copy the base64 string manually. diff --git a/examples/rtp-forwarder/jsfiddle/demo.js b/examples/rtp-forwarder/jsfiddle/demo.js index 1eba38b99d3..b7e8d925f54 100644 --- a/examples/rtp-forwarder/jsfiddle/demo.js +++ b/examples/rtp-forwarder/jsfiddle/demo.js @@ -32,7 +32,7 @@ window.startSession = () => { } try { - pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(atob(sd)))) + pc.setRemoteDescription(JSON.parse(atob(sd))) } catch (e) { alert(e) } diff --git a/examples/save-to-disk/README.md b/examples/save-to-disk/README.md index cf316e0053f..53ff188d846 100644 --- a/examples/save-to-disk/README.md +++ b/examples/save-to-disk/README.md @@ -11,7 +11,7 @@ go get github.com/pion/webrtc/v3/examples/save-to-disk ``` ### Open save-to-disk example page -[jsfiddle.net](https://jsfiddle.net/xjcve6d3/) you should see your Webcam, two text-areas and two buttons: `Copy browser SDP to clipboard`, `Start Session`. +[jsfiddle.net](https://jsfiddle.net/s179hacu/) you should see your Webcam, two text-areas and two buttons: `Copy browser SDP to clipboard`, `Start Session`. ### Run save-to-disk, with your browsers SessionDescription as stdin In the jsfiddle the top textarea is your browser's Session Description. Press `Copy browser SDP to clipboard` or copy the base64 string manually. diff --git a/examples/save-to-disk/jsfiddle/demo.js b/examples/save-to-disk/jsfiddle/demo.js index d3ee36d9f7d..64eb3d2ba4e 100644 --- a/examples/save-to-disk/jsfiddle/demo.js +++ b/examples/save-to-disk/jsfiddle/demo.js @@ -33,7 +33,7 @@ window.startSession = () => { } try { - pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(atob(sd)))) + pc.setRemoteDescription(JSON.parse(atob(sd))) } catch (e) { alert(e) } diff --git a/examples/simulcast/README.md b/examples/simulcast/README.md index 7d7ed4b41d4..5077f01002d 100644 --- a/examples/simulcast/README.md +++ b/examples/simulcast/README.md @@ -13,7 +13,7 @@ go get github.com/pion/webrtc/v3/examples/simulcast ``` ### Open simulcast example page -[jsfiddle.net](https://jsfiddle.net/zLebmv41/1/) you should see two text-areas and two buttons: `Copy browser SDP to clipboard`, `Start Session`. +[jsfiddle.net](https://jsfiddle.net/tz4d5bhj/) you should see two text-areas and two buttons: `Copy browser SDP to clipboard`, `Start Session`. ### Run simulcast, with your browsers SessionDescription as stdin In the jsfiddle the top textarea is your browser's Session Description. Press `Copy browser SDP to clipboard` or copy the base64 string manually. diff --git a/examples/simulcast/jsfiddle/demo.js b/examples/simulcast/jsfiddle/demo.js index cc0ebf3de89..b7fbc664925 100644 --- a/examples/simulcast/jsfiddle/demo.js +++ b/examples/simulcast/jsfiddle/demo.js @@ -85,7 +85,7 @@ window.startSession = () => { try { console.log('answer', JSON.parse(atob(sd))) - pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(atob(sd)))) + pc.setRemoteDescription(JSON.parse(atob(sd))) } catch (e) { alert(e) } diff --git a/examples/swap-tracks/README.md b/examples/swap-tracks/README.md index c278f8a7fb9..d5771592c40 100644 --- a/examples/swap-tracks/README.md +++ b/examples/swap-tracks/README.md @@ -9,7 +9,7 @@ go get github.com/pion/webrtc/v3/examples/swap-tracks ``` ### Open swap-tracks example page -[jsfiddle.net](https://jsfiddle.net/39w24tr6/1/) you should see two text-areas and two buttons: `Copy browser SDP to clipboard`, `Start Session`. +[jsfiddle.net](https://jsfiddle.net/1rx5on86/) you should see two text-areas and two buttons: `Copy browser SDP to clipboard`, `Start Session`. ### Run swap-tracks, with your browsers SessionDescription as stdin In the jsfiddle the top textarea is your browser's Session Description. Press `Copy browser SDP to clipboard` or copy the base64 string manually. diff --git a/examples/swap-tracks/jsfiddle/demo.js b/examples/swap-tracks/jsfiddle/demo.js index 7688b8ebf0d..52d3479e974 100644 --- a/examples/swap-tracks/jsfiddle/demo.js +++ b/examples/swap-tracks/jsfiddle/demo.js @@ -68,7 +68,7 @@ window.startSession = () => { } try { - pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(atob(sd)))) + pc.setRemoteDescription(JSON.parse(atob(sd))) } catch (e) { alert(e) } From c132bedfe9d49b7c35477be6974ae2b1919f1204 Mon Sep 17 00:00:00 2001 From: Eric Fontaine Date: Fri, 23 Sep 2022 19:31:09 -0400 Subject: [PATCH 08/23] Fix ice-single-port example README Number of connections are 10. --- examples/ice-single-port/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/ice-single-port/README.md b/examples/ice-single-port/README.md index 098d0a7f162..994d23756de 100644 --- a/examples/ice-single-port/README.md +++ b/examples/ice-single-port/README.md @@ -2,8 +2,8 @@ ice-single-port demonstrates Pion WebRTC's ability to serve many PeerConnections on a single port. Pion WebRTC has no global state, so by default ports can't be shared between two PeerConnections. -Using the SettingEngine a developer can manually share state between many PeerConnections and allow -multiple to use the same port +Using the SettingEngine, a developer can manually share state between many PeerConnections to allow +multiple PeerConnections to use the same port. ## Instructions @@ -21,8 +21,8 @@ cd webrtc/examples/ice-single-port Execute `go run *.go` ### Open the Web UI -Open [http://localhost:8080](http://localhost:8080). This will automatically open 5 PeerConnections. This page will print +Open [http://localhost:8080](http://localhost:8080). This will automatically open 10 PeerConnections. This page will print a Local/Remote line for each PeerConnection. Note that all 10 PeerConnections have different ports for their Local port. However for the remote they all will be using port 8443. -Congrats, you have used Pion WebRTC! Now start building something cool +Congrats, you have used Pion WebRTC! Now start building something cool. From 789623a7f745db6816625730ac61c17cfe4b3117 Mon Sep 17 00:00:00 2001 From: mr-shitij <21.shitijagrawal@gmail.com> Date: Sun, 2 Oct 2022 03:51:51 +0530 Subject: [PATCH 09/23] Update code to be more Go idiomatic No functional changes --- AUTHORS.txt | 1 + icegatherer_test.go | 4 ++-- pkg/media/h264reader/h264reader.go | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index 4e39c49571d..ecd32299fb8 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -117,6 +117,7 @@ Michiel De Backker <38858977+backkem@users.noreply.github.com> Mike Coleman Mindgamesnl mission-liao +mr-shitij <21.shitijagrawal@gmail.com> mxmCherry Nam V. Do Nick Mykins diff --git a/icegatherer_test.go b/icegatherer_test.go index 280f1a4c980..cdd1a9c3e45 100644 --- a/icegatherer_test.go +++ b/icegatherer_test.go @@ -53,8 +53,8 @@ func TestNewICEGatherer_Success(t *testing.T) { t.Error(err) } - if len(params.UsernameFragment) == 0 || - len(params.Password) == 0 { + if params.UsernameFragment == "" || + params.Password == "" { t.Fatalf("Empty local username or password frag") } diff --git a/pkg/media/h264reader/h264reader.go b/pkg/media/h264reader/h264reader.go index 7520a9b8cf0..d5e68f962a3 100644 --- a/pkg/media/h264reader/h264reader.go +++ b/pkg/media/h264reader/h264reader.go @@ -145,9 +145,8 @@ func (reader *H264Reader) NextNAL() (*NAL, error) { if nal.UnitType == NalUnitTypeSEI { reader.nalBuffer = nil continue - } else { - break } + break } reader.nalBuffer = append(reader.nalBuffer, readByte) From a7484214a7572ef0f74c59bd793f55fd1e7e52b3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 1 Nov 2022 04:10:10 +0000 Subject: [PATCH 10/23] Update module golang.org/x/net to v0.1.0 Generated by renovateBot --- AUTHORS.txt | 1 + go.mod | 3 +-- go.sum | 20 +++++++++++++++----- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index ecd32299fb8..05cbb3045c5 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -60,6 +60,7 @@ donotanswer earle Egon Elbre Eric Daniels +Eric Fontaine feixiao Forest Johnson frank diff --git a/go.mod b/go.mod index 0079d6a9e4e..c648bb480a6 100644 --- a/go.mod +++ b/go.mod @@ -20,6 +20,5 @@ require ( github.com/sclevine/agouti v3.0.0+incompatible github.com/stretchr/testify v1.7.1 golang.org/x/crypto v0.0.0-20221010152910-d6f0a8c073c2 // indirect - golang.org/x/net v0.0.0-20221004154528-8021a29435af - golang.org/x/sys v0.0.0-20221010170243-090e33056c14 // indirect + golang.org/x/net v0.1.0 ) diff --git a/go.sum b/go.sum index 3f705602e90..6989fe990b4 100644 --- a/go.sum +++ b/go.sum @@ -88,13 +88,16 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20221010152910-d6f0a8c073c2 h1:x8vtB3zMecnlqZIwJNUUpwYKYSqCz5jXbiyv0ZJJZeI= golang.org/x/crypto v0.0.0-20221010152910-d6f0a8c073c2/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -102,17 +105,20 @@ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201201195509-5d6afe98e0b7/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211201190559-0a0e4e1bb54c/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220531201128-c960675eff93/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20221002022538-bcab6841153b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.0.0-20221004154528-8021a29435af h1:wv66FM3rLZGPdxpYL+ApnDe2HzHcTFta3z5nsc13wI4= -golang.org/x/net v0.0.0-20221004154528-8021a29435af/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -129,19 +135,23 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220608164250-635b8c9b7f68/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20221010170243-090e33056c14 h1:k5II8e6QD8mITdi+okbbmR/cIyEbeXLBhy5Ha4nevyc= -golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 6b1e68413bcd1f575445ee4a5e22dd6566436d1d Mon Sep 17 00:00:00 2001 From: Mathis Engelbart Date: Sat, 23 Jul 2022 15:48:55 -0400 Subject: [PATCH 11/23] Fix pion-to-pion example in docker-compose Fixes the command line arguments to use correct addresses and uses go install instead of now unsupported go get. --- examples/pion-to-pion/answer/Dockerfile | 2 +- examples/pion-to-pion/docker-compose.yml | 4 +++- examples/pion-to-pion/offer/Dockerfile | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/pion-to-pion/answer/Dockerfile b/examples/pion-to-pion/answer/Dockerfile index 899ff7f8009..5897317578a 100644 --- a/examples/pion-to-pion/answer/Dockerfile +++ b/examples/pion-to-pion/answer/Dockerfile @@ -1,7 +1,7 @@ FROM golang:1.19 ENV GO111MODULE=on -RUN go get -u github.com/pion/webrtc/v3/examples/pion-to-pion/answer +RUN go install github.com/pion/webrtc/v3/examples/pion-to-pion/answer@latest CMD ["answer"] diff --git a/examples/pion-to-pion/docker-compose.yml b/examples/pion-to-pion/docker-compose.yml index f36eb003b13..f95fccff326 100644 --- a/examples/pion-to-pion/docker-compose.yml +++ b/examples/pion-to-pion/docker-compose.yml @@ -3,6 +3,7 @@ services: answer: container_name: answer build: ./answer + command: answer -offer-address offer:50000 hostname: answer restart: always ports: @@ -13,5 +14,6 @@ services: - answer container_name: offer build: ./offer + command: offer -answer-address answer:60000 hostname: offer - restart: always \ No newline at end of file + restart: always diff --git a/examples/pion-to-pion/offer/Dockerfile b/examples/pion-to-pion/offer/Dockerfile index f88ee6d02cb..a8f0f08e42a 100644 --- a/examples/pion-to-pion/offer/Dockerfile +++ b/examples/pion-to-pion/offer/Dockerfile @@ -1,6 +1,6 @@ FROM golang:1.19 ENV GO111MODULE=on -RUN go get -u github.com/pion/webrtc/v3/examples/pion-to-pion/offer +RUN go install github.com/pion/webrtc/v3/examples/pion-to-pion/offer@latest CMD ["offer"] From 257c9e592ecd7ebb438636debd68cdd507f56ba1 Mon Sep 17 00:00:00 2001 From: stephanrotolante Date: Tue, 1 Nov 2022 13:11:15 -0400 Subject: [PATCH 12/23] Moved duplicate operation to function No functional changes --- track_local_static.go | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/track_local_static.go b/track_local_static.go index 51e963d0c6d..5ca61dc35ff 100644 --- a/track_local_static.go +++ b/track_local_static.go @@ -128,18 +128,27 @@ var rtpPacketPool = sync.Pool{ }, } +func resetPacketPoolAllocation(localPacket *rtp.Packet) { + *localPacket = rtp.Packet{} + rtpPacketPool.Put(localPacket) +} + +func getPacketAllocationFromPool() *rtp.Packet { + ipacket := rtpPacketPool.Get() + return ipacket.(*rtp.Packet) //nolint:forcetypeassert +} + // WriteRTP writes a RTP Packet to the TrackLocalStaticRTP // If one PeerConnection fails the packets will still be sent to // all PeerConnections. The error message will contain the ID of the failed // PeerConnections so you can remove them func (s *TrackLocalStaticRTP) WriteRTP(p *rtp.Packet) error { - ipacket := rtpPacketPool.Get() - packet := ipacket.(*rtp.Packet) //nolint:forcetypeassert - defer func() { - *packet = rtp.Packet{} - rtpPacketPool.Put(ipacket) - }() + packet := getPacketAllocationFromPool() + + defer resetPacketPoolAllocation(packet) + *packet = *p + return s.writeRTP(packet) } @@ -166,12 +175,9 @@ func (s *TrackLocalStaticRTP) writeRTP(p *rtp.Packet) error { // all PeerConnections. The error message will contain the ID of the failed // PeerConnections so you can remove them func (s *TrackLocalStaticRTP) Write(b []byte) (n int, err error) { - ipacket := rtpPacketPool.Get() - packet := ipacket.(*rtp.Packet) //nolint:forcetypeassert - defer func() { - *packet = rtp.Packet{} - rtpPacketPool.Put(ipacket) - }() + packet := getPacketAllocationFromPool() + + defer resetPacketPoolAllocation(packet) if err = packet.Unmarshal(b); err != nil { return 0, err From 25624d63710dc28dc89e8c3063039d8e7e9e2933 Mon Sep 17 00:00:00 2001 From: Artur Shellunts Date: Wed, 2 Nov 2022 13:16:33 +0100 Subject: [PATCH 13/23] Simplify docker compose file of pion-to-pion Removed unnecessary properties from docker-compose file. hostname by default is equal to service name. Custom container_name and port mapping are also not needed for the example. --- AUTHORS.txt | 1 + examples/pion-to-pion/docker-compose.yml | 12 ++---------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index 05cbb3045c5..62c49503302 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -165,6 +165,7 @@ Simone Gotti Slugalisk soolaugust spaceCh1mp +stephanrotolante Suhas Gaddam Suzuki Takeo sylba2050 diff --git a/examples/pion-to-pion/docker-compose.yml b/examples/pion-to-pion/docker-compose.yml index f95fccff326..959ed8fdecf 100644 --- a/examples/pion-to-pion/docker-compose.yml +++ b/examples/pion-to-pion/docker-compose.yml @@ -1,19 +1,11 @@ version: '3' services: answer: - container_name: answer build: ./answer command: answer -offer-address offer:50000 - hostname: answer - restart: always - ports: - - 50000:50000 - + offer: - depends_on: + depends_on: - answer - container_name: offer build: ./offer command: offer -answer-address answer:60000 - hostname: offer - restart: always From 2e42dfdd4b152ece0463ba647cc6bf481d605c0b Mon Sep 17 00:00:00 2001 From: Artur Shellunts Date: Fri, 4 Nov 2022 16:21:11 +0100 Subject: [PATCH 14/23] Add test for pion-to-pion example Also add new GitHub Actions workflow to run tests for example apps --- .github/workflows/examples-tests.yaml | 19 +++++++++++++++++++ examples/pion-to-pion/docker-compose.yml | 2 ++ examples/pion-to-pion/test.sh | 14 ++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 .github/workflows/examples-tests.yaml create mode 100755 examples/pion-to-pion/test.sh diff --git a/.github/workflows/examples-tests.yaml b/.github/workflows/examples-tests.yaml new file mode 100644 index 00000000000..1791be42e49 --- /dev/null +++ b/.github/workflows/examples-tests.yaml @@ -0,0 +1,19 @@ +name: Examples Tests +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + pion-to-pion-test: + name: Test + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + - name: test + run: cd examples/pion-to-pion && ./test.sh + diff --git a/examples/pion-to-pion/docker-compose.yml b/examples/pion-to-pion/docker-compose.yml index 959ed8fdecf..fff78574fe0 100644 --- a/examples/pion-to-pion/docker-compose.yml +++ b/examples/pion-to-pion/docker-compose.yml @@ -1,10 +1,12 @@ version: '3' services: answer: + container_name: answer build: ./answer command: answer -offer-address offer:50000 offer: + container_name: offer depends_on: - answer build: ./offer diff --git a/examples/pion-to-pion/test.sh b/examples/pion-to-pion/test.sh new file mode 100755 index 00000000000..0ae41c3ddfb --- /dev/null +++ b/examples/pion-to-pion/test.sh @@ -0,0 +1,14 @@ +#!/bin/bash -eu + +docker compose up -d + +function on_exit { + docker compose logs + docker compose rm -fsv +} + +trap on_exit EXIT + +TIMEOUT=10 +timeout $TIMEOUT docker compose logs -f | grep -q "answer | Message from DataChannel" +timeout $TIMEOUT docker compose logs -f | grep -q "offer | Message from DataChannel" From 9713221231e09f584b76af406c82ba7ba320fbdb Mon Sep 17 00:00:00 2001 From: cnderrauber Date: Tue, 15 Nov 2022 10:26:01 +0800 Subject: [PATCH 15/23] Close unhandled stream when peerconnection closed When PeerConnection closed, need call unhandled stream's close method to release buffer created by BufferFactory, otherwise might cause resource leak if user provide BufferFactory need close to release the resource. --- peerconnection.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/peerconnection.go b/peerconnection.go index 668b86a146b..e3389f5fbb4 100644 --- a/peerconnection.go +++ b/peerconnection.go @@ -21,6 +21,7 @@ import ( "github.com/pion/logging" "github.com/pion/rtcp" "github.com/pion/sdp/v3" + "github.com/pion/srtp/v2" "github.com/pion/webrtc/v3/internal/util" "github.com/pion/webrtc/v3/pkg/rtcerr" ) @@ -1632,14 +1633,14 @@ func (pc *PeerConnection) undeclaredMediaProcessor() { if atomic.AddUint64(&simulcastRoutineCount, 1) >= simulcastMaxProbeRoutines { atomic.AddUint64(&simulcastRoutineCount, ^uint64(0)) pc.log.Warn(ErrSimulcastProbeOverflow.Error()) + pc.dtlsTransport.storeSimulcastStream(stream) continue } go func(rtpStream io.Reader, ssrc SSRC) { - pc.dtlsTransport.storeSimulcastStream(stream) - if err := pc.handleIncomingSSRC(rtpStream, ssrc); err != nil { pc.log.Errorf(incomingUnhandledRTPSsrc, ssrc, err) + pc.dtlsTransport.storeSimulcastStream(stream) } atomic.AddUint64(&simulcastRoutineCount, ^uint64(0)) }(stream, SSRC(ssrc)) @@ -1647,6 +1648,12 @@ func (pc *PeerConnection) undeclaredMediaProcessor() { }() go func() { + var unhandledStreams []*srtp.ReadStreamSRTCP + defer func() { + for _, s := range unhandledStreams { + s.Close() + } + }() for { srtcpSession, err := pc.dtlsTransport.getSRTCPSession() if err != nil { @@ -1654,12 +1661,13 @@ func (pc *PeerConnection) undeclaredMediaProcessor() { return } - _, ssrc, err := srtcpSession.AcceptStream() + stream, ssrc, err := srtcpSession.AcceptStream() if err != nil { pc.log.Warnf("Failed to accept RTCP %v", err) return } pc.log.Warnf("Incoming unhandled RTCP ssrc(%d), OnTrack will not be fired", ssrc) + unhandledStreams = append(unhandledStreams, stream) } }() } From fa6be2c31deda617e7765121ea23e55353a62485 Mon Sep 17 00:00:00 2001 From: cnderrauber Date: Tue, 15 Nov 2022 11:50:37 +0800 Subject: [PATCH 16/23] Fix lint error Fix lint error --- peerconnection.go | 105 ++++++++++++++++++++++++---------------------- 1 file changed, 54 insertions(+), 51 deletions(-) diff --git a/peerconnection.go b/peerconnection.go index e3389f5fbb4..900dae1a8af 100644 --- a/peerconnection.go +++ b/peerconnection.go @@ -1608,68 +1608,71 @@ func (pc *PeerConnection) handleIncomingSSRC(rtpStream io.Reader, ssrc SSRC) err // undeclaredMediaProcessor handles RTP/RTCP packets that don't match any a:ssrc lines func (pc *PeerConnection) undeclaredMediaProcessor() { - go func() { - var simulcastRoutineCount uint64 - for { - srtpSession, err := pc.dtlsTransport.getSRTPSession() - if err != nil { - pc.log.Warnf("undeclaredMediaProcessor failed to open SrtpSession: %v", err) - return - } + go pc.undeclaredRTPMediaProcessor() + go pc.undeclaredRTCPMediaProcessor() +} - stream, ssrc, err := srtpSession.AcceptStream() - if err != nil { - pc.log.Warnf("Failed to accept RTP %v", err) - return - } +func (pc *PeerConnection) undeclaredRTPMediaProcessor() { + var simulcastRoutineCount uint64 + for { + srtpSession, err := pc.dtlsTransport.getSRTPSession() + if err != nil { + pc.log.Warnf("undeclaredMediaProcessor failed to open SrtpSession: %v", err) + return + } - if pc.isClosed.get() { - if err = stream.Close(); err != nil { - pc.log.Warnf("Failed to close RTP stream %v", err) - } - continue - } + stream, ssrc, err := srtpSession.AcceptStream() + if err != nil { + pc.log.Warnf("Failed to accept RTP %v", err) + return + } - if atomic.AddUint64(&simulcastRoutineCount, 1) >= simulcastMaxProbeRoutines { - atomic.AddUint64(&simulcastRoutineCount, ^uint64(0)) - pc.log.Warn(ErrSimulcastProbeOverflow.Error()) - pc.dtlsTransport.storeSimulcastStream(stream) - continue + if pc.isClosed.get() { + if err = stream.Close(); err != nil { + pc.log.Warnf("Failed to close RTP stream %v", err) } + continue + } - go func(rtpStream io.Reader, ssrc SSRC) { - if err := pc.handleIncomingSSRC(rtpStream, ssrc); err != nil { - pc.log.Errorf(incomingUnhandledRTPSsrc, ssrc, err) - pc.dtlsTransport.storeSimulcastStream(stream) - } - atomic.AddUint64(&simulcastRoutineCount, ^uint64(0)) - }(stream, SSRC(ssrc)) + if atomic.AddUint64(&simulcastRoutineCount, 1) >= simulcastMaxProbeRoutines { + atomic.AddUint64(&simulcastRoutineCount, ^uint64(0)) + pc.log.Warn(ErrSimulcastProbeOverflow.Error()) + pc.dtlsTransport.storeSimulcastStream(stream) + continue } - }() - go func() { - var unhandledStreams []*srtp.ReadStreamSRTCP - defer func() { - for _, s := range unhandledStreams { - s.Close() - } - }() - for { - srtcpSession, err := pc.dtlsTransport.getSRTCPSession() - if err != nil { - pc.log.Warnf("undeclaredMediaProcessor failed to open SrtcpSession: %v", err) - return + go func(rtpStream io.Reader, ssrc SSRC) { + if err := pc.handleIncomingSSRC(rtpStream, ssrc); err != nil { + pc.log.Errorf(incomingUnhandledRTPSsrc, ssrc, err) + pc.dtlsTransport.storeSimulcastStream(stream) } + atomic.AddUint64(&simulcastRoutineCount, ^uint64(0)) + }(stream, SSRC(ssrc)) + } +} - stream, ssrc, err := srtcpSession.AcceptStream() - if err != nil { - pc.log.Warnf("Failed to accept RTCP %v", err) - return - } - pc.log.Warnf("Incoming unhandled RTCP ssrc(%d), OnTrack will not be fired", ssrc) - unhandledStreams = append(unhandledStreams, stream) +func (pc *PeerConnection) undeclaredRTCPMediaProcessor() { + var unhandledStreams []*srtp.ReadStreamSRTCP + defer func() { + for _, s := range unhandledStreams { + _ = s.Close() } }() + for { + srtcpSession, err := pc.dtlsTransport.getSRTCPSession() + if err != nil { + pc.log.Warnf("undeclaredMediaProcessor failed to open SrtcpSession: %v", err) + return + } + + stream, ssrc, err := srtcpSession.AcceptStream() + if err != nil { + pc.log.Warnf("Failed to accept RTCP %v", err) + return + } + pc.log.Warnf("Incoming unhandled RTCP ssrc(%d), OnTrack will not be fired", ssrc) + unhandledStreams = append(unhandledStreams, stream) + } } // RemoteDescription returns pendingRemoteDescription if it is not null and From 1365b0a96cc0df276330404a6338306c4ade797b Mon Sep 17 00:00:00 2001 From: Pion <59523206+pionbot@users.noreply.github.com> Date: Wed, 16 Nov 2022 12:02:13 +0000 Subject: [PATCH 17/23] Update CI configs to v0.8.1 Update lint scripts and CI configs. --- .github/generate-authors.sh | 23 +++++++-------- .github/install-hooks.sh | 6 ++-- .github/lint-commit-message.sh | 4 +-- .../lint-disallowed-functions-in-library.sh | 29 ++++++++----------- .github/lint-filename.sh | 8 ++--- ...int-no-trailing-newline-in-log-messages.sh | 24 +++++++-------- 6 files changed, 41 insertions(+), 53 deletions(-) diff --git a/.github/generate-authors.sh b/.github/generate-authors.sh index 182e4f5e738..6152721515f 100755 --- a/.github/generate-authors.sh +++ b/.github/generate-authors.sh @@ -12,10 +12,10 @@ set -e SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) -AUTHORS_PATH="$GITHUB_WORKSPACE/AUTHORS.txt" +GIT_WORKDIR=${GITHUB_WORKSPACE:-$(git rev-parse --show-toplevel)} +AUTHORS_PATH="${GIT_WORKDIR}/AUTHORS.txt" -if [ -f ${SCRIPT_PATH}/.ci.conf ] -then +if [ -f ${SCRIPT_PATH}/.ci.conf ]; then . ${SCRIPT_PATH}/.ci.conf fi @@ -31,8 +31,7 @@ EXCLUDED_CONTRIBUTORS+=('John R. Bradley' 'renovate[bot]' 'Renovate Bot' 'Pion B CONTRIBUTORS=() shouldBeIncluded () { - for i in "${EXCLUDED_CONTRIBUTORS[@]}" - do + for i in "${EXCLUDED_CONTRIBUTORS[@]}"; do if [[ $1 =~ "$i" ]]; then return 1 fi @@ -42,25 +41,23 @@ shouldBeIncluded () { IFS=$'\n' #Only split on newline -for contributor in $(git log --format='%aN <%aE>' | LC_ALL=C.UTF-8 sort -uf) -do - if shouldBeIncluded $contributor; then - CONTRIBUTORS+=("$contributor") +for CONTRIBUTOR in $(git log --format='%aN <%aE>' | LC_ALL=C.UTF-8 sort -uf); do + if shouldBeIncluded ${CONTRIBUTOR}; then + CONTRIBUTORS+=("${CONTRIBUTOR}") fi done unset IFS if [ ${#CONTRIBUTORS[@]} -ne 0 ]; then - cat >$AUTHORS_PATH <<-'EOH' + cat >${AUTHORS_PATH} <<-'EOH' # Thank you to everyone that made Pion possible. If you are interested in contributing # we would love to have you https://github.com/pion/webrtc/wiki/Contributing # # This file is auto generated, using git to list all individuals contributors. # see `.github/generate-authors.sh` for the scripting EOH - for i in "${CONTRIBUTORS[@]}" - do - echo "$i" >> $AUTHORS_PATH + for i in "${CONTRIBUTORS[@]}"; do + echo "$i" >> ${AUTHORS_PATH} done exit 0 fi diff --git a/.github/install-hooks.sh b/.github/install-hooks.sh index 73d20a4e4cb..cd899d4f6fb 100755 --- a/.github/install-hooks.sh +++ b/.github/install-hooks.sh @@ -11,6 +11,6 @@ SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) -cp "$SCRIPT_PATH/hooks/commit-msg.sh" "$SCRIPT_PATH/../.git/hooks/commit-msg" -cp "$SCRIPT_PATH/hooks/pre-commit.sh" "$SCRIPT_PATH/../.git/hooks/pre-commit" -cp "$SCRIPT_PATH/hooks/pre-push.sh" "$SCRIPT_PATH/../.git/hooks/pre-push" +cp "${SCRIPT_PATH}/hooks/commit-msg.sh" "${SCRIPT_PATH}/../.git/hooks/commit-msg" +cp "${SCRIPT_PATH}/hooks/pre-commit.sh" "${SCRIPT_PATH}/../.git/hooks/pre-commit" +cp "${SCRIPT_PATH}/hooks/pre-push.sh" "${SCRIPT_PATH}/../.git/hooks/pre-push" diff --git a/.github/lint-commit-message.sh b/.github/lint-commit-message.sh index 010a332867b..2beb31d7122 100755 --- a/.github/lint-commit-message.sh +++ b/.github/lint-commit-message.sh @@ -58,7 +58,7 @@ if [ "$#" -eq 1 ]; then fi lint_commit_message "$(sed -n '/# Please enter the commit message for your changes. Lines starting/q;p' "$1")" else - for commit in $(git rev-list --no-merges origin/master..); do - lint_commit_message "$(git log --format="%B" -n 1 $commit)" + for COMMIT in $(git rev-list --no-merges origin/master..); do + lint_commit_message "$(git log --format="%B" -n 1 ${COMMIT})" done fi diff --git a/.github/lint-disallowed-functions-in-library.sh b/.github/lint-disallowed-functions-in-library.sh index 8ce5d096f5e..9dd988f598c 100755 --- a/.github/lint-disallowed-functions-in-library.sh +++ b/.github/lint-disallowed-functions-in-library.sh @@ -13,36 +13,31 @@ set -e # Disallow usages of functions that cause the program to exit in the library code SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) -if [ -f ${SCRIPT_PATH}/.ci.conf ] -then +if [ -f ${SCRIPT_PATH}/.ci.conf ]; then . ${SCRIPT_PATH}/.ci.conf fi EXCLUDE_DIRECTORIES=${DISALLOWED_FUNCTIONS_EXCLUDED_DIRECTORIES:-"examples"} DISALLOWED_FUNCTIONS=('os.Exit(' 'panic(' 'Fatal(' 'Fatalf(' 'Fatalln(' 'fmt.Println(' 'fmt.Printf(' 'log.Print(' 'log.Println(' 'log.Printf(' 'print(' 'println(') -files=$( - find "$SCRIPT_PATH/.." -name "*.go" \ +FILES=$( + find "${SCRIPT_PATH}/.." -name "*.go" \ | grep -v -e '^.*_test.go$' \ - | while read file - do - excluded=false - for ex in $EXCLUDE_DIRECTORIES - do - if [[ $file == */$ex/* ]] - then - excluded=true + | while read FILE; do + EXCLUDED=false + for EXCLUDE_DIRECTORY in ${EXCLUDE_DIRECTORIES}; do + if [[ ${FILE} == */${EXCLUDE_DIRECTORY}/* ]]; then + EXCLUDED=true break fi done - $excluded || echo "$file" + ${EXCLUDED} || echo "${FILE}" done ) -for disallowedFunction in "${DISALLOWED_FUNCTIONS[@]}" -do - if grep -e "\s$disallowedFunction" $files | grep -v -e 'nolint'; then - echo "$disallowedFunction may only be used in example code" +for DISALLOWED_FUNCTION in "${DISALLOWED_FUNCTIONS[@]}"; do + if grep -e "\s${DISALLOWED_FUNCTION}" ${FILES} | grep -v -e 'nolint'; then + echo "${DISALLOWED_FUNCTION} may only be used in example code" exit 1 fi done diff --git a/.github/lint-filename.sh b/.github/lint-filename.sh index 81b3f14f178..3e7d1b961de 100755 --- a/.github/lint-filename.sh +++ b/.github/lint-filename.sh @@ -14,11 +14,11 @@ set -e SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) GO_REGEX="^[a-zA-Z][a-zA-Z0-9_]*\.go$" -find "$SCRIPT_PATH/.." -name "*.go" | while read fullpath; do - filename=$(basename -- "$fullpath") +find "${SCRIPT_PATH}/.." -name "*.go" | while read FULLPATH; do + FILENAME=$(basename -- "${FULLPATH}") - if ! [[ $filename =~ $GO_REGEX ]]; then - echo "$filename is not a valid filename for Go code, only alpha, numbers and underscores are supported" + if ! [[ ${FILENAME} =~ ${GO_REGEX} ]]; then + echo "${FILENAME} is not a valid filename for Go code, only alpha, numbers and underscores are supported" exit 1 fi done diff --git a/.github/lint-no-trailing-newline-in-log-messages.sh b/.github/lint-no-trailing-newline-in-log-messages.sh index 29cd4a28cd5..f0dad5994e1 100755 --- a/.github/lint-no-trailing-newline-in-log-messages.sh +++ b/.github/lint-no-trailing-newline-in-log-messages.sh @@ -13,29 +13,25 @@ set -e # Disallow usages of functions that cause the program to exit in the library code SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) -if [ -f ${SCRIPT_PATH}/.ci.conf ] -then +if [ -f ${SCRIPT_PATH}/.ci.conf ]; then . ${SCRIPT_PATH}/.ci.conf fi -files=$( - find "$SCRIPT_PATH/.." -name "*.go" \ - | while read file - do - excluded=false - for ex in $EXCLUDE_DIRECTORIES - do - if [[ $file == */$ex/* ]] - then - excluded=true +FILES=$( + find "${SCRIPT_PATH}/.." -name "*.go" \ + | while read FILE; do + EXCLUDED=false + for EXCLUDE_DIRECTORY in ${EXCLUDE_DIRECTORIES}; do + if [[ $file == */${EXCLUDE_DIRECTORY}/* ]]; then + EXCLUDED=true break fi done - $excluded || echo "$file" + ${EXCLUDED} || echo "${FILE}" done ) -if grep -E '\.(Trace|Debug|Info|Warn|Error)f?\("[^"]*\\n"\)?' $files | grep -v -e 'nolint'; then +if grep -E '\.(Trace|Debug|Info|Warn|Error)f?\("[^"]*\\n"\)?' ${FILES} | grep -v -e 'nolint'; then echo "Log format strings should have trailing new-line" exit 1 fi \ No newline at end of file From 2ebf9c64189bede25686b39fb1a253db6c4aac07 Mon Sep 17 00:00:00 2001 From: Kevin Wang Date: Fri, 18 Nov 2022 00:58:50 -0800 Subject: [PATCH 18/23] Fix docs typo Fixes a minor typo, a -> an. --- settingengine.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/settingengine.go b/settingengine.go index 74a6cb2121d..f55bf821eb5 100644 --- a/settingengine.go +++ b/settingengine.go @@ -98,8 +98,8 @@ func (e *SettingEngine) SetSRTPProtectionProfiles(profiles ...dtls.SRTPProtectio } // SetICETimeouts sets the behavior around ICE Timeouts -// * disconnectedTimeout is the duration without network activity before a Agent is considered disconnected. Default is 5 Seconds -// * failedTimeout is the duration without network activity before a Agent is considered failed after disconnected. Default is 25 Seconds +// * disconnectedTimeout is the duration without network activity before an Agent is considered disconnected. Default is 5 Seconds +// * failedTimeout is the duration without network activity before an Agent is considered failed after disconnected. Default is 25 Seconds // * keepAliveInterval is how often the ICE Agent sends extra traffic if there is no activity, if media is flowing no traffic will be sent. Default is 2 seconds func (e *SettingEngine) SetICETimeouts(disconnectedTimeout, failedTimeout, keepAliveInterval time.Duration) { e.timeout.ICEDisconnectedTimeout = &disconnectedTimeout From 5faad1ed0711b7031e6220c10c74785a3fba8c5d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 22 Nov 2022 09:42:21 +0000 Subject: [PATCH 19/23] Update module github.com/pion/ice/v2 to v2.2.12 Generated by renovateBot --- go.mod | 2 +- go.sum | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index c648bb480a6..8163d55fc99 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/onsi/gomega v1.17.0 // indirect github.com/pion/datachannel v1.5.2 github.com/pion/dtls/v2 v2.1.5 - github.com/pion/ice/v2 v2.2.11 + github.com/pion/ice/v2 v2.2.12 github.com/pion/interceptor v0.1.11 github.com/pion/logging v0.2.2 github.com/pion/randutil v0.1.0 diff --git a/go.sum b/go.sum index 6989fe990b4..11ab3416c5f 100644 --- a/go.sum +++ b/go.sum @@ -44,8 +44,8 @@ github.com/pion/datachannel v1.5.2 h1:piB93s8LGmbECrpO84DnkIVWasRMk3IimbcXkTQLE6 github.com/pion/datachannel v1.5.2/go.mod h1:FTGQWaHrdCwIJ1rw6xBIfZVkslikjShim5yr05XFuCQ= github.com/pion/dtls/v2 v2.1.5 h1:jlh2vtIyUBShchoTDqpCCqiYCyRFJ/lvf/gQ8TALs+c= github.com/pion/dtls/v2 v2.1.5/go.mod h1:BqCE7xPZbPSubGasRoDFJeTsyJtdD1FanJYL0JGheqY= -github.com/pion/ice/v2 v2.2.11 h1:wiAy7TSrVZ4KdyjC0CcNTkwltz9ywetbe4wbHLKUbIg= -github.com/pion/ice/v2 v2.2.11/go.mod h1:NqUDUao6SjSs1+4jrqpexDmFlptlVhGxQjcymXLaVvE= +github.com/pion/ice/v2 v2.2.12 h1:n3M3lUMKQM5IoofhJo73D3qVla+mJN2nVvbSPq32Nig= +github.com/pion/ice/v2 v2.2.12/go.mod h1:z2KXVFyRkmjetRlaVRgjO9U3ShKwzhlUylvxKfHfd5A= github.com/pion/interceptor v0.1.11 h1:00U6OlqxA3FFB50HSg25J/8cWi7P6FbSzw4eFn24Bvs= github.com/pion/interceptor v0.1.11/go.mod h1:tbtKjZY14awXd7Bq0mmWvgtHB5MDaRN7HV3OZ/uy7s8= github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY= @@ -112,7 +112,6 @@ golang.org/x/net v0.0.0-20211201190559-0a0e4e1bb54c/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220531201128-c960675eff93/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20221002022538-bcab6841153b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -136,7 +135,6 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220608164250-635b8c9b7f68/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= From c75da54795729fb2c18eafb3c49fc8a5dc872b21 Mon Sep 17 00:00:00 2001 From: cnderrauber Date: Wed, 23 Nov 2022 10:15:46 +0800 Subject: [PATCH 20/23] Add EnableLoopbackCandidate flag Add EnableLoopbackCandidate flag --- icegatherer.go | 1 + settingengine.go | 27 +++++++++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/icegatherer.go b/icegatherer.go index ab7e76db98d..a38f08b7471 100644 --- a/icegatherer.go +++ b/icegatherer.go @@ -108,6 +108,7 @@ func (g *ICEGatherer) createAgent() error { IPFilter: g.api.settingEngine.candidates.IPFilter, NAT1To1IPs: g.api.settingEngine.candidates.NAT1To1IPs, NAT1To1IPCandidateType: nat1To1CandiTyp, + IncludeLoopback: g.api.settingEngine.candidates.IncludeLoopbackCandidate, Net: g.api.settingEngine.vnet, MulticastDNSMode: mDNSMode, MulticastDNSHostName: g.api.settingEngine.candidates.MulticastDNSHostName, diff --git a/settingengine.go b/settingengine.go index f55bf821eb5..0c1e0c3a6f6 100644 --- a/settingengine.go +++ b/settingengine.go @@ -37,16 +37,17 @@ type SettingEngine struct { ICERelayAcceptanceMinWait *time.Duration } candidates struct { - ICELite bool - ICENetworkTypes []NetworkType - InterfaceFilter func(string) bool - IPFilter func(net.IP) bool - NAT1To1IPs []string - NAT1To1IPCandidateType ICECandidateType - MulticastDNSMode ice.MulticastDNSMode - MulticastDNSHostName string - UsernameFragment string - Password string + ICELite bool + ICENetworkTypes []NetworkType + InterfaceFilter func(string) bool + IPFilter func(net.IP) bool + NAT1To1IPs []string + NAT1To1IPCandidateType ICECandidateType + MulticastDNSMode ice.MulticastDNSMode + MulticastDNSHostName string + UsernameFragment string + Password string + IncludeLoopbackCandidate bool } replayProtection struct { DTLS *uint @@ -195,6 +196,12 @@ func (e *SettingEngine) SetNAT1To1IPs(ips []string, candidateType ICECandidateTy e.candidates.NAT1To1IPCandidateType = candidateType } +// SetIncludeLoopbackCandidate enable pion to gather loopback candidates, it is useful +// for some VM have public IP mapped to loopback interface +func (e *SettingEngine) SetIncludeLoopbackCandidate(include bool) { + e.candidates.IncludeLoopbackCandidate = include +} + // SetAnsweringDTLSRole sets the DTLS role that is selected when offering // The DTLS role controls if the WebRTC Client as a client or server. This // may be useful when interacting with non-compliant clients or debugging issues. From 6a5997bb13c27f622e5255d7a6016b91b1128c60 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 6 Dec 2022 06:06:04 +0000 Subject: [PATCH 21/23] Update module golang.org/x/net to v0.3.0 Generated by renovateBot --- go.mod | 2 +- go.sum | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 8163d55fc99..223881090a2 100644 --- a/go.mod +++ b/go.mod @@ -20,5 +20,5 @@ require ( github.com/sclevine/agouti v3.0.0+incompatible github.com/stretchr/testify v1.7.1 golang.org/x/crypto v0.0.0-20221010152910-d6f0a8c073c2 // indirect - golang.org/x/net v0.1.0 + golang.org/x/net v0.3.0 ) diff --git a/go.sum b/go.sum index 11ab3416c5f..97e85cbf3e5 100644 --- a/go.sum +++ b/go.sum @@ -112,8 +112,9 @@ golang.org/x/net v0.0.0-20211201190559-0a0e4e1bb54c/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220531201128-c960675eff93/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.3.0 h1:VWL6FNY2bEEmsGVKabSlHu5Irp34xmMRoqb/9lF9lxk= +golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -135,17 +136,20 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220608164250-635b8c9b7f68/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= From 720d9b09e288286e2a8f320ed42172c1c8cc5761 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 6 Dec 2022 08:57:12 +0000 Subject: [PATCH 22/23] Update module github.com/pion/transport to v0.14.1 Generated by renovateBot --- go.mod | 2 +- go.sum | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 223881090a2..ac8b64f2bc8 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/pion/sctp v1.8.3 github.com/pion/sdp/v3 v3.0.6 github.com/pion/srtp/v2 v2.0.10 - github.com/pion/transport v0.13.1 + github.com/pion/transport v0.14.1 github.com/sclevine/agouti v3.0.0+incompatible github.com/stretchr/testify v1.7.1 golang.org/x/crypto v0.0.0-20221010152910-d6f0a8c073c2 // indirect diff --git a/go.sum b/go.sum index 97e85cbf3e5..33ffbd5d6db 100644 --- a/go.sum +++ b/go.sum @@ -71,8 +71,9 @@ github.com/pion/stun v0.3.5/go.mod h1:gDMim+47EeEtfWogA37n6qXZS88L5V6LqFcf+DZA2U github.com/pion/transport v0.12.2/go.mod h1:N3+vZQD9HlDP5GWkZ85LohxNsDcNgofQmyL6ojX5d8Q= github.com/pion/transport v0.12.3/go.mod h1:OViWW9SP2peE/HbwBvARicmAVnesphkNkCVZIWJ6q9A= github.com/pion/transport v0.13.0/go.mod h1:yxm9uXpK9bpBBWkITk13cLo1y5/ur5VQpG22ny6EP7g= -github.com/pion/transport v0.13.1 h1:/UH5yLeQtwm2VZIPjxwnNFxjS4DFhyLfS4GlfuKUzfA= github.com/pion/transport v0.13.1/go.mod h1:EBxbqzyv+ZrmDb82XswEE0BjfQFtuw1Nu6sjnjWCsGg= +github.com/pion/transport v0.14.1 h1:XSM6olwW+o8J4SCmOBb/BpwZypkHeyM0PGFCxNQBr40= +github.com/pion/transport v0.14.1/go.mod h1:4tGmbk00NeYA3rUa9+n+dzCCoKkcy3YlYb99Jn2fNnI= github.com/pion/turn/v2 v2.0.8 h1:KEstL92OUN3k5k8qxsXHpr7WWfrdp7iJZHx99ud8muw= github.com/pion/turn/v2 v2.0.8/go.mod h1:+y7xl719J8bAEVpSXBXvTxStjJv3hbz9YFflvkpcGPw= github.com/pion/udp v0.1.1 h1:8UAPvyqmsxK8oOjloDk4wUt63TzFe9WEJkg5lChlj7o= @@ -137,6 +138,7 @@ golang.org/x/sys v0.0.0-20220608164250-635b8c9b7f68/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= From 1c20cd4d7b48d2ab8f166486730eb2475f3f8333 Mon Sep 17 00:00:00 2001 From: Chinmay Kousik Date: Mon, 12 Dec 2022 11:33:00 +0530 Subject: [PATCH 23/23] Update datachannel and sctp to latest To include SetReadDeadline. A ReadDeadliner can now be used from an underlying DataChannel --- go.mod | 6 +++--- go.sum | 19 +++++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index ac8b64f2bc8..5edbea565df 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.13 require ( github.com/onsi/ginkgo v1.16.5 // indirect github.com/onsi/gomega v1.17.0 // indirect - github.com/pion/datachannel v1.5.2 + github.com/pion/datachannel v1.5.5 github.com/pion/dtls/v2 v2.1.5 github.com/pion/ice/v2 v2.2.12 github.com/pion/interceptor v0.1.11 @@ -13,12 +13,12 @@ require ( github.com/pion/randutil v0.1.0 github.com/pion/rtcp v1.2.10 github.com/pion/rtp v1.7.13 - github.com/pion/sctp v1.8.3 + github.com/pion/sctp v1.8.5 github.com/pion/sdp/v3 v3.0.6 github.com/pion/srtp/v2 v2.0.10 github.com/pion/transport v0.14.1 github.com/sclevine/agouti v3.0.0+incompatible - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.8.1 golang.org/x/crypto v0.0.0-20221010152910-d6f0a8c073c2 // indirect golang.org/x/net v0.3.0 ) diff --git a/go.sum b/go.sum index 33ffbd5d6db..2726646bac9 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.17.0 h1:9Luw4uT5HTjHTN8+aNcSThgH1vdXnmdJ8xIfZ4wyTRE= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/pion/datachannel v1.5.2 h1:piB93s8LGmbECrpO84DnkIVWasRMk3IimbcXkTQLE6E= -github.com/pion/datachannel v1.5.2/go.mod h1:FTGQWaHrdCwIJ1rw6xBIfZVkslikjShim5yr05XFuCQ= +github.com/pion/datachannel v1.5.5 h1:10ef4kwdjije+M9d7Xm9im2Y3O6A6ccQb0zcqZcJew8= +github.com/pion/datachannel v1.5.5/go.mod h1:iMz+lECmfdCMqFRhXhcA/219B0SQlbpoR2V118yimL0= github.com/pion/dtls/v2 v2.1.5 h1:jlh2vtIyUBShchoTDqpCCqiYCyRFJ/lvf/gQ8TALs+c= github.com/pion/dtls/v2 v2.1.5/go.mod h1:BqCE7xPZbPSubGasRoDFJeTsyJtdD1FanJYL0JGheqY= github.com/pion/ice/v2 v2.2.12 h1:n3M3lUMKQM5IoofhJo73D3qVla+mJN2nVvbSPq32Nig= @@ -59,9 +59,8 @@ github.com/pion/rtcp v1.2.10 h1:nkr3uj+8Sp97zyItdN60tE/S6vk4al5CPRR6Gejsdjc= github.com/pion/rtcp v1.2.10/go.mod h1:ztfEwXZNLGyF1oQDttz/ZKIBaeeg/oWbRYqzBM9TL1I= github.com/pion/rtp v1.7.13 h1:qcHwlmtiI50t1XivvoawdCGTP4Uiypzfrsap+bijcoA= github.com/pion/rtp v1.7.13/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko= -github.com/pion/sctp v1.8.0/go.mod h1:xFe9cLMZ5Vj6eOzpyiKjT9SwGM4KpK/8Jbw5//jc+0s= -github.com/pion/sctp v1.8.3 h1:LWcciN2ptLkw9Ugp/Ks2E76fiWy7yk3Wm79D6oFbFNo= -github.com/pion/sctp v1.8.3/go.mod h1:OHbDjdk7kg+L+7TJim9q/qGVefdEJohuA2SZyihccgI= +github.com/pion/sctp v1.8.5 h1:JCc25nghnXWOlSn3OVtEnA9PjQ2JsxQbG+CXZ1UkJKQ= +github.com/pion/sctp v1.8.5/go.mod h1:SUFFfDpViyKejTAdwD1d/HQsCu+V/40cCs2nZIvC3s0= github.com/pion/sdp/v3 v3.0.6 h1:WuDLhtuFUUVpTfus9ILC4HRyHsW6TdugjEX/QY9OiUw= github.com/pion/sdp/v3 v3.0.6/go.mod h1:iiFWFpQO8Fy3S5ldclBkpXqmWy02ns78NOKoLLL0YQw= github.com/pion/srtp/v2 v2.0.10 h1:b8ZvEuI+mrL8hbr/f1YiJFB34UMrOac3R3N1yq2UN0w= @@ -69,7 +68,6 @@ github.com/pion/srtp/v2 v2.0.10/go.mod h1:XEeSWaK9PfuMs7zxXyiN252AHPbH12NX5q/CFD github.com/pion/stun v0.3.5 h1:uLUCBCkQby4S1cf6CGuR9QrVOKcvUwFeemaC865QHDg= github.com/pion/stun v0.3.5/go.mod h1:gDMim+47EeEtfWogA37n6qXZS88L5V6LqFcf+DZA2UA= github.com/pion/transport v0.12.2/go.mod h1:N3+vZQD9HlDP5GWkZ85LohxNsDcNgofQmyL6ojX5d8Q= -github.com/pion/transport v0.12.3/go.mod h1:OViWW9SP2peE/HbwBvARicmAVnesphkNkCVZIWJ6q9A= github.com/pion/transport v0.13.0/go.mod h1:yxm9uXpK9bpBBWkITk13cLo1y5/ur5VQpG22ny6EP7g= github.com/pion/transport v0.13.1/go.mod h1:EBxbqzyv+ZrmDb82XswEE0BjfQFtuw1Nu6sjnjWCsGg= github.com/pion/transport v0.14.1 h1:XSM6olwW+o8J4SCmOBb/BpwZypkHeyM0PGFCxNQBr40= @@ -83,11 +81,15 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/sclevine/agouti v3.0.0+incompatible h1:8IBJS6PWz3uTlMP3YBIR5f+KAldcGuOeFkFbUWfBgK4= github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -181,5 +183,6 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=