Artem Titov | 46c4e60 | 2018-08-17 12:26:54 | [diff] [blame] | 1 | /* |
| 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 Titov | 46c4e60 | 2018-08-17 12:26:54 | [diff] [blame] | 16 | |
| 17 | namespace webrtc { |
| 18 | |
| 19 | // Private API that is fixing surface between DirectTransport and underlying |
| 20 | // network conditions simulation implementation. |
Sebastian Jansson | 836fee1 | 2019-02-08 15:08:10 | [diff] [blame] | 21 | class SimulatedPacketReceiverInterface : public PacketReceiver { |
Artem Titov | 46c4e60 | 2018-08-17 12:26:54 | [diff] [blame] | 22 | 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 Jansson | 836fee1 | 2019-02-08 15:08:10 | [diff] [blame] | 29 | |
| 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 Titov | 46c4e60 | 2018-08-17 12:26:54 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | } // namespace webrtc |
| 41 | |
| 42 | #endif // CALL_SIMULATED_PACKET_RECEIVER_H_ |