Bug 1876843 - Vendor libwebrtc from 702820d087

Upstream commit: https://webrtc.googlesource.com/src/+/702820d08780d201c06394c09f6a227f8b37d40a
    Update rtc tools to create Call using Environment

    Bug: webrtc:15656
    Change-Id: I2bf17e95f4c8b26dcb735eb5198d5347a97dee69
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/329082
    Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
    Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#41261}
This commit is contained in:
Jan-Ivar Bruaroey 2024-02-10 16:37:36 -05:00
Родитель 8c3d6e44b9
Коммит 3ec236c5ba
6 изменённых файлов: 31 добавлений и 42 удалений

3
third_party/libwebrtc/README.moz-ff-commit поставляемый
Просмотреть файл

@ -27507,3 +27507,6 @@ db329edf40
# MOZ_LIBWEBRTC_SRC=/Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
75aa7e94dd
# MOZ_LIBWEBRTC_SRC=/Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
702820d087

2
third_party/libwebrtc/README.mozilla поставляемый
Просмотреть файл

@ -18362,3 +18362,5 @@ libwebrtc updated from /Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc c
libwebrtc updated from /Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2024-02-10T21:34:50.675233.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2024-02-10T21:35:52.943079.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2024-02-10T21:37:26.872946.

10
third_party/libwebrtc/rtc_tools/BUILD.gn поставляемый
Просмотреть файл

@ -204,9 +204,8 @@ if (!is_component_build) {
"../api:create_frame_generator",
"../api:rtp_parameters",
"../api:transport_api",
"../api/rtc_event_log",
"../api/task_queue:default_task_queue_factory",
"../api/task_queue:task_queue",
"../api/environment",
"../api/environment:environment_factory",
"../api/video:builtin_video_bitrate_allocator_factory",
"../api/video_codecs:video_codecs_api",
"../call",
@ -257,8 +256,8 @@ if (!is_component_build) {
deps = [
"../api:field_trials",
"../api:rtp_parameters",
"../api/rtc_event_log",
"../api/task_queue:default_task_queue_factory",
"../api/environment",
"../api/environment:environment_factory",
"../api/test/video:function_video_factory",
"../api/transport:field_trial_based_config",
"../api/units:timestamp",
@ -273,7 +272,6 @@ if (!is_component_build) {
"../rtc_base:checks",
"../rtc_base:rtc_json",
"../rtc_base:stringutils",
"../rtc_base:timeutils",
"../system_wrappers",
"../test:call_config_utils",
"../test:encoder_settings",

Просмотреть файл

@ -14,7 +14,7 @@
#include <memory>
#include <utility>
#include "api/task_queue/default_task_queue_factory.h"
#include "api/environment/environment_factory.h"
#include "api/test/create_frame_generator.h"
#include "api/video_codecs/video_decoder_factory_template.h"
#include "api/video_codecs/video_decoder_factory_template_dav1d_adapter.h"
@ -171,6 +171,7 @@ absl::optional<RtpGeneratorOptions> ParseRtpGeneratorOptionsFromFile(
RtpGenerator::RtpGenerator(const RtpGeneratorOptions& options)
: options_(options),
env_(CreateEnvironment()),
video_encoder_factory_(
std::make_unique<webrtc::VideoEncoderFactoryTemplate<
webrtc::LibvpxVp8EncoderTemplateAdapter,
@ -183,9 +184,7 @@ RtpGenerator::RtpGenerator(const RtpGeneratorOptions& options)
webrtc::Dav1dDecoderTemplateAdapter>>()),
video_bitrate_allocator_factory_(
CreateBuiltinVideoBitrateAllocatorFactory()),
event_log_(std::make_unique<RtcEventLogNull>()),
call_(Call::Create(CallConfig(event_log_.get()))),
task_queue_(CreateDefaultTaskQueueFactory()) {
call_(Call::Create(CallConfig(env_))) {
constexpr int kMinBitrateBps = 30000; // 30 Kbps
constexpr int kMaxBitrateBps = 2500000; // 2.5 Mbps
@ -246,11 +245,11 @@ RtpGenerator::RtpGenerator(const RtpGeneratorOptions& options)
// Setup the fake video stream for this.
std::unique_ptr<test::FrameGeneratorCapturer> frame_generator =
std::make_unique<test::FrameGeneratorCapturer>(
Clock::GetRealTimeClock(),
&env_.clock(),
test::CreateSquareFrameGenerator(send_config.video_width,
send_config.video_height,
absl::nullopt, absl::nullopt),
send_config.video_fps, *task_queue_);
send_config.video_fps, env_.task_queue_factory());
frame_generator->Init();
VideoSendStream* video_send_stream = call_->CreateVideoSendStream(

Просмотреть файл

@ -16,9 +16,8 @@
#include <vector>
#include "api/call/transport.h"
#include "api/environment/environment.h"
#include "api/media_types.h"
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/task_queue/task_queue_factory.h"
#include "api/video/builtin_video_bitrate_allocator_factory.h"
#include "api/video_codecs/video_decoder_factory.h"
#include "api/video_codecs/video_encoder_factory.h"
@ -104,18 +103,17 @@ class RtpGenerator final : public webrtc::Transport {
test::RtpPacket DataToRtpPacket(const uint8_t* packet, size_t packet_len);
const RtpGeneratorOptions options_;
const Environment env_;
std::unique_ptr<VideoEncoderFactory> video_encoder_factory_;
std::unique_ptr<VideoDecoderFactory> video_decoder_factory_;
std::unique_ptr<VideoBitrateAllocatorFactory>
video_bitrate_allocator_factory_;
std::unique_ptr<RtcEventLog> event_log_;
std::unique_ptr<Call> call_;
std::unique_ptr<test::RtpFileWriter> rtp_dump_writer_;
std::vector<std::unique_ptr<test::FrameGeneratorCapturer>> frame_generators_;
std::vector<VideoSendStream*> video_send_streams_;
std::vector<uint32_t> durations_ms_;
uint32_t start_ms_ = 0;
std::unique_ptr<TaskQueueFactory> task_queue_;
};
} // namespace webrtc

Просмотреть файл

@ -16,10 +16,10 @@
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#include "api/environment/environment.h"
#include "api/environment/environment_factory.h"
#include "api/field_trials.h"
#include "api/media_types.h"
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/task_queue/default_task_queue_factory.h"
#include "api/test/video/function_video_decoder_factory.h"
#include "api/transport/field_trial_based_config.h"
#include "api/units/timestamp.h"
@ -36,7 +36,6 @@
#include "rtc_base/checks.h"
#include "rtc_base/string_to_number.h"
#include "rtc_base/strings/json.h"
#include "rtc_base/time_utils.h"
#include "system_wrappers/include/clock.h"
#include "system_wrappers/include/sleep.h"
#include "test/call_config_utils.h"
@ -478,26 +477,21 @@ class RtpReplayer final {
bool simulated_time)
: replay_config_path_(replay_config_path),
rtp_dump_path_(rtp_dump_path),
field_trials_(std::move(field_trials)),
time_sim_(simulated_time
? std::make_unique<GlobalSimulatedTimeController>(
Timestamp::Millis(1 << 30))
: nullptr),
env_(CreateEnvironment(
std::move(field_trials),
time_sim_ ? time_sim_->GetTaskQueueFactory() : nullptr,
time_sim_ ? time_sim_->GetClock() : nullptr)),
rtp_reader_(CreateRtpReader(rtp_dump_path_)) {
TaskQueueFactory* task_queue_factory;
if (simulated_time) {
time_sim_ = std::make_unique<GlobalSimulatedTimeController>(
Timestamp::Millis(1 << 30));
task_queue_factory = time_sim_->GetTaskQueueFactory();
} else {
task_queue_factory_ = CreateDefaultTaskQueueFactory(field_trials_.get()),
task_queue_factory = task_queue_factory_.get();
}
worker_thread_ =
std::make_unique<rtc::TaskQueue>(task_queue_factory->CreateTaskQueue(
worker_thread_ = std::make_unique<rtc::TaskQueue>(
env_.task_queue_factory().CreateTaskQueue(
"worker_thread", TaskQueueFactory::Priority::NORMAL));
rtc::Event event;
worker_thread_->PostTask([&]() {
CallConfig call_config(&event_log_);
call_config.trials = field_trials_.get();
call_config.task_queue_factory = task_queue_factory;
call_ = Call::Create(call_config);
call_ = Call::Create(CallConfig(env_));
// Creation of the streams must happen inside a task queue because it is
// resued as a worker thread.
@ -655,10 +649,7 @@ class RtpReplayer final {
}
}
int64_t CurrentTimeMs() {
return time_sim_ ? time_sim_->GetClock()->TimeInMilliseconds()
: rtc::TimeMillis();
}
int64_t CurrentTimeMs() { return env_.clock().CurrentTime().ms(); }
void SleepOrAdvanceTime(int64_t duration_ms) {
if (time_sim_) {
@ -670,10 +661,8 @@ class RtpReplayer final {
const std::string replay_config_path_;
const std::string rtp_dump_path_;
RtcEventLogNull event_log_;
std::unique_ptr<FieldTrialsView> field_trials_;
std::unique_ptr<GlobalSimulatedTimeController> time_sim_;
std::unique_ptr<TaskQueueFactory> task_queue_factory_;
Environment env_;
std::unique_ptr<rtc::TaskQueue> worker_thread_;
std::unique_ptr<Call> call_;
std::unique_ptr<test::RtpFileReader> rtp_reader_;