Releases: pion/webrtc
v3.1.52
v3.1.51
Changelog
- 3c802f7 Reuse passive created sendonly transceiver
- 5b41ed6 Revert "Revert "Add currentDirection to RTPTransceiver""
- a92c400 Revert "Add currentDirection to RTPTransceiver"
- 66e8dfc Update CI configs to v0.10.3
- 5ef816e Update CI configs to v0.10.1
- 98a8604 Update module github.com/pion/sctp to v1.8.6
- 602cedd Update module github.com/pion/srtp/v2 to v2.0.11
- bc86d15 Update CI configs to v0.9.0
- 7ab3174 Update module golang.org/x/net to v0.4.0
- e29259c Update module github.com/pion/ice/v2 to v2.2.13
v3.1.50
v3.1.49
v3.1.48
Changelog
- fa6be2c Fix lint error
- 9713221 Close unhandled stream when peerconnection closed
- 2e42dfd Add test for pion-to-pion example
- 25624d6 Simplify docker compose file of pion-to-pion
- 257c9e5 Moved duplicate operation to function
- 6b1e684 Fix pion-to-pion example in docker-compose
- a748421 Update module golang.org/x/net to v0.1.0
- 789623a Update code to be more Go idiomatic
- c132bed Fix ice-single-port example README
- 9c47fea Remove
new RTCSessionDescription
pattern - e66501e Update CI configs to v0.8.0
- 42dc0d4 Update module github.com/pion/sctp to v1.8.3
Plutonia
Pion WebRTC v3.1.0 is now available. Pion WebRTC is a Go implementation of WebRTC. If you haven't used it before check out awesome-pion or example-webrtc-applications for what people are doing. We maintain a feature list and other helpful resources in our README.md
This release includes 170 commits from 36 authors. This release was primarily focused on improve media quality/experience and making it easier to scale with Pion.
New Features
Serve many PeerConnections with one UDP port
You can now serve all your PeerConnections with a single UDP port. This makes deploying and scaling in environment like Kubernetes easier. Most WebRTC implementations (including Pion) will listen on a random UDP port for each remote peer.
To use this you create a ICEUDPMux
and then share across all your PeerConnections via the SettingEngine. Your code will look like the following.
// Listen on UDP Port 8443
udpListener, _ := net.ListenUDP("udp", &net.UDPAddr{
IP: net.IP{0, 0, 0, 0},
Port: 8443,
})
// Configure a 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 := webrtc.SettingEngine{}
settingEngine.SetICEUDPMux(webrtc.NewICEUDPMux(nil, udpListener))
// Create a new API using our SettingEngine
api = webrtc.NewAPI(webrtc.WithSettingEngine(settingEngine))
// Create a new PeerConnection
peerConnection_, := api.NewPeerConnection(webrtc.Configuration{})
This was implemented in d0a525.
FireFox Simulcast Support
We now support SSRC based Simulcast, before we only supported reading RID/MID from the RTP Extension Header as defined in ietf-mmusic-sdp-simulcast.
This was implemented in d570b7.
Sender/Receiver Report
Sender/Receiver Reports are now enabled by default via pion/interceptor
This means that remote peers will now get metadata from Pion and be able to do things like Bandwidth Estimation.
No code changes are needed to use them, but if you wish to disable them create a PeerConnection without passing a
InterceptorRegisty that RegisterDefaultInterceptors
has been called on. This can be useful if performance is critical
or you want to ship your own implementation.
// Register the default Codec configuration
m := &webrtc.MediaEngine{}
m.RegisterDefaultCodecs()
// Create a new API using our MediaEngine
api = webrtc.NewAPI(webrtc.WithMediaEngine(m))
// Create a new PeerConnection
peerConnection_, := api.NewPeerConnection(webrtc.Configuration{})
This was implemented in bc3016
Transport Wide Congestion Control Feedback
Transport Wide Congestion Control Feedback is now enabled by default via pion/interceptor
This allows remote peers to perform even better Congestion Control over Receiver Reports.
No code changes are needed to use them, but if you wish to disable them create a PeerConnection without passing a
InterceptorRegisty that RegisterDefaultInterceptors
has been called on. This can be useful if performance is critical
or you want to ship your own implementation.
// Register the default Codec configuration
m := &webrtc.MediaEngine{}
m.RegisterDefaultCodecs()
// Create a new API using our MediaEngine
api = webrtc.NewAPI(webrtc.WithMediaEngine(m))
// Create a new PeerConnection
peerConnection_, := api.NewPeerConnection(webrtc.Configuration{})
This was implemented in c8a26a
H265 Support
You can now packetize/depacketize H265. This allows you to read from a video file and send it over RTP, or the reverse.
This was implemented in 6cf5e9
Future Shock
The Pion team is very excited to announce the v3.0.0 release of Pion WebRTC. Pion WebRTC is a Go implementation of WebRTC. If you haven't used it before check out awesome-pion or example-webrtc-applications for what people are doing. We maintain a feature list and other helpful resources in our README.md
This release includes 264 commits from 43 authors. We reduced sharp edges in the media API, add performance gains in media and datachannel paths and brought ourselves more in alignment with the browser API.
We do have quite a few breaking changes. Please read them carefully, most of these things can't be caught at compile time. Reading this document could save a lot of time debugging. Each change will have a linked commit. Looking at examples/
in the linked commit should show what code you need to change in your application.
Breaking Changes
Trickle ICE is now enabled by default
Before /v3
Pion WebRTC would gather all candidates before a CreateOffer
or CreateAnswer
generated a SDP. This would
cause a few issues in real world applications. You can read about the benefits of Trickle ICE here
- Longer call connection times since we blocked for STUN/TURN even if not needed
- This didn't comply with the WebRTC spec
- Made it harder for users to filter/process ICE Candidates
Now you should exchange ICE Candidates that are pushed via the OnICECandidate
callback.
Before
peerConnection, _ := webrtc.NewPeerConnection(webrtc.Configuration{})
offer, _ := peerConnection.CreateOffer()
peerConnection.SetLocalDescription(offer)
// Send `offer` to remote peer
websocket.Write(offer)
After
peerConnection, _ := webrtc.NewPeerConnection(webrtc.Configuration{})
// Set ICE Candidate handler. As soon as a PeerConnection has gathered a candidate
// send it to the other peer
peerConnection.OnICECandidate(func(i *webrtc.ICECandidate) {
// Send ICE Candidate via Websocket/HTTP/$X to remote peer
})
// Listen for ICE Candidates from the remote peer
peerConnection.AddICECandidate(remoteCandidate)
// You still signal like before, but `CreateOffer` will be much faster
offer, _ := peerConnection.CreateOffer()
peerConnection.SetLocalDescription(offer)
// Send `offer` to remote peer
websocket.Write(offer)
If you are unable to migrate we have provided a helper function to simulate the pre-v3 behavior.
Helper function to simulate non-trickle ICE
peerConnection, _ := webrtc.NewPeerConnection(webrtc.Configuration{})
offer, _ := peerConnection.CreateOffer()
// Create channel that is blocked until ICE Gathering is complete
gatherComplete := webrtc.GatheringCompletePromise(peerConnection)
peerConnection.SetLocalDescription(offer)
<-gatherComplete
// Send `LocalDescription` to remote peer
// This is the offer but populated with all the ICE Candidates
websocket.Write(*peerConnection.LocalDescription())
This was changed with bb3aa9
A data channel is no longer implicitly created with a PeerConnection
Before /v3
Pion WebRTC would always insert a application
Media Section. This means that an offer would work even if
you didn't create a DataChannel or Transceiver, in /v3
you MUST create a DataChannel or track first. To better illustrate
these are two SDPs, each from a different version of Pion WebRTC
/v2 SDP
with no CreateDataChannel
v=0
o=- 8334017457074456852 1596089329 IN IP4 0.0.0.0
s=-
t=0 0
a=fingerprint:sha-256 91:B0:3A:6E:9E:43:9A:9D:1B:71:17:7D:FB:D0:5C:81:12:6E:61:D5:6C:BF:92:E8:8D:04:F5:92:EF:62:36:C9
a=group:BUNDLE 0
m=application 9 DTLS/SCTP 5000
c=IN IP4 0.0.0.0
a=setup:actpass
a=mid:0
a=sendrecv
a=sctpmap:5000 webrtc-datachannel 1024
a=ice-ufrag:yBlrlyMmuDdCfawp
a=ice-pwd:RzlouYCNYDNpPLJLdddFtUkMVpKVLYWz
a=candidate:foundation 1 udp 2130706431 192.168.1.8 51147 typ host generation 0
a=candidate:foundation 2 udp 2130706431 192.168.1.8 51147 typ host generation 0
a=end-of-candidates
/v3 SDP
with no CreateDataChannel
v=0
o=- 8628031010413059766 1596089396 IN IP4 0.0.0.0
s=-
t=0 0
a=fingerprint:sha-256 64:79:7C:73:6B:8A:CF:34:9D:D0:9C:6B:31:07:44:0A:CD:56:F0:74:62:72:D4:23:D5:BC:B2:C9:46:55:C5:A3
a=group:BUNDLE
To simulate the old functionality, call CreateDataChannel
after creating your PeerConnection and before calling anything else.
This was changed with abd6a3
Track
is now an interface
The design of the Track API in /v3
has been updated to accommodate more use cases and reduce the sharp edges in the API.
Before we used one structure to represent incoming and outgoing media. This didn't match with how WebRTC actually works.
In WebRTC a track isn't bi-directional. Having Read
and Write
on the same structure was confusing.
Split Track
into TrackLocal
and TrackRemote
Now we have TrackLocal
and TrackRemote
. TrackLocal
is used to send media, TrackRemote
is used to receive media.
TrackRemote
has a similar API to /v2
. It has Read
and ReadRTP
and code will continue to work with just a name change Track -> TrackRemote
TrackLocal
is now an interface, and will require more work to port. For existing code you will want to use one of the TrackLocal
implementations.
NewLocalTrackStaticSample
or NewLocalTrackStaticRTP
depending on what type of data you were sending before.
Code that looks like
videoTrack, err := peerConnection.NewTrack(payloadType, randutil.NewMathRandomGenerator().Uint32(), "video", "pion")
Needs to become like one of the following
videoTrack, err := webrtc.NewTrackLocalStaticSample(webrtc.RTPCodecCapability{MimeType: "video/vp8"}, "video", "pion")
videoTrack, err := webrtc.NewTrackLocalStaticRTP(webrtc.RTPCodecCapability{MimeType: "video/vp8"}, "video", "pion")
Users no longer have to manage SSRC/PayloadType
When creating a Track you don't need to know these values. When writing packets you don't need to pull these values either. Internally
we make sure that everything is properly set. This means that mediaengine.PopulateFromSDP
has been removed, and you can delete any code that does this.
Other packages can satisfy LocalTrack
pion/mediadevices now can provide an API that feels like getUserMedia
in the browser. Before it wasn't able to generate
anything that pion/webrtc
could directly call AddTrack
on.
A user could also implement LocalTrack
and and add custom behavior.
MediaEngine API has changed
We now use data structures from the W3C to configure available codecs and header extensions. You can also define your own MimeTypes, allowing
you to send any codec you wish! pion/webrtc
can support for a new codec with just calls to the public API.
Before
m.RegisterCodec(webrtc.NewRTPOpusCodec(webrtc.DefaultPayloadTypeOpus, 48000))
m.RegisterCodec(webrtc.NewRTPVP8Codec(webrtc.DefaultPayloadTypeVP8, 90000))
After
if err := m.RegisterCodec(webrtc.RTPCodecParameters{
RTPCodecCapability: webrtc.RTPCodecCapability{MimeType: "video/VP8", ClockRate: 90000, Channels: 0, SDPFmtpLine: "", RTCPFeedback: nil},
PayloadType: 96,
}, webrtc.RTPCodecTypeVideo); err != nil {
panic(err)
}
if err := m.RegisterCodec(webrtc.RTPCodecParameters{
RTPCodecCapability: webrtc.RTPCodecCapability{MimeType: "audio/opus", ClockRate: 48000, Channels: 0, SDPFmtpLine: "", RTCPFeedback: nil},
PayloadType: 111,
}, webrtc.RTPCodecTypeAudio); err != nil {
panic(err)
}
This was changed with 7edfb7
New Features
ICE Restarts
You can now initiate and accept an ICE Restart! This means that if a PeerConnection
goes to Disconnected
or Failed
because of network interruption it is no longer fatal.
To use you just need to pass ICERestart: true
in your OfferOptions
. The answering PeerConnection will then restart also. This is supported in FireFox/Chrome and Mobile WebRTC Clients.
peerConn, _ := NewPeerConnection(Configuration{})
// PeerConnection goes to ICEConnectionStateFailed
offer, _ := peerConn.CreateOffer(&OfferOptions{ICERestart: true})
This was implemented in f29414
ICE TCP
Pion WebRTC now can act as a passive ICE TCP candidates. This means that a remote ICE Agent that supports TCP active can connect to Pion without using UDP. Before the only way to achieve ICE Connectivity in UDP-less networks was by using a TURN server.
You should still deploy and use a TURN server for NAT traversal.
Since this isn't part of the standard WebRTC API it requires SettingEngine usage. You can see how to use it in examples/ice-tcp
This was implemented in 2236dd
OnNegotationNeeded
onnegotationneeded is now available. You can define a callback and be notified whenever session negotiation needs to done.
OnNegotationNeeded
in pion/webrtc will behave differently that in the browser because we are operating in a multi-threaded environment. Make sure to have proper locking around your signaling/S...
v3.0.0-beta.15: Fix RTPSendParameters
RTPSendParameters contains an array of encodings. RTPSender.GetParameters returns RTPSendParameters.
v3.0.0-beta.11: Add RTPTransceiver.SetSender
This non-standard API allows us to re-use existing transceivers. The WebRTC API causes SDP bloat right now since it doesn't allow the re-use of existing media sections.
v3.0.0-beta.10
hold lock for checkNegotiationNeeded transceiver checks