Commit Graph

320 Commits

Author SHA1 Message Date
Sean DuBois
912779df43 Change incoming orphaned SSRC log level
Move this from Error -> Warn. Now that re-negotiation has landed users
will see this a lot more, and it isn't helpful by default. We still want
this message in case users are trying to debug if an OnTrack isn't
fired.
2020-03-09 22:51:46 +08: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
dfde058009 Put application media section first
When offering always put application first. Before during re-negotation
we would break the order if media sections because we would always place
it last. Instead of remembering what order the application was place
just always place it first.

Resolves #1055
2020-02-27 23:20:09 -08:00
Jorropo
8fe6f7fa34 Adding documentation about OnICECandidate
Follow up to #1051.
2020-02-26 20:30:15 -08:00
Guilherme
4541f49b80 Fix race in PeerConnection.ConnectionState
The data race detector detects a race if
PeerConnection.ConnectionState is called while
PeerConnection.updateConnectionState is changing
the connection state
2020-02-20 11:37:48 -08: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
0652581dd1 Add test for multi-track PlanB signaling
SDP parsing only supported one ssrc per media section.
Now we properly can handle multiple.

Resolves #1014
2020-02-11 13:15:41 -08:00
Sean DuBois
f39a6c6c1f Fix race in PeerConnection.setDescription
Resolves #1012
2020-02-09 22:21:45 -08:00
Sean DuBois
0b8bdebeeb Make RTPTransceiver thread safe
Sender, Receiver and Direction are now atomics with functions
for getters and setters

Relates to #207
2020-02-09 21:40:37 -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
Sean DuBois
6847421118 Implement Adding tracks after signaling
Relates to #207
2020-02-09 21:40:37 -08:00
Sean DuBois
53014d3eb8 Move SDP code into dedicated file
Remove some duplication that makes re-negotiation harder.
By splitting parsing of inbound SDP and creation of outbound
it makes the next step a lot easier.

Relates to #207
2020-02-09 21:40:37 -08:00
Sean DuBois
f1ffb81649 Remove code duplication in track/transceiver code
Have AddTrack call transceiver code. Also update AddTransceiverFromKind
to call AddTransceiverFromTrack

Relates to #207
2020-02-09 21:40:37 -08:00
Atsushi Watanabe
27d9bbb7bd Upgrade golangci-lint to 1.19.1
Fix whitespace and stylecheck errors.
Disable godox.
2020-01-11 22:59:33 -08:00
adwpc
da03cb4a4d RTP codec and sdp support transport-cc
RTP codec and sdp support transport-cc
2020-01-08 22:31:56 +08:00
adwpc
bac0c492a9 Sdp support transport-cc
Sdp support transport-cc
2020-01-08 22:31:56 +08:00
Lukas Herman
8cd3fdc980 Expose an API to get registered RTPCodec list
Add a new public method, GetRegisteredRTPCodecs, under PeerConnection
to allow access to get the registered list of RTPCodec from the
underlying MediaEngine for developers who want to build libraries on
top of pion.

Resolves #966
2020-01-05 21:13:45 -08:00
Sean DuBois
77c6e3b827 Properly sanitize STUN urls
Currently we error if a STUN URL passed to Configuration.ICEServers
contained a query parameter. Fix this by using the getICEServers
function that sanitizes these for us.
2019-12-11 00:18:39 -08:00
Yutaka Takeda
7d99edd21a Added logging throughput
Resolves #778
2019-12-08 01:03:17 -08:00
Sean DuBois
bba6460597 Allow user to Close DataChannel before signaling
Match W3C WebRTC and allow a DataChannel to close even before
signaling happens. When SCTPTransport opens make sure
to check the readyState first.
2019-11-25 17:18:47 -08:00
Sean DuBois
1c32bc9a46 Properly set DataChannel readyState on Close
DataChannel readyState should be set to Closed on PeerConnection
shutdown. If not properly set it would attempt to interact with
state that doesn't exist after the PeerConnection has been Closed.

Setting the readyState is also clearly defined in the W3C webrtc-pc

Resolves #915
2019-11-22 18:06:43 -08:00
Sean DuBois
36b02632d1 Match W3C when closing
PeerConnection.Close() doesn't match the W3C RFC on closing,
re-order the transports so that they close in the proper order.

In the future we will use the DTLS Close alert and RTCP Bye to
better communicate shutdown
2019-11-21 11:55:48 -08:00
Sean DuBois
b5154b499e Only create ICEGather via API
Use values directly from SettingValues instead of just copying
when calling NewICEGatherer. This greatly reduces the LoC and makes
the public API a little cleaner.

Resolves #872
2019-11-21 11:18:05 -08:00
Sean DuBois
721b342e2e Properly generate DataChannel streamId
Before we computed DataChannel IDs before signaling, this
is incorrect because IDs must take into account if we are
running an DTLS Client or Server.

This updates the DataChannel ID generation code to take this
into account before generating a streamId.

Resolves #908
2019-11-14 10:51:05 -08:00
Sean DuBois
7584762124 Expose Answering DTLSRole via SettingEngine
User can now control what DTLSRole the local client
takes when answering via the SettingEngine.

Relates to #880
2019-10-22 01:11:21 -07:00
Sean DuBois
c6ad8c78ea Handle undeclared SSRCes
If we receive an unknown SSRC and we have a single
media section with no SSRCes declared fire an OnTrack
with that stream

Resolves #880
2019-10-20 02:05:43 -07:00
Vicken Simonian
5f25df2209 Various spell fixes
For error types, vars, docs and comments
2019-10-17 23:31:21 -07:00
Sean DuBois
92867d3de6 Support negotiated DataChannels in Go
Relates to #748
2019-09-28 22:34:57 -07:00
Sean DuBois
d692ddfa54 Support DataChannel protocol in Go
Relates to #748
2019-09-27 16:19:49 -07:00
Chris Hiszpanski
69dffdf4b5 Fix answer bundle for rejected media
When rejecting media, the identification-tag (i.e. media ID) must
be removed from the bundle in addition to setting the m-line port
to zero.
2019-09-26 19:35:55 -07:00
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