Adds simulated time controller API.

Bug: webrtc:11255
Change-Id: I68289a45b9441b5e612433acd96dc3cb24e47ce4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168122
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30443}
This commit is contained in:
Sebastian Jansson
2020-02-03 09:30:07 +01:00
committed by Commit Bot
parent 6e07cde22c
commit 09a9f1ba72
3 changed files with 11 additions and 0 deletions

View File

@ -943,6 +943,7 @@ if (rtc_include_tests) {
deps = [
":callfactory_api",
":time_controller",
"../call",
"../call:call_interfaces",
"../test/time_controller",
]

View File

@ -14,6 +14,7 @@
#include "call/call.h"
#include "test/time_controller/external_time_controller.h"
#include "test/time_controller/simulated_time_controller.h"
namespace webrtc {
@ -22,6 +23,11 @@ std::unique_ptr<TimeController> CreateTimeController(
return std::make_unique<ExternalTimeController>(alarm);
}
std::unique_ptr<TimeController> CreateSimulatedTimeController() {
return std::make_unique<GlobalSimulatedTimeController>(
Timestamp::seconds(10000));
}
std::unique_ptr<CallFactoryInterface> CreateTimeControllerBasedCallFactory(
TimeController* time_controller) {
class TimeControllerBasedCallFactory : public CallFactoryInterface {

View File

@ -17,9 +17,13 @@
namespace webrtc {
// Creates a time coltroller that wraps |alarm|.
std::unique_ptr<TimeController> CreateTimeController(
ControlledAlarmClock* alarm);
// Creates a time controller that runs in simulated time.
std::unique_ptr<TimeController> CreateSimulatedTimeController();
// This is creates a call factory that creates Call instances that are backed by
// a time controller.
std::unique_ptr<CallFactoryInterface> CreateTimeControllerBasedCallFactory(