diff --git a/api/neteq/BUILD.gn b/api/neteq/BUILD.gn index f1e5d1d68a..1ab02ec92b 100644 --- a/api/neteq/BUILD.gn +++ b/api/neteq/BUILD.gn @@ -55,6 +55,7 @@ rtc_source_set("neteq_controller_api") { ":neteq_api", ":tick_timer", "../../rtc_base:rtc_base_approved", + "../../system_wrappers:system_wrappers", "//third_party/abseil-cpp/absl/types:optional", ] } diff --git a/api/neteq/DEPS b/api/neteq/DEPS index 14dd963f65..6c1c602b42 100644 --- a/api/neteq/DEPS +++ b/api/neteq/DEPS @@ -1,11 +1,14 @@ specific_include_rules = { - "neteq_factory\.h": [ - "+system_wrappers/include/clock.h", - ], "custom_neteq_factory\.h": [ "+system_wrappers/include/clock.h", ], "default_neteq_factory\.h": [ "+system_wrappers/include/clock.h", ], + "neteq_controller\.h": [ + "+system_wrappers/include/clock.h", + ], + "neteq_factory\.h": [ + "+system_wrappers/include/clock.h", + ], } diff --git a/api/neteq/OWNERS b/api/neteq/OWNERS new file mode 100644 index 0000000000..2a16031983 --- /dev/null +++ b/api/neteq/OWNERS @@ -0,0 +1,2 @@ +ivoc@webrtc.org +hlundin@webrtc.org diff --git a/api/neteq/neteq_controller.h b/api/neteq/neteq_controller.h index dfd697b843..1d47eaca78 100644 --- a/api/neteq/neteq_controller.h +++ b/api/neteq/neteq_controller.h @@ -20,6 +20,7 @@ #include "absl/types/optional.h" #include "api/neteq/neteq.h" #include "api/neteq/tick_timer.h" +#include "system_wrappers/include/clock.h" namespace webrtc { @@ -67,6 +68,7 @@ class NetEqController { int max_packets_in_buffer; int base_min_delay_ms; TickTimer* tick_timer; + webrtc::Clock* clock = nullptr; }; struct PacketInfo { @@ -92,6 +94,7 @@ class NetEqController { bool play_dtmf; size_t generated_noise_samples; PacketBufferInfo packet_buffer_info; + size_t sync_buffer_samples; }; virtual ~NetEqController() = default; diff --git a/modules/audio_coding/neteq/neteq_impl.cc b/modules/audio_coding/neteq/neteq_impl.cc index d0945d7652..265043acb4 100644 --- a/modules/audio_coding/neteq/neteq_impl.cc +++ b/modules/audio_coding/neteq/neteq_impl.cc @@ -61,13 +61,15 @@ std::unique_ptr CreateNetEqController( int max_packets_in_buffer, bool enable_rtx_handling, bool allow_time_stretching, - TickTimer* tick_timer) { + TickTimer* tick_timer, + webrtc::Clock* clock) { NetEqController::Config config; config.base_min_delay_ms = base_min_delay; config.max_packets_in_buffer = max_packets_in_buffer; config.enable_rtx_handling = enable_rtx_handling; config.allow_time_stretching = allow_time_stretching; config.tick_timer = tick_timer; + config.clock = clock; return controller_factory.CreateNetEqController(config); } @@ -93,7 +95,8 @@ NetEqImpl::Dependencies::Dependencies( config.max_packets_in_buffer, config.enable_rtx_handling, !config.for_test_no_time_stretching, - tick_timer.get())), + tick_timer.get(), + clock)), red_payload_splitter(new RedPayloadSplitter), timestamp_scaler(new TimestampScaler(*decoder_database)), accelerate_factory(new AccelerateFactory), @@ -1084,6 +1087,7 @@ int NetEqImpl::GetDecision(Operation* operation, status.last_mode = last_mode_; status.play_dtmf = *play_dtmf; status.generated_noise_samples = generated_noise_samples; + status.sync_buffer_samples = sync_buffer_->FutureLength(); if (packet) { status.next_packet = { packet->timestamp, packet->frame && packet->frame->IsDtxPacket(), diff --git a/modules/audio_coding/neteq/neteq_impl_unittest.cc b/modules/audio_coding/neteq/neteq_impl_unittest.cc index 33e3d8d2d2..5c7259f00b 100644 --- a/modules/audio_coding/neteq/neteq_impl_unittest.cc +++ b/modules/audio_coding/neteq/neteq_impl_unittest.cc @@ -125,6 +125,7 @@ class NetEqImplTest : public ::testing::Test { controller_config.enable_rtx_handling = config_.enable_rtx_handling; controller_config.allow_time_stretching = true; controller_config.max_packets_in_buffer = config_.max_packets_in_buffer; + controller_config.clock = &clock_; deps.neteq_controller = std::make_unique(std::move(controller_config)); }