blob: 2db46e8c3810aca837e6688dbcd01dc4fc7f45b7 [file] [log] [blame]
Artem Titov46c4e602018-08-17 14:26:54 +02001/*
2 * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef CALL_SIMULATED_PACKET_RECEIVER_H_
12#define CALL_SIMULATED_PACKET_RECEIVER_H_
13
14#include "api/test/simulated_network.h"
15#include "call/packet_receiver.h"
Artem Titov46c4e602018-08-17 14:26:54 +020016
17namespace webrtc {
18
19// Private API that is fixing surface between DirectTransport and underlying
20// network conditions simulation implementation.
Sebastian Jansson836fee12019-02-08 16:08:10 +010021class SimulatedPacketReceiverInterface : public PacketReceiver {
Artem Titov46c4e602018-08-17 14:26:54 +020022 public:
23 // Must not be called in parallel with DeliverPacket or Process.
24 // Destination receiver will be injected with this method
25 virtual void SetReceiver(PacketReceiver* receiver) = 0;
26
27 // Reports average packet delay.
28 virtual int AverageDelay() = 0;
Sebastian Jansson836fee12019-02-08 16:08:10 +010029
30 // Process any pending tasks such as timeouts.
31 // Called on a worker thread.
32 virtual void Process() = 0;
33
34 // Returns the time until next process or nullopt to indicate that the next
35 // process time is unknown. If the next process time is unknown, this should
36 // be checked again any time a packet is enqueued.
37 virtual absl::optional<int64_t> TimeUntilNextProcess() = 0;
Artem Titov46c4e602018-08-17 14:26:54 +020038};
39
40} // namespace webrtc
41
42#endif // CALL_SIMULATED_PACKET_RECEIVER_H_