blob: bb368182cfe2da6a8e4d8094742a38a3ac4e6dea [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
2 * Copyright (c) 2011 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
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000011#ifndef WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_NETWORK_H_
12#define WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_NETWORK_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
14// This sub-API supports the following functionalities:
15// - Configuring send and receive addresses.
16// - External transport support.
17// - Port and address filters.
18// - Windows GQoS functions and ToS functions.
19// - Packet timeout notification.
20// - Dead‐or‐Alive connection observations.
21
stefan@webrtc.orgbfacda62013-03-27 16:36:01 +000022#include "webrtc/common_types.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000023
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000024namespace webrtc {
niklase@google.com470e71d2011-07-07 08:21:25 +000025
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000026class Transport;
27class VideoEngine;
niklase@google.com470e71d2011-07-07 08:21:25 +000028
29// This enumerator describes VideoEngine packet timeout states.
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000030enum ViEPacketTimeout {
31 NoPacket = 0,
32 PacketReceived = 1
niklase@google.com470e71d2011-07-07 08:21:25 +000033};
34
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000035class WEBRTC_DLLEXPORT ViENetwork {
36 public:
37 // Default values.
38 enum { KDefaultSampleTimeSeconds = 2 };
niklase@google.com470e71d2011-07-07 08:21:25 +000039
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000040 // Factory for the ViENetwork sub‐API and increases an internal reference
41 // counter if successful. Returns NULL if the API is not supported or if
42 // construction fails.
43 static ViENetwork* GetInterface(VideoEngine* video_engine);
niklase@google.com470e71d2011-07-07 08:21:25 +000044
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000045 // Releases the ViENetwork sub-API and decreases an internal reference
46 // counter.Returns the new reference count. This value should be zero
47 // for all sub-API:s before the VideoEngine object can be safely deleted.
48 virtual int Release() = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000049
stefan@webrtc.orgbfacda62013-03-27 16:36:01 +000050 // Inform the engine about if the network adapter is currently transmitting
51 // packets or not.
52 virtual void SetNetworkTransmissionState(const int video_channel,
53 const bool is_transmitting) = 0;
54
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000055 // This function registers a user implementation of Transport to use for
56 // sending RTP and RTCP packets on this channel.
57 virtual int RegisterSendTransport(const int video_channel,
58 Transport& transport) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000059
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000060 // This function deregisters a used Transport for a specified channel.
61 virtual int DeregisterSendTransport(const int video_channel) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000062
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000063 // When using external transport for a channel, received RTP packets should
64 // be passed to VideoEngine using this function. The input should contain
65 // the RTP header and payload.
66 virtual int ReceivedRTPPacket(const int video_channel,
67 const void* data,
wu@webrtc.orga9890802013-12-13 00:21:03 +000068 const int length,
69 const PacketTime& packet_time) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000070
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000071 // When using external transport for a channel, received RTCP packets should
72 // be passed to VideoEngine using this function.
73 virtual int ReceivedRTCPPacket(const int video_channel,
74 const void* data,
75 const int length) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000076
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000077 // This function sets the Maximum Transition Unit (MTU) for a channel. The
78 // RTP packet will be packetized based on this MTU to optimize performance
79 // over the network.
80 virtual int SetMTU(int video_channel, unsigned int mtu) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000081
solenberg@webrtc.orgb1f50102014-03-24 10:38:25 +000082 // Forward (audio) packet to bandwidth estimator for the given video channel,
83 // for aggregated audio+video BWE.
84 virtual int ReceivedBWEPacket(const int video_channel,
85 int64_t arrival_time_ms, int payload_size, const RTPHeader& header) {
86 return 0;
87 }
88
stefan@webrtc.orga16147c2014-03-25 10:37:31 +000089 // TODO(holmer): Remove the default implementation when this has been fixed
90 // in fakewebrtcvideoengine.cc.
91 virtual bool SetBandwidthEstimationConfig(int video_channel,
92 const webrtc::Config& config) {
93 return false;
94 }
95
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000096 protected:
97 ViENetwork() {}
98 virtual ~ViENetwork() {}
niklase@google.com470e71d2011-07-07 08:21:25 +000099};
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +0000100
101} // namespace webrtc
102
103#endif // WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_NETWORK_H_