Add API to get current time mode from NetworkEmulationManager
Bug: None Change-Id: I1aeca7484bab2b9bc28684b055b8f6bb86135327 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/203888 Reviewed-by: Andrey Logvin <landrey@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33074}
This commit is contained in:
@ -167,6 +167,8 @@ class NetworkEmulationManager {
|
||||
virtual ~NetworkEmulationManager() = default;
|
||||
|
||||
virtual TimeController* time_controller() = 0;
|
||||
// Returns a mode in which underlying time controller operates.
|
||||
virtual TimeMode time_mode() const = 0;
|
||||
|
||||
// Creates an emulated network node, which represents single network in
|
||||
// the emulated network layer. Uses default implementation on network behavior
|
||||
|
||||
@ -46,7 +46,8 @@ std::unique_ptr<TimeController> CreateTimeController(TimeMode mode) {
|
||||
} // namespace
|
||||
|
||||
NetworkEmulationManagerImpl::NetworkEmulationManagerImpl(TimeMode mode)
|
||||
: time_controller_(CreateTimeController(mode)),
|
||||
: time_mode_(mode),
|
||||
time_controller_(CreateTimeController(mode)),
|
||||
clock_(time_controller_->GetClock()),
|
||||
next_node_id_(1),
|
||||
next_ip4_address_(kMinIPv4Address),
|
||||
|
||||
@ -82,6 +82,8 @@ class NetworkEmulationManagerImpl : public NetworkEmulationManager {
|
||||
|
||||
TimeController* time_controller() override { return time_controller_.get(); }
|
||||
|
||||
TimeMode time_mode() const override { return time_mode_; }
|
||||
|
||||
Timestamp Now() const;
|
||||
|
||||
EmulatedTURNServerInterface* CreateTURNServer(
|
||||
@ -92,6 +94,8 @@ class NetworkEmulationManagerImpl : public NetworkEmulationManager {
|
||||
std::pair<std::unique_ptr<CrossTrafficGenerator>, RepeatingTaskHandle>;
|
||||
|
||||
absl::optional<rtc::IPAddress> GetNextIPv4Address();
|
||||
|
||||
const TimeMode time_mode_;
|
||||
const std::unique_ptr<TimeController> time_controller_;
|
||||
Clock* const clock_;
|
||||
int next_node_id_;
|
||||
|
||||
Reference in New Issue
Block a user