simulated_packet_receiver.h 1.5 KB

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