From f887e072342affda83893d8bbeee53aa93130230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Tue, 5 Dec 2023 11:27:45 +0100 Subject: [PATCH] Rename "metronome" to "decode_metronome". MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In preparation for experimentally supporting different types of metronomes and metronome use cases we'd like to rename for clarity. This is the first step, which introduces the new name and prefers it if it is set, but keeps the old name for backwards compat reasons. Once Chromium has migrated to the new name, we can delete the old name. Bug: webrtc:15704 Change-Id: I23077bf2415ebb2b2338320c9a14e3bd17d3abb6 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/330020 Commit-Queue: Henrik Boström Commit-Queue: Harald Alvestrand Reviewed-by: Harald Alvestrand Reviewed-by: Markus Handell Auto-Submit: Henrik Boström Cr-Commit-Position: refs/heads/main@{#41319} --- api/peer_connection_interface.h | 5 +++++ call/call.cc | 11 ++++++----- call/call_config.h | 2 +- pc/peer_connection_factory.cc | 8 +++++--- pc/peer_connection_factory.h | 2 +- pc/test/integration_test_helpers.h | 2 +- 6 files changed, 19 insertions(+), 11 deletions(-) diff --git a/api/peer_connection_interface.h b/api/peer_connection_interface.h index 74c4702cd2..32aef97f1b 100644 --- a/api/peer_connection_interface.h +++ b/api/peer_connection_interface.h @@ -1441,6 +1441,11 @@ struct RTC_EXPORT PeerConnectionFactoryDependencies final { std::unique_ptr trials; std::unique_ptr transport_controller_send_factory; + // Metronome used for decoding, must be called on the worker thread. + std::unique_ptr decode_metronome; + // Old name for `decode_metronome`. + // TODO(https://crbug.com/webrtc/15704): When callers have migrated to + // `decode_metronome`, delete this. std::unique_ptr metronome; // Media specific dependencies. Unused when `media_factory == nullptr`. diff --git a/call/call.cc b/call/call.cc index 05d25b2fa1..d9ea94a06a 100644 --- a/call/call.cc +++ b/call/call.cc @@ -659,11 +659,12 @@ Call::Call(Clock* clock, // must be made on `worker_thread_` (i.e. they're one and the same). network_thread_(config.network_task_queue_ ? config.network_task_queue_ : worker_thread_), - decode_sync_(config.metronome - ? std::make_unique(clock_, - config.metronome, - worker_thread_) - : nullptr), + decode_sync_( + config.decode_metronome + ? std::make_unique(clock_, + config.decode_metronome, + worker_thread_) + : nullptr), num_cpu_cores_(CpuInfo::DetectNumberOfCores()), call_stats_(new CallStats(clock_, worker_thread_)), bitrate_allocator_(new BitrateAllocator(this)), diff --git a/call/call_config.h b/call/call_config.h index 24b9910ee7..0642cc2b85 100644 --- a/call/call_config.h +++ b/call/call_config.h @@ -68,7 +68,7 @@ struct CallConfig { RtpTransportControllerSendFactoryInterface* rtp_transport_controller_send_factory = nullptr; - Metronome* metronome = nullptr; + Metronome* decode_metronome = nullptr; // Enables send packet batching from the egress RTP sender. bool enable_send_packet_batching = false; diff --git a/pc/peer_connection_factory.cc b/pc/peer_connection_factory.cc index 8ce44d374f..7539282fcf 100644 --- a/pc/peer_connection_factory.cc +++ b/pc/peer_connection_factory.cc @@ -103,7 +103,9 @@ PeerConnectionFactory::PeerConnectionFactory( (dependencies->transport_controller_send_factory) ? std::move(dependencies->transport_controller_send_factory) : std::make_unique()), - metronome_(std::move(dependencies->metronome)) {} + decode_metronome_(dependencies->decode_metronome + ? std::move(dependencies->decode_metronome) + : std::move(dependencies->metronome)) {} PeerConnectionFactory::PeerConnectionFactory( PeerConnectionFactoryDependencies dependencies) @@ -118,7 +120,7 @@ PeerConnectionFactory::~PeerConnectionFactory() { RTC_DCHECK_RUN_ON(signaling_thread()); worker_thread()->BlockingCall([this] { RTC_DCHECK_RUN_ON(worker_thread()); - metronome_ = nullptr; + decode_metronome_ = nullptr; }); } @@ -343,7 +345,7 @@ std::unique_ptr PeerConnectionFactory::CreateCall_w( call_config.rtp_transport_controller_send_factory = transport_controller_send_factory_.get(); - call_config.metronome = metronome_.get(); + call_config.decode_metronome = decode_metronome_.get(); return context_->call_factory()->CreateCall(call_config); } diff --git a/pc/peer_connection_factory.h b/pc/peer_connection_factory.h index c3760c02c9..66f67259c6 100644 --- a/pc/peer_connection_factory.h +++ b/pc/peer_connection_factory.h @@ -147,7 +147,7 @@ class PeerConnectionFactory : public PeerConnectionFactoryInterface { std::unique_ptr neteq_factory_; const std::unique_ptr transport_controller_send_factory_; - std::unique_ptr metronome_ RTC_GUARDED_BY(worker_thread()); + std::unique_ptr decode_metronome_ RTC_GUARDED_BY(worker_thread()); }; } // namespace webrtc diff --git a/pc/test/integration_test_helpers.h b/pc/test/integration_test_helpers.h index fb719e7ddd..03711fd0d7 100644 --- a/pc/test/integration_test_helpers.h +++ b/pc/test/integration_test_helpers.h @@ -773,7 +773,7 @@ class PeerConnectionIntegrationWrapper : public PeerConnectionObserver, pc_factory_dependencies.task_queue_factory = CreateDefaultTaskQueueFactory(); pc_factory_dependencies.trials = std::make_unique(); - pc_factory_dependencies.metronome = + pc_factory_dependencies.decode_metronome = std::make_unique(TimeDelta::Millis(8)); pc_factory_dependencies.adm = fake_audio_capture_module_;