43 Commits

Author SHA1 Message Date
Joe Turki
22dd7b733b Replace interface{} with any 2025-06-19 23:44:08 +03:00
Joe Turk
5edce958fd Include sdpMid and sdpMLineIndex for ICECandidates returned by OneICECandidate (#2990)
#### Description
Currently, Pion returns an empty `sdpMid` and a 0 `sdpMLineIndex`. This
PR ensures Pion returns the corresponding `sdpMid` and `sdpMLineIndex`
for ICE candidates for clients that expects it. Fixes trickle issues.

#### Changes

1. `ICECandidates`: New fields `SDPMid` and `SDPMLineIndex`.
2. `ICEGatherer`: `SetMediaStreamIdentification` and return the correct
`SDPMid` and `SDPMLineIndex`.
3. `extractICEDetails`: Return a struct instead of multiple values.
4. `extractICEDetails` refactored the media description selection to a
different function.
5. Added new tests.

#### Reference issue
Fixes https://github.com/pion/webrtc/issues/2690
Fixes https://github.com/pion/webrtc/issues/1833
2025-01-08 19:08:44 -06:00
Sean DuBois
3aab0355e0 Upgrade dtls, ice, stun and turn
New major version of all packages caused by DTLS upgrade
2024-08-12 13:45:35 -04:00
Woodrow Douglass
13450332a4 Remove the "Unknown" constant
This commit replaces the Unknown constant with
separate constants for each enumeration that
uses it.

Fixes #1293
2023-09-12 13:29:05 -04:00
Sean DuBois
dc4b591c4d Start pion/webrtc/v4
60eea43 is a breaking change
2023-09-05 11:48:14 -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
Juliusz Chroboczek
a6d0403a46 Remove occurrences of Unknonwn ICECredentialType
In 3.1.37, we removed the possibility for ICECredentialType
to be Unknown.  Remove remaining tests for this case from
the WASM code.
2022-05-11 15:36:38 -04:00
Juliusz Chroboczek
b4579949e1 Fix the zero value of ICECredentialType
Ensure that the zero value of ICECredentialType is password.
2022-05-10 21:12:05 -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
Sean DuBois
014b717636 Enable credential+credentialType for WASM
Resolves #2124
Resolves #2140
2022-04-18 16:10:07 -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
Roman Romanenko
7c8064052e Update all examples with copySessionDescription
copySessionDescription adds a button to all examples that copies the
local Session Description. This makes it easier for users to copy the
values.

Resolves #2092
2022-02-05 13:41:44 -05:00
Sean DuBois
157220e800 Run gofmt to add new build constraints
Also remove some 1.13 specific WASM code
2022-01-17 22:36:01 -05: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
decanus
e3ec4024ba Expose NewSDPType
Allows a user to easily marshal a string to SDPType
2021-01-09 14:51:22 -08:00
Assad Obaid
a38b7a48e1 Fix usernameFragment string pointer to value 2020-10-24 11:42:13 -07:00
Sean DuBois
2155a7d703 Move candidate parsing to pion/ice
Instead of having logic in pion/webrtc and pion/sdp move all logic to
pion/ice. Users of pion/ice don't want to import these packages to use
basic pion/ice functionality.
2020-09-13 00:05:09 -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
soolaugust
6f6de25b24 Modify all hdlr to handler for better reading
change hdlr -> handler, Hdlr -> Handler for better reading.
Since this is first commit, add myself to contributors
2020-08-17 22:04:29 -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
salmān aljammāz
4618922011 Implement js.Wrapper interface for PeerConnection
This allows us to extract the RTCPeerConnection object and pass it
back to JavaScript land. It is useful for building applications
where some parts (e.g.  signalling) are written in Go and others
(e.g. media or datachannel handling) are in JavaScript.
2020-05-26 20:53:02 -07:00
salmān aljammāz
7a95bb893a WASM: Fallback to SDP line for candiate callback
On Firefox, the RTCIceCandidate interface appears to just be an
RTCIceCandidateInit in disguise. That is, it does not have properties
for each individual component of the candidate line. It only has
the raw SDP string in the candidate property.

This change falls back to parsing the candidate line if some expected
property is missing when preparing the candidate for the callback
OnICECandidate.

https://developer.mozilla.org/en-US/docs/Web/API/RTCIceCandidate

https://caniuse.com/#feat=mdn-api_rtcicecandidate_priority
2020-05-26 16:28:25 -07:00
Slugalisk
d5998ae2dd Replace js.Value comparisons deprecated in Go 1.14
Use IsUndefined() and IsNull() to check for undefined and null js.Value
when building with Go 1.14.
2020-03-07 23:08:51 -08:00
Vicken Simonian
5f25df2209 Various spell fixes
For error types, vars, docs and comments
2019-10-17 23:31:21 -07:00
Sean DuBois
faf413d5db Add negotiated Datachannel test
Fails in Go, but passes WASM

Resolves #748
2019-09-28 22:34:57 -07: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
81d03573bc Delete disabled media WASM code
This functionality will not be added so remove
the commented out code which doesn't serve a purpose
2019-09-14 17:35:51 -07:00
Sean DuBois
0a62e5d4c1 Create WASM covering review
We have a few things that need to be addressed, I
have ticketed them. We should now completely pass godox!

Resolves #106
2019-07-27 09:35:55 -07:00
Sean DuBois
be3d922fbb Add mDNS Host Candidate support
This only does parsing, does not generate them.
In the future this option will be exposed via the SettingEngine,
including the ability to opt out of mDNS completely for security/scaling
concerns

Relates to pion/webrtc#699
2019-06-21 10:13:27 -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
Adam Kiss
8289a3e7cc Prepare for internal/ice package
Removed SDP dependency from ice files. Exported string to ice enum
functions. Exported ICEServer.Validate.
2019-05-26 14:09:38 +02: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
backkem
57a3296cf0 WASM: Port API object
Port the API object to the JS/WASM target. This allows more
code to work for both targets.
2019-04-01 21:00:41 +02:00
Max Hawkins
4298892dc0 Rename SendRTCP -> WriteRTCP
Makes method name consistent with WriteRTP

Fixes #557
2019-03-30 10:21:46 -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
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
Alex Browne
0f1ddf0825 Add JavaScript/WASM bindings
Resolves #478. Adds minimal JavaScript/WASM bindings. This makes it
possible to compile core parts of pions/webrtc to WASM and run it in the
browser. Only data channels are supported for now and there is
limited/no support for certificates and credentials.
2019-03-08 00:26:17 +01:00