xref: /aosp_15_r20/external/webrtc/api/voip/voip_network.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
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.
22 class VoipNetwork {
23  public:
24   // The data received from the network including RTP header is passed here.
25   // Returns following VoipResult;
26   //  kOk - received RTP packet is processed.
27   //  kInvalidArgument - `channel_id` is invalid.
28   virtual VoipResult ReceivedRTPPacket(
29       ChannelId channel_id,
30       rtc::ArrayView<const uint8_t> rtp_packet) = 0;
31 
32   // The data received from the network including RTCP header is passed here.
33   // Returns following VoipResult;
34   //  kOk - received RTCP packet is processed.
35   //  kInvalidArgument - `channel_id` is invalid.
36   virtual VoipResult ReceivedRTCPPacket(
37       ChannelId channel_id,
38       rtc::ArrayView<const uint8_t> rtcp_packet) = 0;
39 
40  protected:
41   virtual ~VoipNetwork() = default;
42 };
43 
44 }  // namespace webrtc
45 
46 #endif  // API_VOIP_VOIP_NETWORK_H_
47