Commit Graph

2269 Commits

Author SHA1 Message Date
Miriam Zimmerman
31a3397e96 Merge remote-tracking branch 'upstream/branch-heads/7778' into mutexlox/webrtc-148
Merge conflicts resolved in:
* api/neteq/neteq.h
* audio/channel_receive.cc
* audio/channel_receive.h
* media/engine/simulcast_encoder_adapter.cc
* modules/audio_coding/BUILD.gn
* modules/audio_coding/acm2/acm_resampler.cc
* modules/audio_coding/acm2/acm_resampler_unittest.cc
* modules/audio_processing/audio_processing_impl.h
* modules/video_coding/BUILD.gn
* p2p/base/p2p_transport_channel_unittest.cc
* pc/jsep_transport_controller.cc
* pc/rtp_transport.h
* pc/rtp_transport_internal.h
* unsafe_buffers_paths.txt
2026-05-08 13:42:18 -04:00
Adel Lahlou
d46d62e9eb Merge remote branch 'upstream/branch-heads/7680' 2026-04-06 00:16:11 -07:00
Evan Shrubsole
6815c67b00 Use RunLoop in rtc_base/ tests
Bug: webrtc:469327588
Change-Id: Ib419c8d1d26c5db2107048ba4780d16d6a6a6964
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/461342
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#47307}
2026-04-01 04:05:46 -07:00
Harald Alvestrand
830e031e2c Use the PayloadType class rather than uint8_t in Codec class
Also replace "int" with "PayloadType" in a number of interfaces, and
make appropriate adjustments.

This is one step towards controlling the issuing and consumption
of PayloadType values.

Bug: webrtc:360058654
Change-Id: I146bc4e3e9966b98864277eee6f52b75ba10d89a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/460021
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#47286}
2026-03-27 07:22:47 -07:00
Evan Shrubsole
2395c1f954 Remove SIMULATED_WAIT
Bug: webrtc:381524905
Change-Id: I24c455d6656412a9ce2e16250564d9986a6a6964
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/460080
Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#47280}
2026-03-27 03:58:29 -07:00
Tommi
bb96cbad59 Spring cleanup of WATCHLIST and OWNER files
Bug: none
Change-Id: I168e1f456905c96e57066721543ed9cd8925e4b1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/460420
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#47269}
2026-03-26 09:19:09 -07:00
Tommi
5e177d2171 Harden SimpleStringBuilder safety checks
Replace RTC_DCHECK with RTC_CHECK in SimpleStringBuilder to ensure
safety constraints are enforced in all build configurations, including
release builds. This change prevents undefined behavior or silent
truncation by crashing when a buffer overflow is detected, rather than
only performing these checks in debug modes.

The modifications include:
* Updating SimpleStringBuilder to use RTC_CHECK for consistency and
  bounds verification.
* Simplifying RtpExtension::ToString and VideoReceiveStream2 by
  migrating from SimpleStringBuilder to StringBuilder.
* Simplify+clarify the StringBuilder::Release implementation.
* Update unit tests to reflect that overflow now consistently results
  in a crash.

Bug: chromium:486536241
Change-Id: Ia067508e2b9409154ad4afdbe4c0971a1dd32e1e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/459441
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#47251}
2026-03-25 01:02:30 -07:00
Tommi
9c36e112fb Simplify thread yielding by removing support for high-priority tasks
Remove the `PostHighPriorityTask` method and the internal
`high_priority_messages_` queue from the `Thread` class.

Instead, change `IsYieldRequested()` to return true whenever there are
any pending tasks in the standard message queue, rather than only
checking for high-priority tasks.

This means that the sequence of batched operations is always executed
when the thread is idle, rather than blocking the thread, ensuring that
media-related calls to the same thread get processed as fast as
possible.

Bug: webrtc:42222804
Change-Id: I758c33dc2c33d79fc5e6beea1926529f78e49255
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/456760
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#47249}
2026-03-25 00:09:26 -07:00
Evan Shrubsole
9056a05a34 Use injected clock in ssl_stream_adapter_unittest
Removes use of AutoThread and ScopedFakeClock to boot.

Bug: webrtc:469327588,webrtc:42223992
Change-Id: I1b06f1666ec68af67fa1896b364981f26a6a6964
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/455941
Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#47170}
2026-03-16 05:27:26 -07:00
Danil Chapovalov
565bbdd51c Replace ArrayView with std::span in rtc_base/
Search&Replace MakeArrayView and ArrayView with std::span
Search&Replace include "api/array_view.h" with include <span>
Remove build dependencies on array_view target
Rename tests that were named PrefixArrayView
 from "Prefixstd::span" to "PrefixSpan"

Bug: webrtc:439801349
Change-Id: Iad951423733c8676c7356047f115eb3fcf2e885d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/454241
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#47107}
2026-03-10 07:27:21 -07:00
Philipp Hancke
7040fbcb53 build: change more tests to use rtc_test instead of rtc_exectuable
which requires clobbering on the ios bots. Also remove _temp suffix
from base64 benchmark.

Bug: webrtc:467294026
Change-Id: I4d1fe493c41438ab2f83bc1c3acbecc024b15128
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/443384
Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
Reviewed-by: Jeremy Leconte <jleconte@google.com>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#47106}
2026-03-10 06:48:52 -07:00
Harald Alvestrand
924dd2ecf8 Reduce the number of webrtc:: prefixes in code
This is achieved by moving most anonymous namespaces inside the
webrtc namespace and modifying as appropriate.

Bug: None
Change-Id: Iff299c45f92ae5aaa736722ed6630df9ad5525bf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/454240
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#47077}
2026-03-06 06:29:19 -08:00
Tommi
a834081367 Implement cooperative yielding and high-priority tasks in Thread
Introduce mechanisms within the Thread class to support cooperative
multitasking. This allows long-running tasks to voluntarily yield
execution to pending high-priority work, improving responsiveness and
mitigating latency issues like audio glitches that can occur during
heavy operations such as session negotiation.

Key modifications:
- Add IsYieldRequested() to allow tasks to check for pending yield
  requests.
- Implement PostHighPriorityTask() to insert urgent tasks into a
  dedicated queue and signal a yield request on the target thread.
- Track nested synchronous blocking calls to catch when yielding in
  unsafe contexts, enforced via RTC_DCHECK.
- Ensure high-priority tasks are processed before regular tasks when the
  thread resumes execution.

# no-try: persistent webrtc_linux_chromium infra failure

No-try: true
Bug: webrtc:42223005
Change-Id: I093b7e04d665baef19085e72bc0548447fd6768c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/450561
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#47056}
2026-03-04 23:05:37 -08:00
Harald Alvestrand
bfd03d6f25 Delete deprecated functions in rtc_base/byte_order.h
This can be submitted when there are no more users - no earlier than March 1 according to the PSA sent out to discuss-webrtc on Feb 17.

Bug: webrtc:484070270
Change-Id: I4a3c5f3db949242761311d7b4c3799ff995d7cd4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/449361
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Auto-Submit: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#47024}
2026-03-02 05:49:18 -08:00
Jonas Oreland
bf3812b3a3 dtls-in-stun: Enable new BoringSSL update-timeout feature
Enable usage of
https://boringssl-review.git.corp.google.com/c/boringssl/+/86167
for DTLS handshake.

This has the following positive effects:
- The very hard ConnectTime test now works for all scenarios, yay!
- The (not automatically run) _bench_test now has zero outliers.

I.e. this is very close to something launchable.

However the following problems still remain
1) When client.dtls_in_stun != server.dtls_in_stun there are spurious
re-transmissions in unit tests. I know what the problem is and is working on a follow up.

2) There is a problem in the AlmostFull test case with dtls_in_stun,
causing retransmissions for unknown reason.

Bug: webrtc:367395350
Change-Id: Ia9cfc42e353856d072fc52c4a0076873eefa0c16
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/451001
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#47012}
2026-02-27 12:09:28 -08:00
Philipp Hancke
1185f13f75 rtc_base: add text2pcap helper function
which dumps the content of an array view in text2pcap format so it can
be extracted from the logs and viewed with wireshark.

The existing variants in net/dcsctp/ and pc/srtp_session are updated to
use this helper.

Bug: None
Change-Id: Ibdf3c2c7a4e67c19028610d8551415d24f5de8ec
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/451380
Reviewed-by: Victor Boivie <boivie@webrtc.org>
Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46983}
2026-02-24 06:51:20 -08:00
Jonas Oreland
5c7cca0ff9 dtls-in-stun: fix DTLS 1.x resend/acking behavior
This patch does "the same" as https://webrtc-review.git.corp.google.com/c/src/+/450983
with the following noticeable changes
- handle both 1.2 & 1.3 !
- add unit test
- use dtls/srtp as a signal for then peer is also writable
as show by https://webrtc-review.git.corp.google.com/c/src/+/449762,
(note: it use existing callbacks rather than adding a new!).

Bonus!
1) fix bug in callback_list when removing from list
during callback, add new testcases that failed before change in this.
2) address most of comments added late to https://webrtc-review.git.corp.google.com/c/src/+/449561

Bug: webrtc:367395350
Change-Id: I131ba3ac920187bc9dec004ba55e297540ddf27c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/451521
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46976}
2026-02-23 11:04:27 -08:00
Danil Chapovalov
1d38dc7485 Avoid unsafe buffer warnings when ArrayView is replaces with std::span
While currently this code doesn't produced warnings when used with
ArrayView, using std::span::data same way does issue warnings.

Bug: webrtc:439801349
Change-Id: Icb8dc92f2d5fd20c38b364e7ea5218f0171e0b8e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/450880
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46964}
2026-02-20 07:21:37 -08:00
Harald Alvestrand
8ffca5923a Switch ArrayView, CopyOnWriteBuffer and AudioView to iterators
These functions previously returned a T*, which meant that they
had to be manipulated with pointer arithmetic. Using iterators
gives opportunities for bounds checking.

Bug: webrtc:478086887, webrtc:439801349
Change-Id: If5b91920105b43e72cf0114f003914bd39d145c4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/449660
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46944}
2026-02-18 06:12:10 -08:00
Danil Chapovalov
7a8eed0780 Deprecate ArrayView(nullptr_t, size) constructor
Use default constructor instead.
std::span doesn't have matching constructor.

Bug: webrtc:439801349
Change-Id: Ic228c128835a86296970ef0cfc6cc3af770caaad
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/450180
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@webrtc.org>
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46941}
2026-02-18 04:32:43 -08:00
Jonas Oreland
125c674e17 Add jonaso@ as OWNER in rtc_base
Currently lots of stuff only used by p2p/ is located in rtc_base/
(e.g. DTLS). I think such stuff should be moved into p2p.

Bug: None
Change-Id: Ia0cc1125ac1e4f6c7b294022d5d33d7fa89819d9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/450020
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46932}
2026-02-17 09:53:02 -08:00
Jeremy Leconte
114ea00794 Fix malformed DEPS files in WebRTC.
Bug: webrtc:447469714
Change-Id: I4a18d0d609d175f83942583d36eb7453e2507983
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/449981
Commit-Queue: Jeremy Leconte <jleconte@google.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46931}
2026-02-17 09:47:27 -08:00
Harald Alvestrand
e0915ee289 Stop using Buffer::SetSize in some simple cases.
SetSize() can allow access to uninitialized memory, so should be
avoided. This CL addresses some simple cases, but does not yet
deprecate SetSize().

It also introduces Truncate() as a variant known not to expose
uninitialized memory.

Bug: webrtc:42223681
Change-Id: I136d2394139c7cb271686d634bf6a01edfd5691b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/449140
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46927}
2026-02-17 07:13:10 -08:00
Danil Chapovalov
c445a96208 Deprecate conversion from nullptr to an empty ArrayView
Use default constructor instead.

Bug: webrtc:439801349
Change-Id: I68d459865f4e7d7eb598f47b37ab21bc7c1eb133
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/449740
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@webrtc.org>
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46922}
2026-02-17 01:56:49 -08:00
Harald Alvestrand
190c6680d9 Define RTC_HARDENING_ASSERT and use in rtc::ArrayView bounds check
This will assert on out-of-bounds access if RTC_HARDENING is set
This allows RTC_HARDENING to control whether these checks are treated as CHECK or as DCHECK

If RTC_HARDENING is set, the assert will be checked, both in debug and production builds.

Bug: webrtc:367205686
Change-Id: I456edabc7107a5b6edb82183fa86d160c83642d7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/362960
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46919}
2026-02-16 12:21:00 -08:00
Evan Shrubsole
7522ef394b Add support for main thread socket server in GlobalSimulatedTimeController
This CL updates virtual_socket_unittest accordingly. The goal of this
change is to remove the need for AutoSocketServerThread when simulated
time is used.

Drive by fix all unsafe buffer usages in this test.

Bug: webrtc:469327588,webrtc:381524905
Change-Id: I4297e0efc1e7254294219c372eac7a216a6a6964
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/449121
Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46915}
2026-02-16 07:34:59 -08:00
Danil Chapovalov
d9ace3fe41 Deprecated ArrayView::subview
Replace remaining usages of subview with subspan

Bug: webrtc:439801349
Change-Id: I205a7de55c24b2f77356095ee736d7863c70c2ef
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/449360
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46908}
2026-02-16 02:40:46 -08:00
Harald Alvestrand
cc7094359e Migrate internal usages of ByteOrder to ArrayView API
This change replaces internal usages of the legacy void* based ByteOrder
API with the new type-safe ArrayView overloads. All 19 identified
internal files have been updated.

Additionally:
- Updated rtc_base/byte_order.h to deprecate the legacy void* overloads
  using ABSL_DEPRECATE_AND_INLINE.
- Updated rtc_base/BUILD.gn to include necessary dependencies for the
  new ByteOrder API.
- Added documentation for the migration plan in g3doc/todo/byte_order_safety.md.

Bug: webrtc:484070270
Change-Id: I3836ff3a7d128d40e24dac1ec1cac2f289aaa6cb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/449061
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46903}
2026-02-13 16:35:10 -08:00
Harald Alvestrand
a7e7130d51 Deprecate the two-argument Buffer constructor
The two-argument Buffer constructor could create uninintialized data.
This refactor replaces it with CreateUninitializedWithSizeAndCapacity.

It also refactors the CopyOnWriteBuffer class to use explicit functions when creating uninitialized Buffers.

Also do some checking to ensure that SetData() always has room enough.

Bug: webrtc:42223681
Change-Id: I160c88ca41944c9888d7862e8ce46cd673417a69
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/445040
Auto-Submit: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46890}
2026-02-13 02:40:23 -08:00
Danil Chapovalov
1ccc59d5c9 Spanify CopyOnWriteBuffer
Detach CopyOnWriteBuffer implementation from Buffer by creating a dedicated small type that has non-mutable capacity and doesn't have size. Each CoWBuffer object sharing the same buffer has its own members that specify which memory can be safe to write or read.
Delegate all pointer arithmetic to ArrayView silencing unsafe-buffer warnings.

Bug: webrtc:478086887
Change-Id: I2ee0c0fce6c4264c5d44e0f227908fc9c9afadc7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/444702
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46885}
2026-02-12 04:27:16 -08:00
Evan Shrubsole
cc688f55eb Use Clock and RunLoop in null_socket_server_unittest
Bug: webrtc:42223992,webrtc:469327588
Change-Id: I9b7646b9ba4809a924fbb8186594e2516a6a6964
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/448283
Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46875}
2026-02-11 08:32:43 -08:00
Evan Shrubsole
27eddf019f Use clock in Logging Perf test
Bug: webrtc:42223992
Change-Id: If5e4dd0a2111b63498b0fe1bcdf9e2566a6a6964
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/448282
Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46872}
2026-02-11 05:42:19 -08:00
Sameer Vijaykar
e902e15d1c Add network slice to Network::ToString()
BUG=webrtc:466507512

Change-Id: Ida1b809a139dc9da56c27fbc11f48cab9da07eba
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/448040
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Cr-Commit-Position: refs/heads/main@{#46861}
2026-02-10 10:40:34 -08:00
Harald Alvestrand
a27d608d4b Spanify rtc_base/buffer
This makes it possible to compile rtc_base/buffer with the checks
for unsafe buffers.

Bug: webrtc:478086887
Change-Id: I53f1161164e0408f985bd8395a0fd516e47bb0cd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/444780
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Auto-Submit: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46858}
2026-02-10 06:49:23 -08:00
Evan Shrubsole
eee78e7541 Reland "Use Clock in internal EventTracer"
This is a reland of commit ed6507b57e

Reland safe: Use comment to deprecate rather than annotation

Original change's description:
> Use Clock in internal EventTracer
>
> This requires changes to X11 capturers due to a poorly defined macro in
> X11. 
>
> Bug: webrtc:42223992
> Change-Id: If9f8102386dc93142f9facfba21deb1f6a6a6964
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/445903
> Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#46819}

Bug: webrtc:42223992
Change-Id: Ied9d07950cd35f132c17c3532581b5197a0fbfb1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/446780
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46832}
2026-02-06 09:48:09 -08:00
Tomas Gunnarsson
3f4d30b193 Revert "Use Clock in internal EventTracer"
This reverts commit ed6507b57e.

Reason for revert: Hit problems in the chromium roll:
[62113/82444] CXX obj/remoting/host/remoting_me2me_host_static/remoting_me2me_host.o
../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/remoting/host/remoting_me2me_host_static/remoting_me2me_host.o.d -DREMOT...(too long)
../../remoting/host/remoting_me2me_host.cc:2201:22: error: 'SetupInternalTracer' is deprecated: use SetupInternalTracer(const Environment&, bool) [-Werror,-Wdeprecated-declarations]
 2201 |     webrtc::tracing::SetupInternalTracer();
      |                      ^
../../third_party/webrtc/rtc_base/event_tracer.h:84:3: note: 'SetupInternalTracer' has been explicitly marked deprecated here
   84 | [[deprecated("use SetupInternalTracer(const Environment&, bool)")]]
      |   ^
1 error generated.
exit=1
error: cannot make progress due to previous 1 errors: exit=1


Original change's description:
> Use Clock in internal EventTracer
>
> This requires changes to X11 capturers due to a poorly defined macro in
> X11. 
>
> Bug: webrtc:42223992
> Change-Id: If9f8102386dc93142f9facfba21deb1f6a6a6964
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/445903
> Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#46819}

Bug: webrtc:42223992
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: Icef9acd1413e9490fb5203fa607379404ace2d68
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/446760
Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#46825}
2026-02-05 22:57:13 -08:00
Evan Shrubsole
b28858d79d Use SimulatedClock in timestamp_aligner_unittest
Bug: webrtc:42223992, webrtc:42223979
Change-Id: I5405a4832bdfe019e142508aa5d6dda26a6a6964
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/446600
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46821}
2026-02-05 10:30:08 -08:00
Evan Shrubsole
ed6507b57e Use Clock in internal EventTracer
This requires changes to X11 capturers due to a poorly defined macro in
X11. 

Bug: webrtc:42223992
Change-Id: If9f8102386dc93142f9facfba21deb1f6a6a6964
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/445903
Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46819}
2026-02-05 09:39:51 -08:00
Tommi
6f74857e6e Fix race condition in Thread::PostTaskImpl, potential for UAF
When a task is posted to a Thread using PostTaskImpl, the target thread
might process the task and destroy itself immediately (e.g., if the task
calls Quit() and the thread owner destroys the thread).

Previously, PostTaskImpl would release the mutex before calling
WakeUpSocketServer(). This allowed the target thread to run, process the
task, and potentially be destroyed before PostTaskImpl could access ss_
(socket server) in WakeUpSocketServer(), leading to a
Use-After-Free/Destruction.

This moves the WakeUpSocketServer() call inside the mutex lock. This
ensures that the task is not visible to the target thread (via Get())
until PostTaskImpl has finished its work, effectively extending the
critical section to cover the wake-up call.

This issue was caught on the msan bot:
https://chromium-swarm.appspot.com/task?id=76216a8fa02bd411&o=true&w=true

Bug: None
Change-Id: I15af36aab965c1c9180d0c982d23b200de1d3472
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/445120
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46791}
2026-02-02 02:54:02 -08:00
Nfrederiksen
ee20bcfffe rtc_base: avoid OutputDebugString in opt builds on Windows
Before: On Windows, LogMessage::OutputToDebug() always called OutputDebugStringA(), which could block under certain debug-output listeners/DBWIN contention and stall real-time threads (audio freezes).
After: OutputDebugStringA() is guarded (only emitted when appropriate), avoiding that blocking path and preventing those stalls while leaving stderr/console logging behavior unchanged.
Bug: webrtc:42225457
Change-Id: I2f84e0ad6e2319d71f1f450c51c566f1c59ef659
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/435441
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46751}
2026-01-27 01:27:02 -08:00
Markus Handell
4a51622705 TaskQueueFactory: Add kAudio and kVideo priorities
This change introduces specific priority levels for audio and
video tasks within the TaskQueueFactory to allow for better
platform-specific thread scheduling.

Changes:

* New field trial WebRTC-MediaTaskQueuePriorities that activates the
  priority change.

* New Priority Enums: Added kVideo and kAudio to
TaskQueueFactory::Priority and corresponding kVideo and
kAudio to ThreadPriority.

* WebRTC platform thread implementation:
- Video priority initially maps to high priority.
- On Mac/iOS (GCD), both audio and video map to
  DISPATCH_QUEUE_PRIORITY_HIGH because of API limitation.

* Task queue updates:
- Updated the audio encoder queue to use kAudio priority.
- Updated the video encoder & decoder, incoming video
  stream, and video frame transformer queues to use kVideo priority.

* Queue renaming: Standardized several task queue names by
   appending "Queue" (e.g., "AudioEncoder" became "AudioEncoderQueue").

Bug: chromium:470337728
Change-Id: I4790990340a72a54945750c2c4e1f97314edf375
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/436580
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46744}
2026-01-26 06:18:27 -08:00
Markus Handell
6461ca7c3e TaskQueueFactory: implement go/cstyle#Enumerator_Names
We're about to add two new priorities. Ensure we're
respecting go/cstyle#Enumerator_Names before adding them.

WANT_LGTM=ANY

Bug: chromium:470337728
Change-Id: I01c6f237a7c67df6a3083f1165ee07bffc9d3523
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/443420
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46740}
2026-01-26 02:38:24 -08:00
Sameer Vijaykar
0fc5aeecfb Reduce network cost for cellular network slices.
This change makes network slices on cellular networks more preferable
than the regular network by decreasing the network cost slightly when a
slice is in use.

Network slicing is typically offered as a premium feature on 5G networks
at an additional price.

The network cost is only reduced when the underlying adapter supports
slicing, currently 5G or undifferentiated cellular. It is gated behind
the WebRTC-UnifiedCommunications field trial.

BUG=webrtc:466507512

Change-Id: I230264c95d2d9f0386a096e7ca51cf44b5684922
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/442681
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Cr-Commit-Position: refs/heads/main@{#46710}
2026-01-21 14:41:45 -08:00
Jeremy Leconte
fb256082b9 Explicitly add dependencies instead of relying on public_deps.
Impacted targets are:
* test:test_support_objc
* sdk:sdk
* :tracing

Bug: webrtc:8603
Change-Id: I6ed2340ac81ee0cdd3e1817db63616ae6e8f6ae7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/442860
Commit-Queue: Jeremy Leconte <jleconte@google.com>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46697}
2026-01-20 03:53:32 -08:00
Kun Wu
4354263f56 Remove the unconditional perfetto reference in the rtc_base:event_tracer.
The perfetto deps should be avoided when WebRTC is built with rtc_use_perfetto=false.

Bug: webrtc:470709365
Change-Id: Ic9f7177029500bea5ee867ec5723435ece4a270d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/437820
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46689}
2026-01-19 04:02:54 -08:00
Harald Alvestrand
4570571d11 Allow compilation with Plan B deprecation enabled
This change introduces mechanisms to allow the codebase to compile
even when deprecate_plan_b = true is set in GN args:

1.  A new GN config suppress_plan_b_deprecation is added to suppress
    deprecated-declarations warnings.
2.  The rtc_test template is updated to automatically apply this
    suppression, allowing unit tests to continue calling Plan B APIs.
3.  RTC_ALLOW_PLAN_B_DEPRECATION_BEGIN/END macros are added to
    plan_b_only.h to locally suppress warnings in production glue code.
4.  Existing call sites in PeerConnection and SdpOfferAnswerHandler
    are wrapped with these macros.
5.  Updated g3doc/plan_b_removal.md with the new macros and usage.

Bug: webrtc:467984837
Change-Id: I42bc995b7825e0ae96db8919dd31d2c44551f430
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/442362
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46682}
2026-01-17 07:20:54 -08:00
Harald Alvestrand
18bd991b61 Add mechanism for Plan B deprecation
This includes the deprecate_plan_b GN argument, the PLAN_B_ONLY macro,
and documentation in g3doc/plan_b_removal.md.

Plan B specific functions in RtpTransmissionManager and
SdpOfferAnswerHandler are now annotated with PLAN_B_ONLY.

Figuring out how to compile with deprecate_plan_b=true is left for
a later CL.

Bug: webrtc:467984837
Change-Id: I25852f0a2d3aa1caedcafe8bee98ab37851c729a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/442302
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46681}
2026-01-17 07:17:56 -08:00
Jonas Oreland
77f5dfc3e3 Disable some DtlsInStun testcases while merging new BoringSSL feature
We are on the brink of merging the new behavior of DTLSv1_set_initial_timeout_duration
which is awesome!
https://boringssl-review.googlesource.com/c/boringssl/+/86167

However, some of the testcases I written accidentally depends on the old
behavior. Therefor I need to disable some test until the boring ssl
change is merged, so I can re-enable the feature and update the tests
in the same change.

Sorry for mess :(

Bug: webrtc:367395350
Change-Id: I83605d60603b10af4517d7f40d62bc4d0758c378
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/442400
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Auto-Submit: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46675}
2026-01-16 07:43:46 -08:00
Philipp Hancke
d4c7545caa dtls-in-stun: document and assert behavior of SSL bio flush
BIO_CTRL_FLUSH gets called after all packets of a DTLS flight have been sent.

Bug: webrtc:367395350
Change-Id: Ia6fb5f48cac346b1bfa76b6f73e7fcb8c0e9e938
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/442360
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46673}
2026-01-16 04:54:35 -08:00
Harald Alvestrand
0ce7f03d0c Replace ExportSrtpKeyingMaterial with AppendSrtpKeyingMaterial
The latter has internal computation of key sizes, and will use
the Buffer argument in a normal manner, making the use of
Buffer::CreateUninitializedWithSize() unnecessary.

ExportSrtpKeyingMaterial is deprecated.

Bug: webrtc:475583775
Change-Id: I56a065bb90c0f2a2d9dfd4a4d05773cf7e887763
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/442100
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46669}
2026-01-15 01:48:04 -08:00