simulated_packet_receiver.h (1506B)
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 <cstdint> 15 #include <optional> 16 17 #include "call/packet_receiver.h" 18 19 namespace webrtc { 20 21 // Private API that is fixing surface between DirectTransport and underlying 22 // network conditions simulation implementation. 23 class SimulatedPacketReceiverInterface : public PacketReceiver { 24 public: 25 // Must not be called in parallel with DeliverPacket or Process. 26 // Destination receiver will be injected with this method 27 virtual void SetReceiver(PacketReceiver* receiver) = 0; 28 29 // Reports average packet delay. 30 virtual int AverageDelay() = 0; 31 32 // Process any pending tasks such as timeouts. 33 // Called on a worker thread. 34 virtual void Process() = 0; 35 36 // Returns the time until next process or nullopt to indicate that the next 37 // process time is unknown. If the next process time is unknown, this should 38 // be checked again any time a packet is enqueued. 39 virtual std::optional<int64_t> TimeUntilNextProcess() = 0; 40 }; 41 42 } // namespace webrtc 43 44 #endif // CALL_SIMULATED_PACKET_RECEIVER_H_