Commit graph

28 commits

Author SHA1 Message Date
Tommi
d1e577dd80 Mark cricket port type constants as deprecated
...and remove remaining references to them

Bug: webrtc:15846
Change-Id: Ica41c0d3cf7bc8698749a5ddb4b8f90a0c8c1162
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/343784
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41968}
2024-03-26 12:28:42 +00:00
Tommi
8ae894d924 Remove deprecated Candidate methods
Bug: webrtc:15846
Change-Id: Iba39a16f6f2b77599996af39216f41121f9b1c24
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/342020
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41925}
2024-03-19 07:29:07 +00:00
Christoffer Dewerin
7098d110e1 Revert "p2p: separate ICE tie breaker and foundation seed"
This reverts commit d99499abba.

Reason for revert: Breaks downstream projects and I can also repro locally when running the rtc_unittest test target (it does however pass in isolation indicating test cleanup/setup needs to be fixed)

Original change's description:
> p2p: separate ICE tie breaker and foundation seed
>
> BUG=webrtc:14626
>
> Change-Id: I189a708192c9cef0b50c3fcbe798b30376d3b547
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/338982
> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
> Commit-Queue: Philipp Hancke <phancke@microsoft.com>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#41806}

Bug: webrtc:14626
Change-Id: If45f8a33395c562c9388b3d3748e8566efa87ecb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/341081
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Jeremy Leconte <jleconte@google.com>
Commit-Queue: Christoffer Dewerin <jansson@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Owners-Override: Christoffer Dewerin <jansson@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41812}
2024-02-26 16:05:15 +00:00
Philipp Hancke
d99499abba p2p: separate ICE tie breaker and foundation seed
BUG=webrtc:14626

Change-Id: I189a708192c9cef0b50c3fcbe798b30376d3b547
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/338982
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41806}
2024-02-26 07:47:28 +00:00
Tommi
c7a4b2a7eb Change internal candidate type to enum
Bug: webrtc:15846
Change-Id: I66480cd2a239655a897af5ed2625959e8d6cc33a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/338644
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41802}
2024-02-25 23:46:52 +00:00
Tommi
f2431a97d5 Move ComputeFoundation to Candidate.
Move code from P2PTransportChannel to Candidate, where we set the
foundation value for remote prflx candidates.

Bug: none
Change-Id: I7dbcb85bca35dca7297136b0706092dd8d2b153c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/339902
Reviewed-by: Philipp Hancke <phancke@microsoft.com>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41774}
2024-02-21 09:24:32 +00:00
Tommi
bde80e3c0e Deprecate Candidate::set_id(), offer generate_id() instead
Bug: none
Change-Id: I68df28a24446667c1bcde04120795fce54252feb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/339940
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41762}
2024-02-19 15:01:02 +00:00
Tommi
0ba663c245 Change a few uses of Candidate::type() to Candidate::type_name()
Switch to type_name() for things like logging since `type()` will
change to returning an enumeration value.

The functional change that this has is that log statements and
Connection::ToString() (used for logging) will contain "host"
instead of "local" and "srflx" instead of "stun".

Bug: webrtc:15846
Change-Id: I35c50d026e4578a25d51765d59c6f2e01b850c94
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/339180
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41757}
2024-02-17 18:41:38 +00:00
Tommi
f7b22c66ff Add Candidate::type_name()
Candidate::type() is currently how the name of the type is fetched,
but that getter returns a non-standard type name.

Instead, I'm adding a new getter, type_name(), will follow up with
updating dependent code that needs the string, to use type_name (and
adapt to potential dependency on "local" or "stun") and then switch
type() to be enum based.

Also adding a test file for Candidate with a couple of basic tests to
start with.

Bug: webrtc:15846
Change-Id: I9b78b2405a9f962a3c07eaa8e72a79854c6f5ceb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/339660
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41740}
2024-02-15 10:26:28 +00:00
Tommi
521b8632b6 Change type of candidate type names from char[] to string_view
Bug: none
Change-Id: I57fcfd486bf4e2fb15288614b0e81f00b10e120a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/337443
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41721}
2024-02-12 15:14:02 +00:00
Tommi
3b2b2afdaa Move candidate types from port to candidate.h
Add is_* getters to check candidate type without using the string constants directly.

Bug: none
Change-Id: I82c83c032a30a1c67de2d5d6168ecc04e0254318
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/334800
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41568}
2024-01-19 09:24:37 +00:00
Philipp Hancke
ea06be2682 candidate: do not log full IP addresses for related address
since this may contain sensitive data, just like the address.

BUG=None

Change-Id: I3faa1512a15467cd5cc4bcbcaebadb736f1bae07
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/313040
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40473}
2023-07-25 17:19:25 +00:00
Philipp Hancke
17ec0569c6 ICE: adjust priority of non-relay candidates
Introduces a field trial
  WebRTC-IncreaseIceCandidatePriorityHostSrflx
that adjusts the priority of non-relay candidates such that the STUN priority attribute calculated as
  (prflx-type-preference << 24) | (priority & 0x00FFFFFF)
as described in
  https://www.rfc-editor.org/rfc/rfc5245#section-7.1.2.1
will satisfy the condition that the STUN priority of server-reflexive candidates will always be higher than the STUN priority of relay candidates.

Previously this was not the case because the TURN relay preference was added to the local_preference for relay candidates, making it higher than the local_preference of srflx candidates gathered from the same interface.
This led to cases where the resulting candidate pair priority of a srflx-relay pair was higher than the candidate pair priority of a srflx-srflx pair, i.e. using a TURN server in cases that work using a direct P2P connection.

Whether the field trial is active can be observed by checking that
  priority-of-srflx-candidate&0x00FFFFFF
is greater than
  priority-of-relay-candidate&0x00FFFFFF

BUG=webrtc:13195,webrtc:5813,webrtc:15020

Change-Id: Ib91708fbe7310b6454f93158a45c9d77da009091
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/292700
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#40311}
2023-06-20 08:02:27 +00:00
Byoungchan Lee
5a92577a94 Remove fields from remote candidates that could cause crashes in GetStats
Typically, remote candidates come from signalling and are deserialized
into C++ objects. The network_type field of these candidates is
always ADAPTER_TYPE_UNKNOWN.

However, in tests it is common to pass SDP and remote candidates as C++
objects. In this case, the network_type property of remote candidates
is preserved, so DCHECK might be triggered when GetStats is called.

Clearing fields that are not suitable as remote candidates fixes
this issue.

Bug: None
Change-Id: Ida01b0224bce5cf3e87bcad1ddaca35c9f4fffe7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279680
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Auto-Submit: Daniel.L (Byoungchan) Lee <daniel.l@hpcnt.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38436}
2022-10-19 08:06:23 +00:00
Philipp Hancke
ee4c930b4e ice: fix comment about relay preference
BUG=webrtc:13195

Change-Id: I86b0ff259cec7d2dc95ba5d7ae1022aca4dcb01c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/233260
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35123}
2021-09-30 07:45:19 +00:00
Niels Möller
d4aa3a3196 Use absl::string_view in SDP-related utilities
A step towards reduced copying in SDP parsing.

Bug: None
Change-Id: I3a5d89f483c1809929b7160b563c67b040c9df41
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/233080
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35122}
2021-09-30 07:44:09 +00:00
Artem Titov
0e61fdd27c Use backticks not vertical bars to denote variables in comments for /api
Bug: webrtc:12338
Change-Id: Ib97b2c3d64dbd895f261ffa76a2e885bd934a87f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226940
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34554}
2021-07-26 18:27:34 +00:00
Harald Alvestrand
e3ceb88c72 Sanitize hostname literals when mDNS obfuscation is on.
Also applies sanitizing to prflx candidates, not just local ones.
Also add tests for the port allocator Sanitize function.

Bug: chromium:1218346
Change-Id: Ifbc7843cd6e289c09ca72b6ec610a34bbbf7e04e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/222581
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34292}
2021-06-15 14:41:46 +00:00
Steve Anton
10542f21c8 (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries
Mechanically generated by running this command:

tools_webrtc/do-renames.sh update all-renames.txt && git cl format

Then manually updating:

tools_webrtc/sanitizers/tsan_suppressions_webrtc.cc

Bug: webrtc:10159
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I54824cd91dada8fc3ee3d098f971bc319d477833
Reviewed-on: https://webrtc-review.googlesource.com/c/115653
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26226}
2019-01-11 17:11:39 +00:00
Qingsi Wang
1dac6d8839 Sanitize candidates in ICE-level stats when necessary.
The address and the related address of local candidates are sanitized
accordingly when the mDNS concealment of local IPs is enabled. Also,
remote hostname candidates created from signaling are sanitized in stats
as well. A couple of unit tests are revised to reflect the desired
behavior of AsyncResolverInterface so that when a hostname candidate is
resolved, the hostname is kept in the candidate address.

Bug: webrtc:9605, chromium:914452
Change-Id: Iad9ad04ce4e50304e44cf04b15b97a7ae2dec960
Reviewed-on: https://webrtc-review.googlesource.com/c/113643
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Reviewed-by: Jeroen de Borst <jeroendb@webrtc.org>
Commit-Queue: Qingsi Wang <qingsi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25996}
2018-12-13 00:27:33 +00:00
Yves Gerey
988cc0870b [Cleanup] Add missing #include. Remove useless ones.
This CL is the result of running include-what-you-use tool on part
of the code base (audio target and dependencies) plus manual fixes.

bug: webrtc:8311
Change-Id: I277d281ce943c3ecc1bd45fd8d83055931743604
Reviewed-on: https://webrtc-review.googlesource.com/c/106280
Commit-Queue: Yves Gerey <yvesg@google.com>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25311}
2018-10-23 11:32:56 +00:00
Yves Gerey
2e00abc98e Reland "[cleanup] Remove useless includes."
Reason for reland: Downstream project fixed.

Original change's description:

> [cleanup] Remove useless includes.
>
> Manual cleanup guided by include-what-you-use diagnostic.
>
> Bug: webrtc:8311
> Change-Id: I00be03392cc7ee005101427ea7dc701621ccea68
> Reviewed-on: https://webrtc-review.googlesource.com/c/103320
> Commit-Queue: Yves Gerey <yvesg@webrtc.org>
> Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#25013}

Bug: webrtc:8311
Change-Id: Id6ec4aeb798886a90ace640a190eaf16497ba31b
Reviewed-on: https://webrtc-review.googlesource.com/c/104120
Commit-Queue: Yves Gerey <yvesg@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25034}
2018-10-08 07:44:19 +00:00
Oleh Prypin
96a0f61917 Revert "[cleanup] Remove useless includes."
This reverts commit be8b5348c7.

Reason for revert: Breaks downstream project

Original change's description:
> [cleanup] Remove useless includes.
> 
> Manual cleanup guided by include-what-you-use diagnostic.
> 
> Bug: webrtc:8311
> Change-Id: I00be03392cc7ee005101427ea7dc701621ccea68
> Reviewed-on: https://webrtc-review.googlesource.com/c/103320
> Commit-Queue: Yves Gerey <yvesg@webrtc.org>
> Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#25013}

TBR=phoglund@google.com,phoglund@webrtc.org,yvesg@webrtc.org

Change-Id: I7a6e1cdfef685173b76f234ad598083043dcd9a0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8311
Reviewed-on: https://webrtc-review.googlesource.com/c/104022
Reviewed-by: Oleh Prypin <oprypin@webrtc.org>
Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25015}
2018-10-05 13:13:45 +00:00
Yves Gerey
be8b5348c7 [cleanup] Remove useless includes.
Manual cleanup guided by include-what-you-use diagnostic.

Bug: webrtc:8311
Change-Id: I00be03392cc7ee005101427ea7dc701621ccea68
Reviewed-on: https://webrtc-review.googlesource.com/c/103320
Commit-Queue: Yves Gerey <yvesg@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25013}
2018-10-05 11:51:06 +00:00
Jonas Olsson
84df1c724e Make fewer copies when using StringBuilder.
Replace calls to .str() which copies with .Release which moves in cases where that's safe.

This CL was generated by this command:
git grep -l 'StringBuilder' |
xargs perl -i -0 -pe "s/(rtc::StringBuilder (\S+);.*?return )\\g2.str\(\)/\$1\$2.Release\(\)/sg"

Bug: webrtc:8982
Change-Id: If4dadbeb039df010aaaa9e58da81c1971a84fe8f
Reviewed-on: https://webrtc-review.googlesource.com/100307
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24790}
2018-09-24 09:39:19 +00:00
Jonas Olsson
366a50c4ef Remove simple stringstream usages.
This CL replaces std::o?stringstream with rtc::StringBuilder where that's possible to do without changing any of the surrounding code. It also updates includes and build files as appropriate.

The CL was generated by running 'git grep -l -P std::o?stringstream | xargs perl -pi -e "s/std::o?stringstream/rtc::StringBuilder/g"'. Then I've manually updated the #includes and BUILD files, run 'git cl format' and unstaged any file that would need more complex fixes.

Bug: webrtc:8982
Change-Id: Ibc32153f4a3fd177e260b6ad05ce393972549357
Reviewed-on: https://webrtc-review.googlesource.com/98460
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24605}
2018-09-06 12:53:19 +00:00
Jonas Olsson
abbe841721 This CL removes all usages of our custom ostream << overloads.
This prepares us for removing them altogether.

Bug: webrtc:8982
Change-Id: I66002cc8d4bf0e07925766d568d2498422f0f38e
Reviewed-on: https://webrtc-review.googlesource.com/64142
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Henrik Grunell <henrikg@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22707}
2018-04-03 12:51:00 +00:00
Steve Anton
36b28db887 Fix clang style warnings in api/candidate.h
Bug: webrtc:163
Change-Id: I694194d34573b1f2e4769bf52ec861127940d017
Reviewed-on: https://webrtc-review.googlesource.com/15940
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20454}
2017-10-26 23:22:18 +00:00