To address the limitations of select(), poll() is now used for Apple
(MacOS and iOS) systems in the PhysicalSocketServer.
Bug: webrtc:15421, webrtc:15908
Change-Id: Ic6703a08653ca608a714ea37ecbbfeaf29743c1f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/316480
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Daniel.L (Byoungchan) Lee <daniel.l@hpcnt.com>
Cr-Commit-Position: refs/heads/main@{#42075}
Two new socket options are introduced OPT_SEND_ECN used for setting ECN bits. OPT_RECV_ECN used for reading the ECN bits.
If ECN bits are set on received IP packets, ECT(1) and CE is propagated via rtc::ReceivedPacket.
Bug: webrtc:15368
Change-Id: I3ac335007e2f7d30564569bbc80ce47fa541bef1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/332380
Reviewed-by: Jonas Oreland <jonaso@google.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41885}
And RTC_CHECK(NOTREACHED) Socket::RecvFrom(void* pv..)
This cl also change usage of PhysicalSocket to use PhysicalSocket::RecvFrom(ReceivedBuffer&) in Nat and tests.
Note that Socket::RecvFrom(ReceiveBuffer& buffer) is already used in AsyncUdpSocket.( https://webrtc-review.googlesource.com/c/src/+/332200)
AsyncTCPSocket uses Socket::Recv(). Therefore, there should be no production usage left of Socket::RecvFrom(void* pv..) in open source webrtc.
Follow up cls should remove usage of Socket::RecvFrom(void* pv..) in implementations of rtc:AsyncSocketAdapter such as FirewallSocketAdapter.
Change-Id: I597dc32b14be98e954a3dc419723f043e8a7e19e
Bug: webrtc:15368
Change-Id: I597dc32b14be98e954a3dc419723f043e8a7e19e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/332341
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41635}
To be submitted after downstream usage has been removed, but no earlier than December 1, 2023.
Bug: webrtc:12598
Change-Id: Id9acbac591c48c0c5883fe8f06cf6a68471b70f0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/323004
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41290}
This removes internal usage of AsyncResolver, including from
PhysicalSocketServer.
PhysicalSocketServer was also run through IWYU.
Bug: webrtc:12598
Change-Id: I18aa6fb60e4a40face4afa0446a161379470680d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/322721
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40900}
Fuchsia's libc provides `select` and `poll` but not `epoll`.
This CL adds a `WaitPoll` method, which is modeled after `WaitSelect` but uses `poll`. The pre-existing `WaitPoll` method was renamed to `WaitPollOneDispatcher`.
TESTED="2p video call on Fuchsia. WaitPoll is faster compared to
WaitSelect, primarily because WaitSelect pessimistically calls
getsockopt(SO_ERROR) on each fd, while WaitPoll does so only on fds that
have entered an error state."
Original author: tombergan@google.com
Bug: None
Change-Id: I83cc824fca40d691fd93712c1c933ff21b3f877c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/296826
Reviewed-by: Markus Handell <handellm@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Tom Bergan <tombergan@google.com>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39564}
Using ::recvmsg ensure packet timestamp can then be read directly when reading the buffer
instead of a separate system call and should also work on Ios/Mac.
The same experiment field trial flag will be "WebRTC-SCM-Timestamp/enabled/" and is also planned to be used for fixing webrtc:14066
Bug: webrtc:5773, webrtc:14066
Change-Id: I8a3749e87c686aa18fcee947472c1b602a0f63c8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279280
Reviewed-by: Evan Shrubsole <eshr@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38585}
The one remaining RecursiveCriticalSection likely needs a bit more
care.
Bug: webrtc:11567
Change-Id: Ie81085969197bed03ac8e2d269b58653b86095e0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206468
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Markus Handell <handellm@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33206}
This is a reland of 69241a93fb
Fix: The problem was related to NO_MAIN_THREAD_WRAPPING, which
affects https://source.chromium.org/chromium/chromium/src/+/master:third_party/webrtc/rtc_base/thread.cc;l=257-263;drc=7acc2d9fe3a6e3c4d8881d2bdfc9b8968a724cd5.
The original CL didn't attach the definition of the macro
NO_MAIN_THREAD_WRAPPING when building for Chromium (which doesn't have
to be related to //rtc_base anymore but to //rtc_base:threading).
Original change's description:
> Refactor rtc_base build targets.
>
> The "//rtc_base:rtc_base" build target has historically been one of the
> biggest targets in the WebRTC build. Big targets are the main source of
> circular dependencies and non-API types leakage.
>
> This CL is a step forward into splitting "//rtc_base:rtc_base" into
> smaller targets (as originally started in 2018).
>
> The only non-automated changes are (like re-wiring the build system):
> * The creation of //rtc_base/async_resolver.{h,cc} which allows to
> break a circular dependency (is has been extracted from
> //rtc_base/net_helpers.{h,cc}).
> * The creation of //rtc_base/internal/default_socket_server.{h,cc} to
> break another circular dependency.
>
> Bug: webrtc:9987
> Change-Id: I0c8f5e7efe2c8fd8e6bffa0d6dd2dd494cf3df02
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196903
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32941}
Bug: webrtc:9987
Change-Id: I7cdf49d2aac8357f1f50f90010bf2c2f62fa19f6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/202021
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33001}
This reverts commit 69241a93fb.
Reason for revert: Breaks WebRTC roll into Chromium.
Original change's description:
> Refactor rtc_base build targets.
>
> The "//rtc_base:rtc_base" build target has historically been one of the
> biggest targets in the WebRTC build. Big targets are the main source of
> circular dependencies and non-API types leakage.
>
> This CL is a step forward into splitting "//rtc_base:rtc_base" into
> smaller targets (as originally started in 2018).
>
> The only non-automated changes are (like re-wiring the build system):
> * The creation of //rtc_base/async_resolver.{h,cc} which allows to
> break a circular dependency (is has been extracted from
> //rtc_base/net_helpers.{h,cc}).
> * The creation of //rtc_base/internal/default_socket_server.{h,cc} to
> break another circular dependency.
>
> Bug: webrtc:9987
> Change-Id: I0c8f5e7efe2c8fd8e6bffa0d6dd2dd494cf3df02
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196903
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32941}
TBR=mbonadei@webrtc.org,hta@webrtc.org
# Not skipping CQ checks because original CL landed > 1 day ago.
No-Try: True
Bug: webrtc:9987
Change-Id: I1e36ad64cc60092f38d6886153a94f1a58339256
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/201840
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32986}
The "//rtc_base:rtc_base" build target has historically been one of the
biggest targets in the WebRTC build. Big targets are the main source of
circular dependencies and non-API types leakage.
This CL is a step forward into splitting "//rtc_base:rtc_base" into
smaller targets (as originally started in 2018).
The only non-automated changes are (like re-wiring the build system):
* The creation of //rtc_base/async_resolver.{h,cc} which allows to
break a circular dependency (is has been extracted from
//rtc_base/net_helpers.{h,cc}).
* The creation of //rtc_base/internal/default_socket_server.{h,cc} to
break another circular dependency.
Bug: webrtc:9987
Change-Id: I0c8f5e7efe2c8fd8e6bffa0d6dd2dd494cf3df02
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196903
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32941}
Original patch contributed by andrey.semashev@gmail.com.
In PhysicalSocketServer::WaitEpoll(), the loop verifies that the
signalled dispatcher is in dispatchers_ set. It does so by looking up
the dispatcher pointer in the set. This is vulnerable to the ABA
problem because one dispatcher may be removed and destroyed and another
created and added with the same address before epoll reports an event
for the old dispatcher. The same issue exists for other Wait
implementations, if a dispatcher is removed and a new one added with
the same socket handle is the old.
This is avoided by using a 64-bit key for looking up the dispatcher
in the set. The key is set from a running counter which gets incremented
when a dispatcher is added to the set, so even if the same dispatcher
pointer is added, removed and added again, the key value will be
different.
This changes the storage of dispatchers_ from a set to a flat_hash_map,
which uses a bit more memory but has faster lookup (O(1) as opposed to
O(log n)).
Bug: webrtc:11124
Change-Id: I6d206e1a367b58ba971edca9b48af7664384b797
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/181027
Commit-Queue: Taylor <deadbeef@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32019}
This name change communicates that the recursive critical section
should not be used for new code.
The relevant files are renamed rtc_base/critical_section* ->
rtc_base/deprecated/recursive_critical_section*
Bug: webrtc:11567
Change-Id: I73483a1c5e59c389407a981efbfc2cfe76ccdb43
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/179483
Commit-Queue: Markus Handell <handellm@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31754}
This change deletes heap-based handling of dynamic number of epoll
events handled per call to epoll, with the assumption
that PSS load is likely not dominated by the epoll syscalls. This
simplifies the logic in the code and removes a heap allocation.
Bug: webrtc:11567
Change-Id: I34fbe1fa8bf0a037bf849a4adac1a0a333c9dd86
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/175563
Commit-Queue: Markus Handell <handellm@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31358}
This CL only includes the necessary changes in PhysicalSocketServer,
and doesn't include the Java or Objective C API.
Note that this is doing exactly the same thing as UDPSocketPosix
in chromium.
BUG=webrtc:5658
Change-Id: I295455eaccba2a83cdd1bc55848f325c310f8d32
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168260
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Commit-Queue: Taylor <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30478}