Commit graph

97 commits

Author SHA1 Message Date
Tommi
942cac2e9e Make deletion of Connection objects more deterministic.
This changes most deletion paths of Connection objects to go through
the owner class of the Connection instances, Port.

In situations where Connection objects still need to be deleted
asynchronously, `async = true` can be passed to
`Port::DestroyConnection` and get the same behavior as
`Connection::Destroy` formerly gave.

The `Destroy()` method still exists for downstream compatibility, but
instead of deleting connection objects asynchronously, the deletion
now happens synchronously via the Port class.

Bug: webrtc:13892, webrtc:13865
Change-Id: I07edb7bb5e5d93b33542581b4b09def548de9e12
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/259826
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36676}
2022-04-27 21:52:31 +00:00
Tommi
6b1d626b04 Remove deprecated ProxyConnection ctor and make NewWeakPtr protected.
Bug: webrtc:13892
Change-Id: Icad20a0f6d304c23106dd880f3bfd2c7142929c9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258601
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36583}
2022-04-20 10:14:17 +00:00
Peter Thatcher
4a2e0e5d45
Update to 4896 (M100) (#72) 2022-04-15 17:13:23 -06:00
Tommi
d229326578 [Connection] Replace pending_delete_ with !port_.
`pending_delete_` was being used to protect from referencing a
potentially bad `port_` pointer. We now use a WeakPtr for the port
reference, which we clear inside of the Destroy() method. This means
we don't need both flags.

Bug: webrtc:13892
Change-Id: I9427829444486e97d30752893ba2a30b153a70e5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258980
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36554}
2022-04-14 21:04:50 +00:00
Tomas Gunnarsson
f22dfdddfe Use std::function instead of sigslot for sending packets
Bug: webrtc:11943
Change-Id: I2df9908f5e2e2ded1f2c6fbf50ef415f73760b50
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258787
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36541}
2022-04-13 15:01:25 +00:00
Tommi
278b19da38 Rename variables of type StunMessage* from request to message.
This is just to reduce confusion since StunMessage and StunRequest
instances are frequently used together and message objects are often
configured from within request objects (which makes the name confusing).

Bug: none
Change-Id: I8bf5e774a5149239dd3023817614d411633bf583
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258484
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36533}
2022-04-12 12:52:08 +00:00
Tommi
86aa03e238 Refactor StunRequest and StunRequestManager classes.
* Make StunRequest::manager_ a reference, inject ref at ctor time.
* Make other member variables private.
* Mark methods that are only used for testing with "ForTest"
* Add RTC_GUARDED_BY for member variables and thread checks.
* Remove/reduce 'friend'-ness between classes.
* Use std::unique_ptr for owned and passed message pointers.
* Rename `requests_` to `request_manager_` (type: StunRequestManager)

Bug: webrtc:13892
Change-Id: I3a5d511b3c2645bb6813352d39e9fefe422dd1de
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258620
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36529}
2022-04-12 08:22:27 +00:00
Tommi
d7e5cfb3cf Use WeakPtr<Port> in Connection classes.
This is to aid with catching issues whereby a connection object might
have a bad reference back to a port object, e.g. inside of an async
callback.

Bug: webrtc:13892
Change-Id: I56503fedc2865919713b10f236ce023554c68ded
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/257164
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36394}
2022-03-31 12:44:02 +00:00
Tommi
a8bc137835 Avoid touching port_ in Connection::ToString() after starting delete.
Bug: webrtc:13865
Change-Id: Ia469c46642d7e305a50e57d9ea6ad873e633db4e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256808
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36338}
2022-03-25 13:39:44 +00:00
Tommi
824d8b0263 Don't Prune a to-be-deleted connection object
Bug: webrtc:13865
Change-Id: I87c18c8a1dfc0284bef1e721a56ad61ab89dc1c3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256680
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36320}
2022-03-24 14:29:03 +00:00
Jonas Oreland
340cb5e46a WebRTC-DeprecateGlobalFieldTrialString/Enabled/ - part 8/inf
Convert p2p/.
This completes work started in https://webrtc-review.googlesource.com/c/src/+/255602

Bug: webrtc:10335
Change-Id: I39f70890be0599c8ef46ff7982d2a229e10e67ff
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/255827
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36231}
2022-03-17 09:08:45 +00:00
Jim Gustafson
ad8014f0fd
Convert common error and warning logs to info severity 2022-03-15 18:34:43 -07:00
Tomas Gunnarsson
7c2e958711 Add a guard against double delete to Connection::Destroy
Bug: webrtc:13752
Change-Id: I80345fe2e560773f9f98f850def386ec53ae798f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/252660
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36085}
2022-02-25 23:43:03 +00:00
Mirko Bonadei
0cb1cfa69e Reland "Removing MessageHandler dependency from Connection."
This reverts commit 05ea12e513.

Reason for revert: Speculative revert.

Original change's description:
> Revert "Removing MessageHandler dependency from Connection."
>
> This reverts commit 3202e29f72.
>
> Reason for revert: Introduced a crash in the task posted by Destroy()
>
> Original change's description:
> > Removing MessageHandler dependency from Connection.
> >
> > Bug: webrtc:11988
> > Change-Id: Ic35bb5baeafbda7210012dceb0d6d5f5b3eb95c9
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/249941
> > Reviewed-by: Niels Moller <nisse@webrtc.org>
> > Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#35890}
>
> No-Try: True
> Bug: webrtc:11988
> Change-Id: Ie70ee145fde75b8cf76b02784176970e7a78e001
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/252541
> Auto-Submit: Taylor Brandstetter <deadbeef@webrtc.org>
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Owners-Override: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#36078}

No-Try: True
Bug: webrtc:11988
Change-Id: Idfd42d016e81d4352839c33dcb4ea3b0dafea08b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/252584
Owners-Override: Mirko Bonadei <mbonadei@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36081}
2022-02-25 11:01:54 +00:00
Taylor Brandstetter
05ea12e513 Revert "Removing MessageHandler dependency from Connection."
This reverts commit 3202e29f72.

Reason for revert: Introduced a crash in the task posted by Destroy()

Original change's description:
> Removing MessageHandler dependency from Connection.
>
> Bug: webrtc:11988
> Change-Id: Ic35bb5baeafbda7210012dceb0d6d5f5b3eb95c9
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/249941
> Reviewed-by: Niels Moller <nisse@webrtc.org>
> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#35890}

No-Try: True
Bug: webrtc:11988
Change-Id: Ie70ee145fde75b8cf76b02784176970e7a78e001
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/252541
Auto-Submit: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Owners-Override: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36078}
2022-02-25 10:41:13 +00:00
Tommi
3202e29f72 Removing MessageHandler dependency from Connection.
Bug: webrtc:11988
Change-Id: Ic35bb5baeafbda7210012dceb0d6d5f5b3eb95c9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/249941
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35890}
2022-02-02 16:32:20 +00:00
Tommi
9897649336 Thread checks for the Connection class.
Following [1], add many more checks for safe access to member variables.
This change is effectively a no-op, but landed separately from the
earlier change that's smaller but contains a fundamental assumption
gleaned from the implementation (and its use).

[1]: https://webrtc-review.googlesource.com/c/src/+/249942

Bug: webrtc:11988
Change-Id: I1568e2160c9faa6993c5b68044312f83d00e4815
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/249943
Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35850}
2022-01-31 12:11:37 +00:00
Tommi
cb01e5ecb2 Add checks for Connection construction/destruction.
Make sure that instances are always created+deleted on the
network thread.

Bug: webrtc:11988
Change-Id: I4fb5dd5bd14768d89ca78b348988a797fcdd130a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/249942
Reviewed-by: Niels Moller <nisse@webrtc.org>
Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35842}
2022-01-31 09:36:07 +00:00
Tommi
1bea008f9f Remove unused remote ice member from Connection
Bug: none
Change-Id: Ia80c362ca8cf0fb0ef63427e05131199b4685c6f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/249982
Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35837}
2022-01-31 08:02:13 +00:00
Artem Titov
d3251968d1 Prepare to rename RTC_NOTREACHED to RTC_DCHECK_NOTREACHED
Add implementation of RTC_DCHECK_NOTREACHED equal to the RTC_NOTREACHED.
The new macros will replace the old one when old one's usage will be
removed. The idea of the renaming to provide a clear signal that this
is debug build only macros and will be stripped in the production build.

Bug: webrtc:9065
Change-Id: I4c35d8b03e74a4b3fd1ae75dba2f9c05643101db
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/237802
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35348}
2021-11-15 21:44:59 +00:00
Taylor Brandstetter
79326eaca7 Implement missing candidate pair packets/bytes sent/received stats.
Specifically:
* packetsSent
* packetsReceived
* packetsDiscardedOnSend
* bytesDiscardedOnSend

Bug: webrtc:10569
Change-Id: Id92c20b93dea57637239a6321bd8aa644867f272
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/232961
Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35113}
2021-09-28 23:27:05 +00:00
Philipp Hancke
55542302b3 remove GICE-specific stun error code
GICE was removed around M42

BUG=webrtc:4299

Change-Id: I4e83a888c3ecc1681799c07b47b75c9f31b40baa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227348
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34680}
2021-08-09 13:48:52 +00:00
Artem Titov
2dbb4c9775 Use backticks not vertical bars to denote variables in comments for /p2p
Bug: webrtc:12338
Change-Id: Ie047b750cdf7ea2efe7a4632d18d5ed719c5ea83
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226952
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34570}
2021-07-27 18:51:02 +00:00
Harald Alvestrand
07d83c8a9a Modified STUN verification functions
The new verification makes verification a function on a message.
It also stores the password used in the request message, so that
it is easily accessible when verifying the response.

Bug: chromium:1177125
Change-Id: I505df4b54214643a28a6b292c4e2262b9d97b097
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/209060
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33366}
2021-03-02 10:34:17 +00:00
Jonas Oreland
3c5d5824a3 Add last_data_sent timestamp to Connection.
Add a timestamp for last data sent in Connection.

Move calling of rtc::TimeMillis() to Connection and remove it from RateTracker::AddSamples.

This timestamp will be used to further improve fail over logic.

BUG=None

Change-Id: I4cbc7693a0e081277590b9cb13264dc2a998202e

No-Try: True
Change-Id: I4cbc7693a0e081277590b9cb13264dc2a998202e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/197421
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32831}
2020-12-15 12:17:12 +00:00
Jonas Oreland
fa54364cea Update STUN attributes with latest IANA registrations
https://www.iana.org/assignments/stun-parameters/stun-parameters.xhtml

Bug: webrtc:0
Change-Id: Id3addf432abdfe0b5c236dc5b080e64744c18114
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/184341
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32113}
2020-09-16 11:13:14 +00:00
Artem Titov
edacbd53de Reland "Implement packets_(sent | received) for RTCTransportStats"
This is a reland of fb6f975401. Related
issue in chromium is fixed here:
https://chromium-review.googlesource.com/c/chromium/src/+/2287294

Original change's description:
> Implement packets_(sent | received) for RTCTransportStats
>
> Bug: webrtc:11756
> Change-Id: Ic0caad6d4675969ef3ae886f50326e4a2e1cbfe7
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178741
> Reviewed-by: Tommi <tommi@webrtc.org>
> Reviewed-by: Henrik Boström <hbos@webrtc.org>
> Commit-Queue: Artem Titov <titovartem@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#31643}

Bug: webrtc:11756
Change-Id: I1e310e3d23248500eb7dabd23d0ce6c4ec4cb8c6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178871
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31700}
2020-07-10 11:50:59 +00:00
Mirko Bonadei
9b35da880b Revert "Implement packets_(sent | received) for RTCTransportStats"
This reverts commit fb6f975401.

Reason for revert: Looks like this breaks chromium.webrtc.fyi:
https://ci.chromium.org/p/chromium/builders/webrtc.fyi/WebRTC%20Chromium%20FYI%20Mac%20Tester/6000
https://ci.chromium.org/p/chromium/builders/webrtc.fyi/WebRTC%20Chromium%20FYI%20Win10%20Tester/6209
https://ci.chromium.org/p/chromium/builders/webrtc.fyi/WebRTC%20Chromium%20FYI%20Win7%20Tester/6177
https://ci.chromium.org/p/chromium/builders/webrtc.fyi/WebRTC%20Chromium%20FYI%20Win8%20Tester/6299

Original change's description:
> Implement packets_(sent | received) for RTCTransportStats
> 
> Bug: webrtc:11756
> Change-Id: Ic0caad6d4675969ef3ae886f50326e4a2e1cbfe7
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178741
> Reviewed-by: Tommi <tommi@webrtc.org>
> Reviewed-by: Henrik Boström <hbos@webrtc.org>
> Commit-Queue: Artem Titov <titovartem@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#31643}

TBR=hbos@webrtc.org,tommi@webrtc.org,titovartem@webrtc.org

Change-Id: Icbb0974ba29cbddb614f1f37f8a2de1a7c56b571
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:11756
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178868
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31665}
2020-07-08 09:42:41 +00:00
Artem Titov
fb6f975401 Implement packets_(sent | received) for RTCTransportStats
Bug: webrtc:11756
Change-Id: Ic0caad6d4675969ef3ae886f50326e4a2e1cbfe7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178741
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31643}
2020-07-07 10:45:05 +00:00
Jonas Oreland
21433cae74 Add field trial to let idle connection live longer than 30s
A connection is currently deleted if it has not recevied anything for
30s. This patch adds a field trial that allows modifying this value
if no pings are outstanding.

The motivation for this is to experiment with pinging slower than
once per 30s in order to save battery.

Bug: webrtc:10282
Change-Id: I3272b9d68d44fc30379bd9a6c643db6b09766486
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/175005
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31239}
2020-05-13 13:20:09 +00:00
Jonas Oreland
08d1806e54 Extend rtc::AdapterType with 2g, 3G, 4G & 5G enum values.
This patch adds new enum values for different types of cellular
connections.

The new costs are currently blocked when sending to remote,
(so that arbitrary network switches does not starts occurring).

The end-game for this series to be able to distinguish between
different type of cellular connections in the ice-layer (e.g when
selecting/switching connections).

BUG: webrtc:11473
Change-Id: I587ac8fdff4f6cdd0f8905f327232f58818db4f6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/172582
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30970}
2020-04-02 07:48:36 +00:00
Philipp Hancke
e283d1ca64 add tcptype to prflx tcp candidates
Adds the missing tcptype to prflx tcp candidates as tcptype is mandatory per
RFC 6544 and if missing the candidate will contain double whitespace like this
  ... tcptype  generation ...
and will get rejected by the internal parser

BUG=webrtc:11423

Change-Id: Id61babd85cf43d56e9e6f9bf30d4cc9e00f00f60
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/170442
Reviewed-by: Taylor <deadbeef@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30959}
2020-04-01 09:43:35 +00:00
Jonas Oreland
ef60c2b0ad Implement Connection::ForgetLearnedState()
This patch adds a new ForgetLearnedState() method on a Connection.
The method, puts the connection into a state similar to
when it was just created.

- write_state = STATE_WRITE_INIT
- receving = false
- throw away all pending request
- reset RttEstimate

All other state is kept unchanged.

Note: It does not trigger SignalStateChange

A subsequent patch will expose the method to the IceController.

BUG: webrtc:11463
Change-Id: I055e8cd067e1bc4fd5ad64dd10f458554dbc87e3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/171805
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30916}
2020-03-27 08:24:43 +00:00
Steve Anton
f417238217 Remove iceRegatherIntervalRange
This was an ICE configuration experiment added a couple years ago that did not end up being used.

Bug: webrtc:11316
Change-Id: Iafb7e1c4f7b4598815f045808dbf6e470172f119
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/167680
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30395}
2020-01-28 19:16:18 +00:00
Jonas Oreland
219d8ce889 GOOG_PING: improve handshake
This patch improves handshake wrt GOOG_PING support so that
- if goog_ping_enable: sender send it's goog-ping version until it gets
STUN_BINDING_RESPONSE
- receiver only sends it's goog-ping-version if getting a
goog-ping-version in the request

This means that the overhead of STUN_ATTR_GOOG_MISC_INFO is only
- added on STUN_BINDING_REQUEST until a response is received.
- added on STUN_BINDING_RESPONSE if remote peer request it.

This is wire compatible with older versions so that
- new sender will enable GOOG_PING with new/old receiver.
- old sender will enable GOOG_PING with old receiver.
- old version will not enable GOOG_PING with new receiver
  (receiver expecting sender to announce first).

BUG: webrtc:11100
Change-Id: Ib3434c593988188150f4c7506918139aaf138d0c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/165787
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30269}
2020-01-15 16:09:38 +00:00
Jonas Olsson
b2b2031457 Concatenate string literals at compile time.
This CL was generated by running:
git ls-files | grep ".cc" | xargs perl -i -ne 'BEGIN {undef $/}; s/("[\s\n]*<<[\s\n]*")/" "/g; print;'; git cl format

After that I manually edited modules/audio_processing/gain_controller2.cc to preserve its original
formatting.

This primary benefit of this change is a small reduction in binary size.

Bug: None
Change-Id: I689fa7ba9c717c314bb167e5d592c3c4e0871e29
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/165961
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30251}
2020-01-14 14:47:48 +00:00
Jonas Oreland
9a52bd733c STUN PING request
This patch introduces a new type of STUN ping,
GOOG_PING_REQUEST/RESPONSE which is similar
to a STUN_BINDING but does not transmit any values.

The Connection class automatically sends these if
no STUN attributes has changed since last call to Connection::Ping()
if the remote peer has signaled that it supports it.

BUG=webrtc:11100

Change-Id: Ib1b590f0b90ca6cb56f2eb07cd62f976e246bc8c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/159961
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Taylor <deadbeef@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30062}
2019-12-11 14:23:30 +00:00
Jonas Oreland
d003662b15 Move SendBindingResponse to Connection
This patch moves the SendBindingResponse from Port
to Connection. This is a behavioural NOP, and I don't
understand why it was in Port in the firs place!

Found when working on GOOG_PING.

BUG=webrtc:11100

Change-Id: I0466c5381f08ec4926ca3380e6914f0bc0dfcf63
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161081
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29963}
2019-11-29 16:32:14 +00:00
Jonas Oreland
bfcb6c3f13 Add rtt estimate EventBasedExponentialMovingAverage to Connection
This patch estimates the connection RTT using
EventBasedExponentialMovingAverage. The half time is
set to 500 but can be modified using field trials.

This new metric is currently unused, but will
be used for exploration of of whether it can be used
instead of the existing metric.

Bug: webrtc:11140
Change-Id: I9db93e9b9eb932e3cd18935cd4ce0d90fc1cb293
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161000
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29944}
2019-11-28 09:24:44 +00:00
Jonas Oreland
98e745b302 make Connection::port() protected
This patch makes Connection::port() protected
and add explicit methods for the use cases instead
- network()     - port()->Network()
- generation()  - port()->generation()

This is done to easier mock a Connection.

BUG=webrtc:10647

Change-Id: I5b35477ed9f81d57cd871072874262d0a8af2d4c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160784
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29929}
2019-11-27 11:13:48 +00:00
Jonas Oreland
c6404a1f1d Add field trial to reduce STUN pings.
This patch adds field trials for limiting no of STUN pings
- max_outstanding_pings
send this count of outstanding pings (pings w/o any response),
after that never send any before a reply is received.

NOTE:
1) This patch redoes https://webrtc.googlesource.com/src.git/+/0d28972d8f0659ab90cef7fd59ca54fb122b71bc
which was put into the StunRequestManager.
But that mechanism is not used for STUN pings.

2) This patch build on field-trial-parser added in https://webrtc-review.googlesource.com/c/src/+/156083

Bug: webrtc:10282
Change-Id: If2f22d2b61a28598a3aa93781c9857145576b7a1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/156162
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Honghai Zhang <honghaiz@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29467}
2019-10-14 14:57:17 +00:00
Mirko Bonadei
317a1f09ed Use std::make_unique instead of absl::make_unique.
WebRTC is now using C++14 so there is no need to use the Abseil version
of std::make_unique.

This CL has been created with the following steps:

git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt
git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt
git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt

diff --new-line-format="" --unchanged-line-format="" \
  /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \
  uniq > /tmp/only_make_unique.txt
diff --new-line-format="" --unchanged-line-format="" \
  /tmp/only_make_unique.txt /tmp/memory.txt | \
  xargs grep -l "absl/memory" > /tmp/add-memory.txt

git grep -l "\babsl::make_unique\b" | \
  xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g"

git checkout PRESUBMIT.py abseil-in-webrtc.md

cat /tmp/add-memory.txt | \
  xargs sed -i \
  's/#include "absl\/memory\/memory.h"/#include <memory>/g'
git cl format
# Manual fix order of the new inserted #include <memory>

cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \
  xargs sed -i '/#include "absl\/memory\/memory.h"/d'

git ls-files | grep BUILD.gn | \
  xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d'

python tools_webrtc/gn_check_autofix.py \
  -m tryserver.webrtc -b linux_rel

# Repead the gn_check_autofix step for other platforms

git ls-files | grep BUILD.gn | \
  xargs sed -i 's/absl\/memory:memory/absl\/memory/g'
git cl format

Bug: webrtc:10945
Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 15:47:29 +00:00
Qingsi Wang
7627fdd68a Sanitize the address field of peer-reflexive remote candidates.
Per the latest WebRTC stats spec
(https://w3c.github.io/webrtc-stats/#dom-rtcicecandidatestats)
the address field of a peer-reflexive remote candidate should be concealed
until the same address is learnt via addIceCandidate.

This CL also refactors the sanitization-related code paths.

Bug: chromium:968161
Change-Id: I74c5da78232b2f604689867bda2937b8af827c4f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/149381
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Commit-Queue: Qingsi Wang <qingsi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28909}
2019-08-20 06:29:25 +00:00
Qingsi Wang
e5defb167a Sanitize the selected candidate pair in the public API.
The public API to obtain the selected candidate pair is changed to
GetSelectedCandidatePair in the ICE transport, and the returned pair
has address-sanitized candidates.

Bug: chromium:993878
Change-Id: I44f9d2385a84f9e22447108be2e57ef9e62671eb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/149080
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Commit-Queue: Qingsi Wang <qingsi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28869}
2019-08-15 18:36:35 +00:00
Qingsi Wang
e3cc4895c2 Add logging and edit the field trial name for piggyback ICE check
acknowledgement.

Bug: None
Change-Id: I46fd46c70f7652424a454d62ec63a86af9f085db
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/143000
Reviewed-by: Honghai Zhang <honghaiz@webrtc.org>
Commit-Queue: Qingsi Wang <qingsi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28326}
2019-06-19 22:35:47 +00:00
Qingsi Wang
0894f0fd76 Add piggyback acknowledgement of the last ICE check received in
outgoing checks.

This change adds an experimental feature to allow an ICE agent to embed
the transaction ID of the latest connectivity check received from the
remote peer, as an auxiliary acknowledgement in additional to the check
response, in its own checks. This could facilitate the establishment of
ICE connectivity if the check process has a high RTT.

Bug: None
Change-Id: If3e6327720f13beeb14f103af3b5ffb4f9692998
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/142682
Reviewed-by: Honghai Zhang <honghaiz@webrtc.org>
Commit-Queue: Qingsi Wang <qingsi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28316}
2019-06-19 06:27:52 +00:00
Jonas Oreland
e8e7d7b0bc Move Connection into it's own .h/.cc file.
This patch is a NOP and moves
- class Connection
- class ConnectionInfo
- class ProxyConnection

from port.{h/cc} to a new file called connection.{h/cc}

BUG=webrtc:10647

Change-Id: I89322d3421d272657e24a46b28ab6679fcdc9450
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/137509
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28101}
2019-05-29 11:27:47 +00:00