commit b1e92b670aff330b0875382d061420fb1fb60d12
parent 2197ae881249034c24a473177cb9454c2066c729
Author: Dan Baker <dbaker@mozilla.com>
Date: Mon, 1 Dec 2025 18:05:36 -0700
Bug 2000941 - Vendor libwebrtc from 3bdce3dc17
Upstream commit: https://webrtc.googlesource.com/src/+/3bdce3dc1798e8733450d5f56070f8b830571278
Remove use of global clocks from AudioFrame
These were used for a histogram for profiling. This moves the profiling
into ChannelSend.
Bug: webrtc:42223992
Change-Id: If663416c6dc851f1f5babcf2a3c1e6def74ef1db
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/408780
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45598}
Diffstat:
9 files changed, 13 insertions(+), 43 deletions(-)
diff --git a/third_party/libwebrtc/README.mozilla.last-vendor b/third_party/libwebrtc/README.mozilla.last-vendor
@@ -1,4 +1,4 @@
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
-libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-12-02T01:03:02.922923+00:00.
+libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-12-02T01:05:17.702586+00:00.
# base of lastest vendoring
-7fdca9ece4
+3bdce3dc17
diff --git a/third_party/libwebrtc/api/audio/audio_frame.cc b/third_party/libwebrtc/api/audio/audio_frame.cc
@@ -19,7 +19,6 @@
#include "api/audio/channel_layout.h"
#include "api/rtp_packet_infos.h"
#include "rtc_base/checks.h"
-#include "rtc_base/time_utils.h"
namespace webrtc {
@@ -59,7 +58,6 @@ void AudioFrame::ResetWithoutMuting() {
channel_layout_ = CHANNEL_LAYOUT_NONE;
speech_type_ = kUndefined;
vad_activity_ = kVadUnknown;
- profile_timestamp_ms_ = 0;
packet_infos_ = RtpPacketInfos();
absolute_capture_timestamp_ms_ = std::nullopt;
}
@@ -127,18 +125,6 @@ void AudioFrame::CopyFrom(const AudioFrame& src) {
}
}
-void AudioFrame::UpdateProfileTimeStamp() {
- profile_timestamp_ms_ = TimeMillis();
-}
-
-int64_t AudioFrame::ElapsedProfileTimeMs() const {
- if (profile_timestamp_ms_ == 0) {
- // Profiling has not been activated.
- return -1;
- }
- return TimeSince(profile_timestamp_ms_);
-}
-
const int16_t* AudioFrame::data() const {
return muted_ ? zeroed_data().begin() : data_.data();
}
diff --git a/third_party/libwebrtc/api/audio/audio_frame.h b/third_party/libwebrtc/api/audio/audio_frame.h
@@ -115,17 +115,6 @@ class AudioFrame {
void CopyFrom(const AudioFrame& src);
- // Sets a wall-time clock timestamp in milliseconds to be used for profiling
- // of time between two points in the audio chain.
- // Example:
- // t0: UpdateProfileTimeStamp()
- // t1: ElapsedProfileTimeMs() => t1 - t0 [msec]
- void UpdateProfileTimeStamp();
- // Returns the time difference between now and when UpdateProfileTimeStamp()
- // was last called. Returns -1 if UpdateProfileTimeStamp() has not yet been
- // called.
- int64_t ElapsedProfileTimeMs() const;
-
// data() returns a zeroed static buffer if the frame is muted.
// TODO: b/335805780 - Return InterleavedView.
const int16_t* data() const;
@@ -189,12 +178,6 @@ class AudioFrame {
size_t num_channels_ = 0;
SpeechType speech_type_ = kUndefined;
VADActivity vad_activity_ = kVadUnknown;
- // Monotonically increasing timestamp intended for profiling of audio frames.
- // Typically used for measuring elapsed time between two different points in
- // the audio path. No lock is used to save resources and we are thread safe
- // by design.
- // TODO(nisse@webrtc.org): consider using std::optional.
- int64_t profile_timestamp_ms_ = 0;
// Information about packets used to assemble this audio frame. This is needed
// by `SourceTracker` when the frame is delivered to the RTCRtpReceiver's
diff --git a/third_party/libwebrtc/audio/BUILD.gn b/third_party/libwebrtc/audio/BUILD.gn
@@ -238,6 +238,7 @@ if (rtc_include_tests) {
"../rtc_base:timeutils",
"../system_wrappers",
"../test:audio_codec_mocks",
+ "../test:create_test_environment",
"../test:create_test_field_trials",
"../test:mock_transport",
"../test:rtp_test_utils",
diff --git a/third_party/libwebrtc/audio/channel_send.cc b/third_party/libwebrtc/audio/channel_send.cc
@@ -909,9 +909,9 @@ void ChannelSend::ProcessAndEncodeAudio(
// Profile time between when the audio frame is added to the task queue and
// when the task is actually executed.
- audio_frame->UpdateProfileTimeStamp();
+ Timestamp post_task_time = env_.clock().CurrentTime();
encoder_queue_->PostTask(
- [this, audio_frame = std::move(audio_frame)]() mutable {
+ [this, post_task_time, audio_frame = std::move(audio_frame)]() mutable {
RTC_DCHECK_RUN_ON(&encoder_queue_checker_);
if (!encoder_queue_is_active_.load()) {
return;
@@ -919,8 +919,9 @@ void ChannelSend::ProcessAndEncodeAudio(
// Measure time between when the audio frame is added to the task queue
// and when the task is actually executed. Goal is to keep track of
// unwanted extra latency added by the task queue.
+ TimeDelta latency = post_task_time - env_.clock().CurrentTime();
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Audio.EncodingTaskQueueLatencyMs",
- audio_frame->ElapsedProfileTimeMs());
+ latency.ms());
bool is_muted = InputMute();
AudioFrameOperations::Mute(audio_frame.get(), previous_frame_muted_,
diff --git a/third_party/libwebrtc/audio/channel_send_unittest.cc b/third_party/libwebrtc/audio/channel_send_unittest.cc
@@ -27,7 +27,6 @@
#include "api/call/transport.h"
#include "api/crypto/crypto_options.h"
#include "api/environment/environment.h"
-#include "api/environment/environment_factory.h"
#include "api/field_trials.h"
#include "api/frame_transformer_interface.h"
#include "api/make_ref_counted.h"
@@ -44,6 +43,7 @@
#include "call/rtp_transport_controller_send.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
+#include "test/create_test_environment.h"
#include "test/create_test_field_trials.h"
#include "test/gmock.h"
#include "test/gtest.h"
@@ -81,9 +81,8 @@ class ChannelSendTest : public ::testing::Test {
ChannelSendTest()
: time_controller_(Timestamp::Seconds(1)),
field_trials_(CreateTestFieldTrials()),
- env_(CreateEnvironment(&field_trials_,
- time_controller_.GetClock(),
- time_controller_.CreateTaskQueueFactory())),
+ env_(CreateTestEnvironment(
+ {.field_trials = &field_trials_, .time = &time_controller_})),
transport_controller_(
RtpTransportConfig{.env = env_,
.bitrate_config = GetBitrateConfig()}) {
diff --git a/third_party/libwebrtc/moz-patch-stack/s0029.patch b/third_party/libwebrtc/moz-patch-stack/s0029.patch
@@ -27,7 +27,7 @@ index 4710362715..a56b45d405 100644
stats.header_and_padding_bytes_sent =
channel_stats.header_and_padding_bytes_sent;
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
-index fbda6e852e..7536645e4e 100644
+index 8ce4c6b8b1..398ef2be74 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -81,6 +81,32 @@ constexpr TimeDelta kMinRetransmissionWindow = TimeDelta::Millis(30);
diff --git a/third_party/libwebrtc/moz-patch-stack/s0070.patch b/third_party/libwebrtc/moz-patch-stack/s0070.patch
@@ -12,7 +12,7 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/6ac6592a04a839a61
1 file changed, 2 deletions(-)
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
-index 7536645e4e..b90b4b2867 100644
+index 398ef2be74..b826403694 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -572,8 +572,6 @@ ChannelSend::ChannelSend(
diff --git a/third_party/libwebrtc/moz-patch-stack/s0102.patch b/third_party/libwebrtc/moz-patch-stack/s0102.patch
@@ -276,7 +276,7 @@ index c6040740ce..70ed476401 100644
rtc_library("scalability_mode") {
diff --git a/audio/BUILD.gn b/audio/BUILD.gn
-index eda3161da8..612028625a 100644
+index 3773ab8173..d2734974c9 100644
--- a/audio/BUILD.gn
+++ b/audio/BUILD.gn
@@ -8,8 +8,8 @@