Commit graph

13 commits

Author SHA1 Message Date
Florent Castelli
8037fc6ffa Migrate absl::optional to std::optional
Bug: webrtc:342905193
No-Try: True
Change-Id: Icc968be43b8830038ea9a1f5f604307220457807
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361021
Auto-Submit: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42911}
2024-09-02 12:16:47 +00:00
Harald Alvestrand
a310d78662 Refactor a lot of the p2p:rtc_p2p target
This CL splits many of the source files in p2p:rtc_p2p into individual
compile targets.

One target - connection_and_port - was left with multiple source files
because it was too tangled to detangle at once.

Bug: webrtc:15796
Change-Id: I607417e5945306ef64335f40a0ae50f0d15dee6f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/335881
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41611}
2024-01-25 18:28:27 +00:00
Daniel Cheng
e125a3371f Add IceControllerInterface::GetConnections() and fix return type.
This is a replacement for `connections()`, which is const-qualified but
returns a `rtc::ArrayView<const cricket::Connection*>`. Unfortunately,
this is a view of mutable pointers to `const cricket::Connection`
objects: this means that the pointers in `IceControllerInterface`'s
backing store can be reassigned.

Returning `rtc::ArrayView<const cricket::Connection* const>` is more
consistent with how a view returned from a const-qualified method should
behave. Unfortunately, there are downstream overrides of this method, so
instead of just fixing this outright, add a new method with the correct
return type. Once downstream is updated, the old method can then be
removed.

Bug: chromium:1409870, webrtc:15702
Change-Id: I3d8f0c2f0bcf4c393ee63959cb61761ac00a28ab
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/329962
Reviewed-by: Jonas Oreland <jonaso@google.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#41318}
2023-12-05 14:56:51 +00:00
Manashi Sarkar
c925f50c1c Revert "Correctly const-qualify return value of IceControllerInterface::connections()."
This reverts commit ad631f0d35.

Reason for revert: error: virtual function 'connections' has a different return type ('ArrayView<const cricket::Connection *>') than the function it overrides (which has return type 'ArrayView<const Connection *const>')

Original change's description:
> Correctly const-qualify return value of IceControllerInterface::connections().
>
> This is intended to be a read-only view across a container of const
> Connection*, but due to the missing const, elements of the container
> could actually be re-assigned through the ArrayView.
>
> This was discovered when trying to roll Googletest, since Googletest was
> fixed to const-qualify converting actions:
> cbca6bc395
>
> Bug: chromium:1409870
> Change-Id: Iadd3abe6807111987e422b8510a23f2a4f7026ed
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/329481
> Auto-Submit: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Daniel Cheng <dcheng@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#41300}

Bug: chromium:1409870
Change-Id: Id0026eb7727a3d1408045d0040b3b080cca07832
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/329762
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Manashi Sarkar <manashi@google.com>
Cr-Commit-Position: refs/heads/main@{#41307}
2023-12-04 13:18:37 +00:00
Daniel Cheng
ad631f0d35 Correctly const-qualify return value of IceControllerInterface::connections().
This is intended to be a read-only view across a container of const
Connection*, but due to the missing const, elements of the container
could actually be re-assigned through the ArrayView.

This was discovered when trying to roll Googletest, since Googletest was
fixed to const-qualify converting actions:
cbca6bc395

Bug: chromium:1409870
Change-Id: Iadd3abe6807111987e422b8510a23f2a4f7026ed
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/329481
Auto-Submit: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#41300}
2023-12-02 23:54:21 +00:00
Sameer Vijaykar
781c12e7fb Reland "Refactor IceControllerEvent" 2/n
This is a partial reland of commit 794e68cf3d
which uses the new enum in P2PTransportChannel and BasicIceController.

Original change's description:
> Refactor IceControllerEvent
>
> This change is the first step in decoupling IceControllerEvent from
> the ICE switch reason. Further cleanup is earmarked, and will be
> landed after some internal cleanup.
>
> This change
> - adds a new enum - IceSwitchReason
> - adds a member for the new enum in IceControllerEvent
> - uses the new enum within P2PTransportChannel
> - adds methods to IceControllerInterface accepting the new enum
> - deprecates usages of the old enum in IceControllerInterface
> - adds conversion between the old and new enums for compatibility
>
> Bug: webrtc:14125, webrtc:14131
> Change-Id: I5b7201c3f631eb40db334dfeec842841a7e58174
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/264140
> Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
> Commit-Queue: Sameer Vijaykar <samvi@google.com>
> Cr-Commit-Position: refs/heads/main@{#37051}

Bug: webrtc:14125, webrtc:14131
Change-Id: I81b0338ae2f0560cd3df7ad9bd9af37e7c3499df
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/264554
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Cr-Commit-Position: refs/heads/main@{#37105}
2022-06-03 07:42:03 +00:00
Sameer Vijaykar
9453e5f4b3 Revert "Refactor IceControllerEvent"
This reverts commit 794e68cf3d.

Reason for revert: Possibly breaks downstream project

Original change's description:
> Refactor IceControllerEvent
>
> This change is the first step in decoupling IceControllerEvent from the
> ICE switch reason. Further cleanup is earmarked, and will be landed
> after some internal cleanup.
>
> This change
> - adds a new enum - IceSwitchReason
> - adds a member for the new enum in IceControllerEvent
> - uses the new enum within P2PTransportChannel
> - adds methods to IceControllerInterface accepting the new enum
> - deprecates usages of the old enum in IceControllerInterface
> - adds conversion between the old and new enums for compatibility
>
> Bug: webrtc:14125, webrtc:14131
> Change-Id: I5b7201c3f631eb40db334dfeec842841a7e58174
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/264140
> Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
> Commit-Queue: Sameer Vijaykar <samvi@google.com>
> Cr-Commit-Position: refs/heads/main@{#37051}

Bug: webrtc:14125, webrtc:14131
Change-Id: Ie6c4dea0f9007f78ce2bf1ee4e6b1dbca08f3142
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/264505
Auto-Submit: Sameer Vijaykar <samvi@google.com>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37059}
2022-05-31 11:59:35 +00:00
Sameer Vijaykar
794e68cf3d Refactor IceControllerEvent
This change is the first step in decoupling IceControllerEvent from the
ICE switch reason. Further cleanup is earmarked, and will be landed
after some internal cleanup.

This change
- adds a new enum - IceSwitchReason
- adds a member for the new enum in IceControllerEvent
- uses the new enum within P2PTransportChannel
- adds methods to IceControllerInterface accepting the new enum
- deprecates usages of the old enum in IceControllerInterface
- adds conversion between the old and new enums for compatibility

Bug: webrtc:14125, webrtc:14131
Change-Id: I5b7201c3f631eb40db334dfeec842841a7e58174
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/264140
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Cr-Commit-Position: refs/heads/main@{#37051}
2022-05-31 07:32:54 +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
Jonas Oreland
2f3c01941b Modify IceControllerInterface::SelectConnectionToPing - step 1
this is a NOP refactoring, that modify return type
of IceControllerInterface::SelectConnectionToPing to a struct
(rather than existing pair). The modification is done
so that one can safely add new return values in the struct.

Step 1) Create a typedef for return value.
- merge downstream and change it to start using new type.
Step 2) Change typedef to struct,
adding constructors from old type to new type
merge and change downstream to use "real" constructors
Step 3) remove temporary constructors
Step 4) Eat cake

Each step requires a merge downstream, with corresponding
changes there.

Bug: chromium:1024965
Change-Id: I6ebb8658a77e0ef5c24acb382c0cb6413403c168
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/171691
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30902}
2020-03-26 13:33:05 +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
2f74d5f793 Make IceController injectable
This patch is a follow up on
- https://webrtc-review.googlesource.com/c/src/+/158820
- https://webrtc-review.googlesource.com/c/src/+/158205

And makes the IceController injectable into P2PTransportChannel.
This is useful so that one can only modify the behaviour of the
the controller and still use the rest of the functionality of
P2PTransportChannel.

Bug: chromium:1024965
Change-Id: I36a1bc5cb4a60da46935ce8e4ce43e3bbbfeaf6d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160188
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29882}
2019-11-22 19:45:32 +00:00
Jonas Oreland
09c452e7ba Split P2PTransportChannel
This patch moves the logic for
- selection of connection to ping
- selection of connection to use
- selection of connection to prune

into own file and puts it behind a new interface called 'IceControllerInterface'.

BUG=webrtc:10647

Change-Id: I10228b3edd361d3200fa4a734d74a319560966c9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158205
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Reviewed-by: Honghai Zhang <honghaiz@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29850}
2019-11-20 19:35:45 +00:00