This change refactors existing self-assignments within if clauses across
the WebRTC codebase.
*Why:*
- Bug Prevention: Assignments within conditionals are frequently
unintended errors, often mistaken for equality checks.
- Clearer Code: Separating assignments from conditionals improves code
readability and reduces the risk of misinterpretation.
Change-Id: I199dc26a35ceca109a2ac569b446811314dfdf0b
Bug: chromium:361594695
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/360460
Reviewed-by: Chuck Hays <haysc@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Commit-Queue: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42850}
Fixed issue with network interfaces due to a missing return value in the
"nw_path_enumerate_interfaces(...)" block. Exposed in iOS 18,
RTCNetworkMonitor::initWithObserver will only enumerate the first
interface, instead of all device interfaces
Bug: webrtc:359245764
Change-Id: Ifb9f28c33306c0096476a4afb0cdb4d734e87b2c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/359541
Auto-Submit: Corby <corby.hoback@gmail.com>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42818}
Web Spec and C++ version of setCodecPreferences are failable, as they return
an RTCError (in C++) or throw an InvalidModificationError (in Web Spec).
However, current Objective-C version of setCodecPreferences is not failable,
so callers cannot know if the operation succeeded or not.
Also, the current Objective-C version does not accept nil, which is not
spec-compliant. (Web Spec says if codecs is an empty list, set
transceiver.PreferredCodecs to codecs and abort these steps.)
Bug: webrtc:42226103, webrtc:42226230
Change-Id: Ib90f3e5b45fc959eeb92f623cf50efcb458a7478
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/352400
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Commit-Queue: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42789}
There is a race condition on reading
`ObjCNetworkMonitor::_network_monitor` field.
The `ObjCNetworkMonitor::OnPathUpdate()` checks its nullability
on the org.webrtc.RTCDispatcherNetworkMonitor thread BEFORE the
`ObjCNetworkMonitor::Start()` assigns it on the network_monitor thread.
In addition, this field is neither atomic nor protected by mutex so its
last assigned value is not guaranteed to be visible to
another [reading] thread.
Bug: webrtc:355238623
Change-Id: I1a05215111cc873b7d4931824e18f281aebfb91f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/357880
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Peter Hanspers <peterhanspers@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42778}
This is a reland of commit 9fcaa034bc
Original change's description:
> Remove jni_zero type aliases in jni_generator_helper.h.
>
> This CL removes some type alias from
> sdk/android/src/jni/jni_generator_helper.h and make sure all the
> jni_zero types are referred to using the jni_zero:: namespace.
>
> The goal is to remove sdk/android/src/jni/jni_generator_helper.h
> in future CLs.
>
> Bug: b/319078685, b/351773023
> Change-Id: Ief60fce3e8f301f09ac5392d143aa5a82a445bcb
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/356882
> Reviewed-by: Zoé Lepaul <xalep@webrtc.org>
> Reviewed-by: Jeremy Leconte <jleconte@google.com>
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#42618}
No-Presubmit: True
Bug: b/319078685, b/351773023
Change-Id: I605a726788ee84efdbdc9e75098b404cbd7c1f30
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/358922
Reviewed-by: Zoé Lepaul <xalep@webrtc.org>
Reviewed-by: Christoffer Dewerin <jansson@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42751}
This reverts commit 4f3d660f4f.
Reason for revert: downstream still broken
Original change's description:
> Reland "Remove jni_zero type aliases in jni_generator_helper.h."
>
> This is a reland of commit 9fcaa034bc
>
> Original change's description:
> > Remove jni_zero type aliases in jni_generator_helper.h.
> >
> > This CL removes some type alias from
> > sdk/android/src/jni/jni_generator_helper.h and make sure all the
> > jni_zero types are referred to using the jni_zero:: namespace.
> >
> > The goal is to remove sdk/android/src/jni/jni_generator_helper.h
> > in future CLs.
> >
> > Bug: b/319078685, b/351773023
> > Change-Id: Ief60fce3e8f301f09ac5392d143aa5a82a445bcb
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/356882
> > Reviewed-by: Zoé Lepaul <xalep@webrtc.org>
> > Reviewed-by: Jeremy Leconte <jleconte@google.com>
> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#42618}
>
> Bug: b/319078685, b/351773023
> Change-Id: I604b0842d220d76c36b73d2d49bcefe0ee7ae14f
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/356903
> Commit-Queue: Jeremy Leconte <jleconte@google.com>
> Reviewed-by: Zoé Lepaul <xalep@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#42626}
Bug: b/319078685, b/351773023
Change-Id: I9429789e44c82735305b2d0d90cbaa4891d79622
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/357041
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Jeremy Leconte <jleconte@google.com>
Reviewed-by: Jeremy Leconte <jleconte@google.com>
Owners-Override: Jeremy Leconte <jleconte@google.com>
Cr-Commit-Position: refs/heads/main@{#42627}
This is a reland of commit 9fcaa034bc
Original change's description:
> Remove jni_zero type aliases in jni_generator_helper.h.
>
> This CL removes some type alias from
> sdk/android/src/jni/jni_generator_helper.h and make sure all the
> jni_zero types are referred to using the jni_zero:: namespace.
>
> The goal is to remove sdk/android/src/jni/jni_generator_helper.h
> in future CLs.
>
> Bug: b/319078685, b/351773023
> Change-Id: Ief60fce3e8f301f09ac5392d143aa5a82a445bcb
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/356882
> Reviewed-by: Zoé Lepaul <xalep@webrtc.org>
> Reviewed-by: Jeremy Leconte <jleconte@google.com>
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#42618}
Bug: b/319078685, b/351773023
Change-Id: I604b0842d220d76c36b73d2d49bcefe0ee7ae14f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/356903
Commit-Queue: Jeremy Leconte <jleconte@google.com>
Reviewed-by: Zoé Lepaul <xalep@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42626}
This reverts commit 9fcaa034bc.
Reason for revert: Breaks downstream project.
Original change's description:
> Remove jni_zero type aliases in jni_generator_helper.h.
>
> This CL removes some type alias from
> sdk/android/src/jni/jni_generator_helper.h and make sure all the
> jni_zero types are referred to using the jni_zero:: namespace.
>
> The goal is to remove sdk/android/src/jni/jni_generator_helper.h
> in future CLs.
>
> Bug: b/319078685, b/351773023
> Change-Id: Ief60fce3e8f301f09ac5392d143aa5a82a445bcb
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/356882
> Reviewed-by: Zoé Lepaul <xalep@webrtc.org>
> Reviewed-by: Jeremy Leconte <jleconte@google.com>
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#42618}
Bug: b/319078685, b/351773023
Change-Id: I003acf68e2b84bd0a5cda7c7180a28bcd3ca3772
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/356902
Owners-Override: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#42619}
This CL removes some type alias from
sdk/android/src/jni/jni_generator_helper.h and make sure all the
jni_zero types are referred to using the jni_zero:: namespace.
The goal is to remove sdk/android/src/jni/jni_generator_helper.h
in future CLs.
Bug: b/319078685, b/351773023
Change-Id: Ief60fce3e8f301f09ac5392d143aa5a82a445bcb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/356882
Reviewed-by: Zoé Lepaul <xalep@webrtc.org>
Reviewed-by: Jeremy Leconte <jleconte@google.com>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42618}
First batch of applying iwyu to the repo.
Done with:
> ./tools_webrtc/iwyu/apply-iwyu api
> git add api/[a-s]*
> python3 gn_autodeps.py ~/local/webrtc/src out/Default
Last step is a custom script I wrote to automatically apply new required
dependencies for target in gn, which saved tons of time manually going
over the files and fixing.
If this is something that interest others, I can submit it as well.
Bug: webrtc:42226242
Change-Id: Id109e77f50835827495bc4512880c4ec9ae175f6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/343680
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Dor Hen <dorhen@meta.com>
Cr-Commit-Position: refs/heads/main@{#42512}
This CL modifies RtpTransceiver.setCodecPreferences to return RtcError
instead of void, making it easier to handle errors when setting
codec preferences. To achieve this, new RtcException and RtcError
classes are introduced to represent errors in WebRTC,
mimicking api/rtc_error.h in C++.
Bug: webrtc:42225493
Change-Id: I0f4c6e56f8f2af3353915a41084f6b7b46d793d4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/352900
Reviewed-by: Zoé Lepaul <xalep@webrtc.org>
Commit-Queue: Zoé Lepaul <xalep@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42476}
and move usages to webrtc::RefCountInterface
This CL also moves more stuff to webrtc:: and adds backwards
compatible aliases for them.
Bug: webrtc:42225969
Change-Id: Iefb8542cff793bd8aa46bef8f2f3c66a1e979d07
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/353720
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42446}
with an intermediate step since Chromium depends on the openssl_stream_adapter.h which will move to the new target.
BUG=webrtc:339300437
Change-Id: Iea163e0a6e3923ce8a741a2e11e9a2a1e3f3e7a3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/350887
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Cr-Commit-Position: refs/heads/main@{#42362}
There is a race condition in NetworkMonitor where native observers may be removed concurrently with a notification being dispatched, leading to a dangling pointer dereference (trying to dispatch an observer that was already removed and destroyed), and from there a crash with access violation.
By ensuring dispatching to native observers is done within the synchronization lock that guards additions/removals of native observers protects against this race condition.
Since native observers callbacks are posted to the networking thread in the C++ side anyway, there should be no risk of deadlock/starvation due to long-running observers.
Bug: webrtc:15837
Change-Id: Id2b788f102dbd25de76ceed434c4cd68aa9a569e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/338643
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42256}
And add PORTALLOCATOR_ENABLE_ANY_ADDRESS_PORTS
which makes WebRTC allocate an unbound port.
BUG=None
Tested: Manually (not the flag, but that it doesn't break anything)
Change-Id: Iba541eb366f111e5ab7844bb3a2dc25ca0838cfe
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/347881
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42119}
Also remove all dependencies on rtc_media_base except for a few
that are suspected of being linker directives.
Bug: webrtc:14775
Change-Id: Ic0daf88b5422047d3ed7079ee6af9e689853310c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/341461
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Jeremy Leconte <jleconte@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41886}
Left in target are just .cc files with .h files used externally.
Bug: webrtc:14775
Change-Id: I264f69bb29147fc0f8db877e3def8b21ed42181d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/341420
Reviewed-by: Jeremy Leconte <jleconte@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41835}