Commit Graph

57 Commits

Author SHA1 Message Date
Joe Turki
740e5166c5 Update lint rules, force testify/assert for tests
Use testify's assert package instead of the standard library's testing
package.
2025-03-27 12:08:37 +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
Nils Ohlmeier
2fd3640fa3 Only collect single fingerprints/ICE credentials
The way currently DTLS fingerprints and ICE credentials
are picked is causing interop issues as described in #2621

Peers which don't use Bundle can use different fingerprints
and credentials in each media section. Even though is
not (yet) supported by Pion, receiving an SDP offer from
such a peer is valid.

Additionally if Bundle is being used the group attribute
determines which media section is the master bundle section,
which establishes the transport. Currently Pion always
just uses the first credentials/fingerprint it can find
in the SDP, which results in not spec compliant behavior.

This PR attempts to fix the above issues and make
Pion more spec compliant and interoperable.

Fixes #2621
2024-11-13 23:44:00 -05:00
Eric Daniels
13b4a614b1 Fix TestPeerConnection_EventHandlers flake
- Fixes #2848
2024-08-02 13:10:41 -04:00
Sean DuBois
fda6c4f836 Fix linter errors
golangci-lint upgrade to v1.56.2 added more checks

Relates to pion/.goassets#201
2024-03-16 21:09:38 -04:00
Sean DuBois
dc4b591c4d Start pion/webrtc/v4
60eea43 is a breaking change
2023-09-05 11:48:14 -04:00
Sean DuBois
60eea430ac Close PeerConnection on DTLS CloseNotify
Resolves #1767
Resolves pion/dtls#151
2023-09-05 04:52:17 -04:00
renovate[bot]
ea23dec2b9 Update module transport, srtp, ice and turn
ReplayDetector introduced a breaking change
2023-09-03 23:59:43 -04:00
Steffen Vogel
683fc837d0 Make repo REUSE compliant 2023-05-05 11:58:49 -04:00
Sean DuBois
595f1c03d1 Move negotation test out of peerconnection_test
No functional change
2023-03-08 10:11:11 -08:00
Eric Daniels
777e03ca3c Fix negotiation needed panic on nil Sendonly track
In step 5.3.1, since we do not have a sender we can only choose
to signal that we need negotiation.
2023-03-07 22:59:45 -08:00
cnderrauber
220b1f37ee Refine updateConnectionState
Make updateConnectionState consistent with
https://www.w3.org/TR/webrtc/#rtcpeerconnectionstate-enum
2023-03-03 15:35:49 +08:00
Steffen Vogel
eafdc7742a Use new pion/transport Net interface
This change adapts pion/ice to use a new interface for most network
related operations. The interface was formerly a simple struct vnet.Net
which was originally intended to facilicate testing. By replacing it
with an interface we have greater flexibility and allow users to hook
into the networking stack by providing their own implementation of
the interface.
2023-02-09 09:39:33 +01:00
Sean DuBois
7367daf232 Increase requirements for Plan-B detection
Before a SessionDescription was assumed to be Plan-B if it contained a
MediaName of `audio` or `video`. This PR Changes that behavior.

If SDPSemantics is UnifiedPlan the SessionDescription must contain a
MediaDescription with two SSRCes to be considered a Plan-B. Before if
the MediaDescription had name of `audio` or `video` it was assumed to be
Plan-B.

If SDPSemantics is PlanB or UnifiedPlanWithFallback it maintains the
existing behavior.

Resolves #2193
2022-05-23 10:13:02 -04:00
Sean DuBois
94262c1b2b Add DTLS, ICE and SCTP Transport to WASM
Only available in the browser, not in wrtc yet.

Resolves #2099
2022-02-08 00:37:47 -05:00
Sean DuBois
a630d62dd4 Move Simulcast SDP Modification into helper
Will be used by Simulcast renegotation tests as well

Relates to #1345
2021-08-29 20:54:44 -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
Markus Tzoe
a0b3117680 RtpTransceiverInit => RTPTransceiverInit
since RtpTransceiverInit is deprecated
2021-04-15 06:19:26 +08:00
Tomek
9b859870c0 Implement WASM Media methods
Add AddTransceiverFromKind and GetTransceivers. This doesn't support
everything, but enough to at least build a recvonly experience.

Resolves #500
2021-04-12 18:55:56 -07:00
Sean DuBois
9c7b365144 Use closePairNow in tests
Instead of explicitly closing each PeerConnection use helper.
No change in test behavior, just makes code more consistent.
2021-02-16 15:47:58 -08:00
Juliusz Chroboczek
f4b3d98c1f Add IPv6 addresses to some tests
This only checks they are being parsed with no error, it doesn't
actually do anything useful with them.
2021-01-29 11:37:20 -08:00
tarrencev
a54b74cdb7 Update pion/interceptor for NACKs
Generate + Respond interceptors
2020-12-14 21:40:09 -08:00
Sean DuBois
7fc6f5435b Stop discarding errors in setDescription
SetRemoteDescription was not properly returning errors. Fix and add test
to make sure we don't regress again in the future.

Resolves #1210
Resolves #1473
2020-10-15 22:23:09 -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
Kuzmin Vladimir
2c5819d521 Implement OnNegotiationNeeded
This event is fired when a change has occurred
which requires session negotiation.

Resolves #817
2020-08-19 14:37:18 -05:00
Woodrow Douglass
8090cca216 Refactor some PeerConnection Tests
This is to support the removal of implicitly
created data channels.
2020-07-29 12:57:37 -07:00
Sean DuBois
addb9594f2 Assert SDPType in setDescription
Before users could pass a SessionDescription with a 0 type. This would
be discarded silently. Now we return an error that matches browser
behavior.

Resolves #1297
2020-07-13 14:38:09 -07:00
Sean DuBois
bb3aa9717f Move to pion/ice@v2
Removed support for trickle ice

Resolves #1274
2020-06-28 00:01:47 -07:00
Sean DuBois
89d7de1787 Start /v3
See #9 for the features we have planned, and the breaking changes that
may occur.
2020-06-25 09:45:27 -07:00
Josh Bleecher Snyder
24877a4714 Fix broken link to issue in comment
Link incorrectly include /v2 to github repo
2020-06-06 13:28:16 -07:00
Jerko Steiner
b66c3c4903 Add operations queue for setting descriptions
Most likely fixes #1157
2020-05-13 22:00:52 +02:00
Egon Elbre
f4f8299694 Fix logging issue with fmt.Sprintf
log.Trace("%v") could end up logging "%!v(MISSING).
2020-04-11 21:43:41 +09:00
Sean DuBois
1f448413f2 Handle changing role during re-negotiation
On all subsequent re-offers make sure to order
of media sections.

Add TestPeerConnection_RoleSwitch to assert this behavior

Resolves #1058
2020-03-08 21:29:20 -07:00
Sean DuBois
efe2c58d4e Add test for OnICEGatheringStateChange
Resolves #767
2020-01-30 00:19:32 -08:00
Sean DuBois
3f2c36d153 Add PeerConnectionState
Start properly setting the PeerConnectionState and make
OnConnectionState available

Resolves #614
2019-09-15 21:01:47 -07:00
Sean DuBois
eb737ba0b2 Fix routine leak in drainSRTP
Store orphaned SRTP/SRTCP streams and discard them
when we close the PeerConnection

Resolves #729
2019-07-06 22:58:07 +01:00
AlexWoo(武杰)
3a15b2ccda Check all SDP media sections for a fingerprint
Fix RemoteDescription parsing so that it parses all sections when
looking for a fingerprint, before it would fail if the first section
did not contain one
2019-06-23 23:40:40 -07:00
Konstantin Itskov
8c7f769e86 Fix race issue caused by multiple gathering
resolves #707
2019-06-07 20:05:55 -07:00
Sean DuBois
1d721199ef Add ICE Trickle support
Resolves pion/ice#51

Co-authored-by: Konstantin Itskov <konstantin.itskov@kovits.com>
2019-05-29 17:15:28 -07:00
Max Hawkins
7f6c01d5bc Move missing codec test to media_test
So it doesn't conflict with WASM.

Related to #449
2019-04-09 18:12:58 -07:00
Max Hawkins
141ef8b71a SDP: reject media tracks without matching codec
Previously the PeerConnection would create invalid SDPs
when answering an offer that contained codecs it didn't
know about. Now it rejects them by setting the media format
to 0.

Related to #449
2019-04-09 18:12:58 -07:00
Sean DuBois
dbde6114a2 Update import paths
Add /v2 to import paths everywhere
2019-04-07 02:17:15 -07:00
Sean DuBois
1cdfc10c84 Mass replace pions -> pion
Pions organization was renamed to pion
2019-04-04 15:32:03 -07:00
Alex Browne
5ee8b1a5c5 Add ICE candidate event handlers
Add OnICECandidate and OnICEGatheringStateChange methods to
PeerConnection. The main goal of this change is to improve API
compatibility with the JavaScript/Wasm bindings. It does not actually
add trickle ICE support or change the ICE candidate gathering process,
which is still synchronous in the Go implementation. Rather, it fires
the appropriate events similar to they way they would be fired in a true
trickle ICE process.

Remove unused OnNegotiationNeeded event handler. This handler is not
required for most applications and would be difficult to implement in
Go. This commit removes the handler from the JavaScript/Wasm bindings,
which leads to a more similar API for Go and JavaScript/Wasm.

Add OnICEGatheringStateChange to the JavaScript/Wasm bindings. Also
changes the Go implementation so that the function signatures match.
2019-03-25 14:22:11 -07:00
Alex Browne
012a7ea686 Improve build tags for Wasm
Fixes #515

This includes a few small and closely related changes:

1. All occurrences of the build tag `+build js` have been changed to the
   more precise `+build js,wasm`. This will exclude the files from being
   included by third-party compilers like GopherJS, with which they are
   incompatible.
2. Some files which are incompatible with JavaScript/Wasm now have the
   correct build tag (`+build -js`) so they will be excluded from Wasm
   builds.
3. Some configuration options which are incompatible with
   JavaScript/Wasm (or at least the current bindings) will now no longer
   appear in Wasm builds. This meant creating new files with new struct
   definitions and the appropriate build tags.
2019-03-22 10:48:03 -07:00
Yutaka Takeda
8c36225dbc Moved the getter tests to peerconnection_go_test
Resolves #526
2019-03-19 10:48:33 -07:00
Yutaka Takeda
f28fadae04 Change PC pubic properties to methods
Resolves #526
2019-03-19 10:48:33 -07:00
Alex Browne
34e5a89f71 Add tests for WASM bindings
The tests are run in a Node.js environment, and this does not include
any browser tests. This requires the wrtc package from npm as well as a
shim which adds portions of the WebRTC API to the global scope.

Some tests introduced here can be combined when differences between the
Go API and the WASM bindings are addressed and as missing features are
added to the WASM bindings.

We can and should add more tests in the future to improve test coverage.
This should be considered the minimum number of tests reuqired to ensure
basic functionality is working.
2019-03-15 15:17:51 -07:00
Sean DuBois
005c731b9b Fix deadlock on DTLS shutdown
DTLS shutdown deadlocks if Close is called before startup completes,
because the DTLS connection hasn't finished yet we don't have handles
to close anything.

This updates DTLS to follow how SCTP is shutdown, by shutting down the
nextConn (ICE in this case) we can shutdown the subsystem. By closing
ICE first, DTLS (and then SCTP) close properly no matter what state
they are in.

Resolves #487
2019-03-07 11:48:40 +01:00