summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/logging
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /third_party/libwebrtc/logging
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--third_party/libwebrtc/logging/BUILD.gn10
-rw-r--r--third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_impl.cc44
-rw-r--r--third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_impl.h13
3 files changed, 36 insertions, 31 deletions
diff --git a/third_party/libwebrtc/logging/BUILD.gn b/third_party/libwebrtc/logging/BUILD.gn
index 92f55edfa0..91890553a3 100644
--- a/third_party/libwebrtc/logging/BUILD.gn
+++ b/third_party/libwebrtc/logging/BUILD.gn
@@ -82,6 +82,7 @@ rtc_library("rtc_stream_config") {
}
rtc_library("rtc_event_pacing") {
+ visibility = [ "*" ]
sources = [
"rtc_event_log/events/rtc_event_alr_state.cc",
"rtc_event_log/events/rtc_event_alr_state.h",
@@ -99,6 +100,7 @@ rtc_library("rtc_event_pacing") {
}
rtc_library("rtc_event_audio") {
+ visibility = [ "*" ]
sources = [
"rtc_event_log/events/rtc_event_audio_network_adaptation.cc",
"rtc_event_log/events/rtc_event_audio_network_adaptation.h",
@@ -143,6 +145,7 @@ rtc_library("rtc_event_begin_end") {
}
rtc_library("rtc_event_bwe") {
+ visibility = [ "*" ]
sources = [
"rtc_event_log/events/rtc_event_bwe_update_delay_based.cc",
"rtc_event_log/events/rtc_event_bwe_update_delay_based.h",
@@ -174,6 +177,7 @@ rtc_library("rtc_event_bwe") {
}
rtc_library("rtc_event_frame_events") {
+ visibility = [ "*" ]
sources = [
"rtc_event_log/events/rtc_event_frame_decoded.cc",
"rtc_event_log/events/rtc_event_frame_decoded.h",
@@ -216,6 +220,7 @@ rtc_library("rtc_event_generic_packet_events") {
}
rtc_library("rtc_event_rtp_rtcp") {
+ visibility = [ "*" ]
sources = [
"rtc_event_log/events/logged_rtp_rtcp.h",
"rtc_event_log/events/rtc_event_rtcp_packet_incoming.cc",
@@ -245,6 +250,7 @@ rtc_library("rtc_event_rtp_rtcp") {
}
rtc_library("rtc_event_video") {
+ visibility = [ "*" ]
sources = [
"rtc_event_log/events/rtc_event_video_receive_stream_config.cc",
"rtc_event_log/events/rtc_event_video_receive_stream_config.h",
@@ -450,8 +456,10 @@ if (rtc_enable_protobuf) {
":ice_log",
":rtc_event_log_api",
":rtc_event_log_impl_encoder",
+ "../api:field_trials_view",
"../api:libjingle_logging_api",
"../api:sequence_checker",
+ "../api/environment",
"../api/rtc_event_log",
"../api/task_queue",
"../api/units:time_delta",
@@ -459,7 +467,6 @@ if (rtc_enable_protobuf) {
"../rtc_base:logging",
"../rtc_base:macromagic",
"../rtc_base:rtc_event",
- "../rtc_base:rtc_task_queue",
"../rtc_base:safe_conversions",
"../rtc_base:safe_minmax",
"../rtc_base:timeutils",
@@ -666,6 +673,7 @@ if (rtc_enable_protobuf) {
}
rtc_library("ice_log") {
+ visibility = [ "*" ]
sources = [
"rtc_event_log/events/rtc_event_dtls_transport_state.cc",
"rtc_event_log/events/rtc_event_dtls_transport_state.h",
diff --git a/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_impl.cc b/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_impl.cc
index f2b3f22d6a..419afd330a 100644
--- a/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_impl.cc
+++ b/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_impl.cc
@@ -17,6 +17,8 @@
#include <vector>
#include "absl/strings/string_view.h"
+#include "api/environment/environment.h"
+#include "api/field_trials_view.h"
#include "api/task_queue/task_queue_base.h"
#include "api/units/time_delta.h"
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.h"
@@ -29,24 +31,23 @@
#include "rtc_base/time_utils.h"
namespace webrtc {
+namespace {
-std::unique_ptr<RtcEventLogEncoder> RtcEventLogImpl::CreateEncoder(
- RtcEventLog::EncodingType type) {
- switch (type) {
- case RtcEventLog::EncodingType::Legacy:
- RTC_DLOG(LS_INFO) << "Creating legacy encoder for RTC event log.";
- return std::make_unique<RtcEventLogEncoderLegacy>();
- case RtcEventLog::EncodingType::NewFormat:
- RTC_DLOG(LS_INFO) << "Creating new format encoder for RTC event log.";
- return std::make_unique<RtcEventLogEncoderNewFormat>();
- default:
- RTC_LOG(LS_ERROR) << "Unknown RtcEventLog encoder type (" << int(type)
- << ")";
- RTC_DCHECK_NOTREACHED();
- return std::unique_ptr<RtcEventLogEncoder>(nullptr);
+std::unique_ptr<RtcEventLogEncoder> CreateEncoder(const Environment& env) {
+ if (env.field_trials().IsDisabled("WebRTC-RtcEventLogNewFormat")) {
+ RTC_DLOG(LS_INFO) << "Creating legacy encoder for RTC event log.";
+ return std::make_unique<RtcEventLogEncoderLegacy>();
+ } else {
+ RTC_DLOG(LS_INFO) << "Creating new format encoder for RTC event log.";
+ return std::make_unique<RtcEventLogEncoderNewFormat>();
}
}
+} // namespace
+
+RtcEventLogImpl::RtcEventLogImpl(const Environment& env)
+ : RtcEventLogImpl(CreateEncoder(env), &env.task_queue_factory()) {}
+
RtcEventLogImpl::RtcEventLogImpl(std::unique_ptr<RtcEventLogEncoder> encoder,
TaskQueueFactory* task_queue_factory,
size_t max_events_in_history,
@@ -55,10 +56,9 @@ RtcEventLogImpl::RtcEventLogImpl(std::unique_ptr<RtcEventLogEncoder> encoder,
max_config_events_in_history_(max_config_events_in_history),
event_encoder_(std::move(encoder)),
last_output_ms_(rtc::TimeMillis()),
- task_queue_(
- std::make_unique<rtc::TaskQueue>(task_queue_factory->CreateTaskQueue(
- "rtc_event_log",
- TaskQueueFactory::Priority::NORMAL))) {}
+ task_queue_(task_queue_factory->CreateTaskQueue(
+ "rtc_event_log",
+ TaskQueueFactory::Priority::NORMAL)) {}
RtcEventLogImpl::~RtcEventLogImpl() {
// If we're logging to the output, this will stop that. Blocking function.
@@ -71,10 +71,12 @@ RtcEventLogImpl::~RtcEventLogImpl() {
StopLogging();
}
- // We want to block on any executing task by invoking ~TaskQueue() before
+ // Since we are posting tasks bound to `this`, it is critical that the event
+ // log and its members outlive `task_queue_`. Destruct `task_queue_` first
+ // to ensure tasks living on the queue can access other members.
+ // We want to block on any executing task by deleting TaskQueue before
// we set unique_ptr's internal pointer to null.
- rtc::TaskQueue* tq = task_queue_.get();
- delete tq;
+ task_queue_.get_deleter()(task_queue_.get());
task_queue_.release();
}
diff --git a/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_impl.h b/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_impl.h
index 3187a7fe87..2c4ef8d7ed 100644
--- a/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_impl.h
+++ b/third_party/libwebrtc/logging/rtc_event_log/rtc_event_log_impl.h
@@ -18,14 +18,15 @@
#include <string>
#include "absl/strings/string_view.h"
+#include "api/environment/environment.h"
#include "api/rtc_event_log/rtc_event.h"
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/rtc_event_log_output.h"
#include "api/sequence_checker.h"
+#include "api/task_queue/task_queue_base.h"
#include "api/task_queue/task_queue_factory.h"
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder.h"
#include "rtc_base/system/no_unique_address.h"
-#include "rtc_base/task_queue.h"
#include "rtc_base/thread_annotations.h"
namespace webrtc {
@@ -39,6 +40,7 @@ class RtcEventLogImpl final : public RtcEventLog {
// bound to prevent an attack via unreasonable memory use.
static constexpr size_t kMaxEventsInConfigHistory = 1000;
+ explicit RtcEventLogImpl(const Environment& env);
RtcEventLogImpl(
std::unique_ptr<RtcEventLogEncoder> encoder,
TaskQueueFactory* task_queue_factory,
@@ -49,9 +51,6 @@ class RtcEventLogImpl final : public RtcEventLog {
~RtcEventLogImpl() override;
- static std::unique_ptr<RtcEventLogEncoder> CreateEncoder(
- EncodingType encoding_type);
-
// TODO(eladalon): We should change these name to reflect that what we're
// actually starting/stopping is the output of the log, not the log itself.
bool StartLogging(std::unique_ptr<RtcEventLogOutput> output,
@@ -114,11 +113,7 @@ class RtcEventLogImpl final : public RtcEventLog {
bool immediately_output_mode_ RTC_GUARDED_BY(mutex_) = false;
bool need_schedule_output_ RTC_GUARDED_BY(mutex_) = false;
- // Since we are posting tasks bound to `this`, it is critical that the event
- // log and its members outlive `task_queue_`. Keep the `task_queue_`
- // last to ensure it destructs first, or else tasks living on the queue might
- // access other members after they've been torn down.
- std::unique_ptr<rtc::TaskQueue> task_queue_;
+ std::unique_ptr<TaskQueueBase, TaskQueueDeleter> task_queue_;
Mutex mutex_;
};