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