voip_network.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (c) 2020 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 API_VOIP_VOIP_NETWORK_H_
  11. #define API_VOIP_VOIP_NETWORK_H_
  12. #include "api/array_view.h"
  13. #include "api/voip/voip_base.h"
  14. namespace webrtc {
  15. // VoipNetwork interface provides any network related interfaces such as
  16. // processing received RTP/RTCP packet from remote endpoint. This interface
  17. // requires a ChannelId created via VoipBase interface. Note that using invalid
  18. // (previously released) ChannelId will silently fail these API calls as it
  19. // would have released underlying audio components. It's anticipated that caller
  20. // may be using different thread for network I/O where released channel id is
  21. // still used to input incoming RTP packets in which case we should silently
  22. // ignore. The interface is subjected to expand as needed in near future.
  23. class VoipNetwork {
  24. public:
  25. // The data received from the network including RTP header is passed here.
  26. virtual void ReceivedRTPPacket(ChannelId channel_id,
  27. rtc::ArrayView<const uint8_t> rtp_packet) = 0;
  28. // The data received from the network including RTCP header is passed here.
  29. virtual void ReceivedRTCPPacket(
  30. ChannelId channel_id,
  31. rtc::ArrayView<const uint8_t> rtcp_packet) = 0;
  32. protected:
  33. virtual ~VoipNetwork() = default;
  34. };
  35. } // namespace webrtc
  36. #endif // API_VOIP_VOIP_NETWORK_H_