56 Commits

Author SHA1 Message Date
Sean DuBois
6ef2888a26 Fix RTPSender.SetReadDeadline crash
Add nil pointer check when calling SetReadDeadline. I don't believe this
can happen with WebRTC, but is possible with `ortc`.

A future improvement would be to cache the `SetReadDeadline` call. At
this time the complexity seems to outweight the reward.

Resolves #2889
2025-09-12 08:13:19 -07:00
boks1971
8efd17e592 Do not create receiver for ealy media in offerer
For offerer, if the remote side sends early media
before the remote description (answer) is received,
the undeclared SSRC processor can create a receiver
and that receiver could be left dangling as
transceiver `mid` is not updated from remote
description answer.

Still leaving the simulcast probe path and only
avoiding creating a receiver for non-simulcast path.

Add a flag `handleUndeclaredSSRCWithoutAnswer` to control handling
of early media without SDP answer for non-simulcast tracks.
The default behaviour is to not process early media without SDP answer.
2025-08-21 18:36:58 +05:30
Sean DuBois
e606604185 Set correct description for error
During refactor in 804a12fe we lost the actual message
2025-05-20 14:13:23 -04:00
Joe Turki
5ce8e05d22 Resolve undeclared SSRC using the payload type
Introduces a fallback mechanism to handle undeclared SSRCs from multiple
sections using the RTP stream's payload type. For legacy clients
without MID extension support, it documents the existing behavior for
handling undeclared SSRCs in single media sections.
2025-03-19 07:50:16 +02:00
Evan Brass
34f547626b Update CertificateFromPEM to support OpenSSL
Update CertificateFromPEM to be a loop over the PEM blocks.
This allows decoding the private key before decoding the certificate.
Tries to parse the certificate block directly but if that errors,
then it also tries to base64 decode the certificate block.

Fixes #3042
2025-03-10 23:23:54 -04:00
Joe Turki
bdfe07a07c Move ErrCodecAlreadyRegistered to errors.go 2025-03-01 22:18:16 +02:00
Joe Turki
feeeebf251 Upgrade golangci-lint, more linters
Introduces new linters, upgrade golangci-lint to version (v1.63.4)
2025-01-18 07:16:06 -06:00
Eric Daniels
9a71f6981f Prevent ICETransport start/stop deadlock 2024-09-04 13:21:07 -04:00
Steffen Vogel
683fc837d0 Make repo REUSE compliant 2023-05-05 11:58:49 -04:00
Woodrow Douglass
c9aaf819bc Add json support to ICECredentialType
This allows the interface to be slightly closer to
upstream interfaces.
2022-05-06 13:34:50 -04:00
boks1971
37e16a3b15 Bolting on send side simulcast
Introduces AddEncoding method in RTP sender to add simulcast encodings.

Added UTs for AddEncoding.
Also modified the Simulcast send test to use the new API.
2022-02-24 23:55:17 -08:00
Len
d4b645635c Fix RTPSender.Send crash
If PeerConnection removes track while RTPSender is
created and being negotiated, RTPSender.Send would
access nil pointer. Check If track is nil.

Relates to #2065
2022-01-07 10:46:18 -05:00
Sean DuBois
8a10f67d5a Better error message on SDPSemantics mismatch
Tell user what RemoteDescription was detected as, and what was expected

Resolves #2011
2021-12-12 23:09:23 -05:00
Sean DuBois
11b8873da2 Handle Simulcast RepairStream
Read + Discard packets from the Simulcast repair stream. When a
Simulcast stream is enabled the remote will send packets via the repair
stream for probing. We can't ignore these packets anymore because it
will cause gaps in the feedback reports

Resolves #1957
2021-09-15 15:08:22 -04:00
Sean DuBois
0735efd344 Throw error earlier for RTPSender with no codecs
It isn't possible to send media if a MediaEngine has no codecs. This
catches a common misconfiguration issues that users find themselves in.

Resolves #1702
2021-08-15 07:54:53 -04:00
Patryk Rogalski
3af80189da Fixes ReplaceTrack
When ReplaceTrack was set previously to nil
it would be impossible to ReplaceTrack again
with a non-nil value as r.track was set to nil.
2021-07-20 12:41:22 -04:00
digitalix
f524fea32a Implement SetCodecPreferences in RTPTransceiver
This allows to set supported codecs per transceiver.

Resolves #1847
2021-06-28 10:54:31 -04:00
digitalix
f8a8c09949 Support PayloadTypes changing a TrackRemote
If the PayloadType changes for a SSRC update the codec on the
TrackRemote.

Resolves #1850
2021-06-27 14:44:02 -04:00
Markus Tzoe
a0b3117680 RtpTransceiverInit => RTPTransceiverInit
since RtpTransceiverInit is deprecated
2021-04-15 06:19:26 +08:00
Benny Daon
c6c241d57c Add CertificateFromPEM and PEM() to Certificate
Allow for easier usage of a pre-existing certificate
2021-04-10 19:05:18 +03:00
Sean DuBois
ff1bc32221 Don't leak ICETransport routines
We didn't properly pass a context to the ICE Agent. We would leak
routines if closed while connecting.
2020-12-13 17:18:04 -08:00
Sean DuBois
70fb90c7fd Fix Simulcast routine leak
When a new SSRC is seen we start a Read loop for the packets. However if
we only see one packet this loop will just sit forever. If a user
doesn't send us enough packets to finish probing it will prevent any
subsequent streams from being probed.

Relates to #1345
2020-12-07 09:18:15 -08:00
Sean DuBois
3d9a7ede1a Allow extensions to be configured with direction
RegisterHeaderExtension now allows users to enable headers depending on
the type of transceiver that was created.

Also expose GetParameters on RTPSender and RTPReceiver

Co-authored-by: OrlandoCo <luisorlando.co@gmail.com>

Resolves #1554
2020-12-04 11:52:48 -08:00
Sean DuBois
7edfb701e0 New Track API
The Pion WebRTC API has been dramatically redesigned. The design docs
are located here [0]

You can also read the release notes [1] on how to migrate your
application.

[0] https://github.com/pion/webrtc-v3-design
[1] https://github.com/pion/webrtc/wiki/Release-WebRTC@v3.0.0
2020-11-15 09:20:47 -08:00
OrlandoCo
65400221ec Add methods to read Simulcast RTCP
Add ReadSimulcastRTCP and ReadSimulcast to RTPReceiver
2020-10-15 12:11:32 -07:00
Sean DuBois
f3d42e0120 Fix typo Quick -> Quic
Fix typo made when updating golangci-lint
2020-10-03 22:44:07 -07:00
Sean DuBois
804a12fed3 Update CI configs to v0.4.7
Update lint scripts and CI configs.
2020-09-30 09:06:34 -07:00
soolaugust
c01b447517 Add signaling state case in CreateAnswer()
According to
https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-createanswer.
If connection's signaling state is neither "have-remote-offer" nor
"have-local-pranswer", return a newly created InvalidStateError.
2020-09-03 13:46:46 -07:00
Renovate Bot
ca3cc9d940 Update module pion/srtp to v1.5.0
Generated by renovateBot
2020-07-20 23:00:53 -07:00
Sean DuBois
3a60d8dae8 Support ICE values at session level
Also add tests to assert we don't have conflicting values. This could
have happened before but we never tested for it.
2020-06-10 00:17:06 -07:00
Sean DuBois
00ba9ab52e Split ICE and DTLS related SDP parsing out
Move this stuff out of SetRemoteDescription so it will be easier to test

Relates to #1023
2020-02-14 18:53:19 -08:00
Sean DuBois
512a7d3330 Implement RemoveTrack
RemoveTrack properly removes the Sender, and culls
the RtpReceiver on the remote

Relates to #207
2020-02-09 21:40:37 -08:00
Vicken Simonian
27f93a7f3d Fix misspelled error types
ErrNoTurnCredencials => ErrNoTurnCredentials
ErrTurnCredencials => ErrTurnCredentials
2019-10-17 21:03:58 -07:00
Sean DuBois
d692ddfa54 Support DataChannel protocol in Go
Relates to #748
2019-09-27 16:19:49 -07:00
Sean DuBois
2838b1a836 Move ICE code out of internal
Users are unable to use the callbacks inside `internal/ice`.
Even though we alias things like OnSelectedCandidatePairChange
are unusable since in the package they use `ice.Candidate` instead of
`ICECandidate`
2019-06-15 01:29:08 -07:00
Adam Kiss
7756848a4c Moved ice related files to internal/ice
Moved ice related files to internal/ice. Added ice.go and
ice_go.go files containing aliases to internal/ice. Added
internal/tools/gen/genaliasdocs.go helper script for generating the
documentation for these aliases. Dropped ice
prefix from file names in internal/ice package.
2019-06-03 10:57:27 -07:00
Michael MacDonald
88448e5e74 Support plan-b (fallback or explicit)
By default, we should be using unified-plan as the
SDP format of choice. This patch adds a PeerConnection
configuration option to allow the user to specify that
they want plan-b only, unified-plan only, or a special
compatibility mode where a plan-b answer will be generated
IFF a plan-b offer is received.
2019-04-09 10:26:42 -04:00
Sean DuBois
632b16b852 Update golangci-lint to v14.0.0
Update linter to newest version and fix all new issues
2019-02-17 21:35:04 -08:00
Max Hawkins
0e7086d37a Remove RTC prefix from all names
Let's pull off the bandaid!

* Reduces studdering: webrtc.RTCTrack -> webrtc.Track
* Makes it easier to find types by editor autocomplete
* Makes code read more fluently (less repetition)

Since we're breaking the API in 2.0, our only chance to
do this is now.

Relates to #408
2019-02-17 16:22:56 -08:00
backkem
130fec6774 Data channel: Add Close and OnClose
Relates to #180
2019-01-23 23:17:26 +01:00
Hugo Arregui
0022840674 Handle AddIceCandidate if no remote desc is set
- Return proper error and prevent nil pointer dereference
2019-01-23 17:56:24 +01:00
Woodrow Douglass
3aee69ea60 Add some tests for MediaEngine
Also, centralize the error object returned
from media engine codec searches

Relates to #333
2019-01-23 16:21:13 +01:00
Sean DuBois
114de5e33f Fix golint and misspell errors
Found by goreportcard
2018-12-28 00:53:47 -08:00
Konstantin Itskov
0a2568695a Re-organize CreateDataChannel function and add limited spec compliance 2018-09-04 12:11:17 -04:00
Konstantin Itskov
77e6da4b9b Move DOM wrapper errors into their own package 2018-08-28 20:34:23 -04:00
Konstantin Itskov
902cf087aa Add corrections to comply with govet, golint, etc. 2018-08-28 01:03:09 -07:00
Konstantin Itskov
7b7a349071 Add a bunch of documentation all over the library strucutres 2018-08-28 01:03:09 -07:00
Konstantin Itskov
e8364dc5e9 Add fully working RTCIceServer with 100% unit-test code coverage 2018-08-28 01:03:09 -07:00
Konstantin Itskov
c32dd50b97 Add almost completely working stun/turn uri parser 2018-08-28 01:03:09 -07:00
Konstantin Itskov
c6bc9ab4e7 Add proper x509 certificate generation 2018-08-28 01:03:09 -07:00