Bug 1883116 - (fix-e79e722834) add enviroment_factory to libwebrtc build and enforce providing clock and task_queue when creating Environment

This commit is contained in:
Dan Baker 2024-03-18 13:34:02 -05:00
parent daaf634705
commit d6c3eea8e1
3 changed files with 16 additions and 0 deletions

View File

@ -580,6 +580,7 @@ if (!build_with_chromium) {
if (build_with_mozilla) {
deps += [
"api/environment:environment_factory",
"api/video:video_frame",
"api/video:video_rtp_headers",
"test:rtp_test_utils",

View File

@ -97,12 +97,22 @@ Environment EnvironmentFactory::CreateWithDefaults() && {
if (field_trials_ == nullptr) {
Set(std::make_unique<FieldTrialBasedConfig>());
}
#if defined(WEBRTC_MOZILLA_BUILD)
// We want to use our clock, not GetRealTimeClockRaw, and we avoid
// building the code under third_party/libwebrtc/task_queue. To
// ensure we're setting up things correctly, namely providing an
// Environment object with a preset task_queue_factory and clock,
// we'll do a release assert here.
RTC_CHECK(clock_);
RTC_CHECK(task_queue_factory_);
#else
if (clock_ == nullptr) {
Set(Clock::GetRealTimeClock());
}
if (task_queue_factory_ == nullptr) {
Set(CreateDefaultTaskQueueFactory(field_trials_));
}
#endif
if (event_log_ == nullptr) {
Set(std::make_unique<RtcEventLogNull>());
}

View File

@ -88,6 +88,10 @@ rtc_library("task_queue_test") {
}
rtc_library("default_task_queue_factory") {
# Mozilla - disable this entire target to avoid inclusion of code we want
# to avoid. Better here than trying to wack-a-mole for places that list
# it as a dependency.
if (!build_with_mozilla) {
visibility = [ "*" ]
if (!is_ios && !is_android) {
# Internally webrtc shouldn't rely on any specific TaskQueue implementation
@ -126,6 +130,7 @@ rtc_library("default_task_queue_factory") {
sources += [ "default_task_queue_factory_stdlib.cc" ]
deps += [ "../../rtc_base:rtc_task_queue_stdlib" ]
}
} # of if (!build_with_mozilla) {
}
rtc_library("pending_task_safety_flag") {