Commit Graph

190 Commits

Author SHA1 Message Date
Sean DuBois
bf66a69c78 Make updateConnectionState idempotent
Pass in the state of transports instead of querying inside the function

Resolves #614
2019-09-15 21:01:47 -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
dbca703798 Don't return event status if unused
In lots of our event handlers we return the event status.
This is so we can know if the callee has finished. In lots
of cases we don't care so get rid of them to simplify the code.
2019-09-15 21:01:47 -07:00
Sean DuBois
bc46e8d43b Remove indirection from ICEConnectionState setter
Combine two functions that always call each other
2019-09-14 16:53:17 -07:00
Sebastian Waisbrot
e0aab79044 Support running ICE lite locally and on a remote
* Parse ice-lite property from remote SessionDescription
* Add option to SettingEngine that allows the local ICEAgent to run
  in lite mode
2019-09-12 11:42:16 -07:00
Hugo Arregui
6997cc792c Linter fixes
Disable funlen and some fixes

Co-authored-by: Sean DuBois <sean@siobud.com>
2019-09-10 21:48:25 -07:00
Cecylia Bocovich
25b173aac1 Allow gathering of candidates to generate offer
A change was recently made to the SetLocal and SetRemoteDescription
functions for PeerConnection that starts ICE gathering for the trickle
method only when generating an answer. This means clients generating an
offer to initiate signaling will stall indefinitely.
2019-09-05 17:15:56 -04:00
Hugo Arregui
ec6c432dc8 Add ICE transport and SCTP transport stats
bytes received, bytes sent
2019-08-22 18:31:17 +00:00
Aaron France
b5fd3ead93 Remove duplicated code in CreateDataChannel
options.Ordered is processed twice for no reason
2019-08-20 03:11:01 -07:00
Suhas Gaddam
f36c437056 Remove dupe of setup attribute in SDP creation
Before a:setup=actpass was showing up twice in each media description.
It is already being added in the addTransceiverSDP and
addDataMediaSection methods. This commit removes the extra call.
2019-08-13 23:17:16 -07:00
Sean DuBois
7f3000d9a6 Parse DTLS setup in SetRemoteDescription
Take into consideration if remote is running DTLS as a
client/server. Before we ignored this value and we could
enter cases where DTLS would never connect.

Resolves #494
2019-08-12 22:05:13 -07:00
Hugo Arregui
d64f1008de Offer sdp setup=actpass for datachannel
Fixes https://github.com/pion/webrtc/issues/686
2019-08-09 12:25:20 -07:00
Sean DuBois
0d585106c0 Add examples/play-from-disk
Using IVFReader demonstrate how users can stream a video
from hard disk to browser.

Relates to #636
2019-08-08 16:44:50 -07:00
Mike Coleman
4095d2cde9 Fix for Safari and latest Firefox
This fixes the echo program so it works properly on Safari
and Firefox, where the preferred offered dynamic media type
is not 96/VP8. It loads MediaEngine with codecs found in the
offer and then uses the payload type of the offer's preferred
video codec in the answer.
2019-08-07 11:53:42 -07:00
Hugo Arregui
7c18bbccee Add ToJSON ICECandidate method
With this change we can always exchange ICECandidateInit when signaling
2019-07-31 12:44:22 +00:00
Rafael Viscarra
1464ad4131 Implemented AddTransceiverFrom* methods
This allows to have SendOnly transceivers while keeping the API
relatively consistent with the browser's
2019-07-31 01:57:17 -06:00
Sean DuBois
b205912701 Ticket SCTP TODOs
Currently we log some errors that should stop the PeerConnection
Also get rid of port value, this doesn't have any value for
us

Relates to #106
2019-07-27 09:35:55 -07:00
Sean DuBois
8dfbafbcdd Update TODOs around multiple certificates
We are blocked by pion/dtls not support multiple certificates.
I have created an issue in GitHub issues for WebRTC and DTLS

Relates to #106
2019-07-27 09:35:55 -07:00
Sean DuBois
6d9bffeaa7 Remove resolved TODO from WriteRTCP
This behavior is fine. RTCP is lossy communication, so the caller
should should be ready to send packets multiple times if reception
is mandatory

Relates to #106
2019-07-27 09:35:55 -07:00
Sean DuBois
2f4049b15a Replace TODOs in PeerConnection with issues
Update all TODOs with issues in github

Relates to #106
2019-07-22 21:31:39 -07:00
Sean DuBois
775a521176 Don't store transceiver MID
These are generated at runtime (depending if we are doing Plan-B or
Unified Plan). Currently this field is actually unused, so just getting
rid of it.

Relates to #106
2019-07-22 21:31:39 -07:00
Sean DuBois
584bd651c1 Delete unimplemented stubs
We will implement these eventually, but for now just delete them.
We need to explore how we can automatically figure out what parts
of WebRTC we haven't implemented yet.

Relates to #106
2019-07-22 21:31:39 -07:00
Sean DuBois
9e4b41838e Remove no-op code from shutdown
Don't manually set the ICEConnectionState in Close. This
value is being set by pion/ice when we call Close on it already

Relates to #106
2019-07-22 21:31:39 -07:00
Sean DuBois
2228e7f61e Add custom-logger example
Demonstrate how users can user their own logger via the
SettingEngine

Resolves #726
2019-07-11 20:24:07 +01: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
Hugo Arregui
93261960b1 Basic stats
Load DC, CandidatePair and Candidate basic stats
2019-06-25 19:36:57 +00: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
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
mchlrhw
dc49947963 Fix panic in openSRTP
Implement fix by logging and bailing out if the local description has
not been set by the time we start receiving data from the other peer.

Fixes #563
2019-06-18 10:30:36 +01: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
Sean DuBois
0d773a38f6 Don't error when no candidate pairs
Fix inconsistency with error handling when we have no candidate pairs.
Before we had custom code in RTP handling that would discard errors
if it was because we had no candidate pairs. Move this logic into the
mux so we have consistent behavior with Datachannels

This can be expected and is a soft failure. Every subsystem is expected
to handle lossy communication.

Resolves #706
2019-06-08 17:51:18 -07:00
Konstantin Itskov
8c7f769e86 Fix race issue caused by multiple gathering
resolves #707
2019-06-07 20:05:55 -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
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
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
b2049be130 Support ICETransportPolicy
Add support for ICETransportPolicy and ICEGatherPolicy for ORTC
2019-05-26 00:54:43 -07:00
Sean DuBois
85a1602698 Populate incoming Label/ID
Populate the Label/ID for incoming tracks. Before we
emitted them to the user with empty values

Resolves #670
2019-05-12 00:55:37 -05:00
Sean DuBois
bf8502ef02 AddTrack now creates SendRecv Transceiver
Before we incorrectly created a Sendonly transceiver
2019-05-06 00:35:36 -07:00
Adam Kiss
7820ed0726 Fixed create data channel
Data channel creation checks if the sctp transport is already
established. Because this check was incorrect, in some cases it returned
an error instead of delaying opening the data channel until the sctp
connection is established. Fixed the check. Added locking to
CreateDataChannel to avoid race condition. Added test.
2019-04-24 11:11:06 -07:00
Christopher Fry
54c3a4c672 Allow remote Sendrecv to be used with Recvonly
Before our RTPTransceiver logic would only allow Sendrecv to
match with another Sendrecv. Instead allow a SendRecv to be used
with a local Recvonly

Co-authored-by: Sean DuBois <sean@siobud.com>
2019-04-18 21:32:10 -07:00
Sean DuBois
e8fe7aa48d Bump SRTP/RTCP and update RTCP API
Reading/Writing RTCP packets now return a slice

Relates to pion/srtp#29
2019-04-11 16:03:26 -07:00
Max Hawkins
8f1f2f0416 SDP: set port to 0 when rejecting m= lines
Fixes #616
2019-04-11 15:23:36 -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
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
Marouane
2eaa90b5f1 Fix CreateOffer
Append missing Key Group "BUNDLE"

Resolves #601
2019-04-08 09:54:05 -07:00
Sean DuBois
fc7a465150 Response now use the same mid value as the offer
When generating responses we were incorrectly using numeric mid values.
This works for Unified Plan offers, but was breaking Plan-B
2019-04-07 20:48:20 -07:00
Sean DuBois
dbde6114a2 Update import paths
Add /v2 to import paths everywhere
2019-04-07 02:17:15 -07:00
Sean DuBois
4c781e64d9 Return error on certificate fingerprint failure
Instead of printing the error to stdout return the error to the user.
This may not be a hard error (as later certificates would have passed)
but it never is good to be in a state where you have certificates in a
broken state.

Resolves #586
2019-04-05 00:48:22 -07:00
Sean DuBois
6e26cd208f Make SCTPTransport thread safe
Relates to #525
2019-04-04 21:28:37 -07:00
Sean DuBois
1cdfc10c84 Mass replace pions -> pion
Pions organization was renamed to pion
2019-04-04 15:32:03 -07:00