niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
| 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.org | d5a4d9b | 2012-01-02 13:04:05 +0000 | [diff] [blame] | 11 | #ifndef WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_NETWORK_H_ |
| 12 | #define WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_NETWORK_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 13 | |
| 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.org | bfacda6 | 2013-03-27 16:36:01 +0000 | [diff] [blame] | 22 | #include "webrtc/common_types.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 23 | |
mflodman@webrtc.org | d5a4d9b | 2012-01-02 13:04:05 +0000 | [diff] [blame] | 24 | namespace webrtc { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 25 | |
mflodman@webrtc.org | d5a4d9b | 2012-01-02 13:04:05 +0000 | [diff] [blame] | 26 | class Transport; |
| 27 | class VideoEngine; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 28 | |
| 29 | // This enumerator describes VideoEngine packet timeout states. |
mflodman@webrtc.org | d5a4d9b | 2012-01-02 13:04:05 +0000 | [diff] [blame] | 30 | enum ViEPacketTimeout { |
| 31 | NoPacket = 0, |
| 32 | PacketReceived = 1 |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 33 | }; |
| 34 | |
mflodman@webrtc.org | d5a4d9b | 2012-01-02 13:04:05 +0000 | [diff] [blame] | 35 | class WEBRTC_DLLEXPORT ViENetwork { |
| 36 | public: |
| 37 | // Default values. |
| 38 | enum { KDefaultSampleTimeSeconds = 2 }; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 39 | |
mflodman@webrtc.org | d5a4d9b | 2012-01-02 13:04:05 +0000 | [diff] [blame] | 40 | // 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.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 44 | |
mflodman@webrtc.org | d5a4d9b | 2012-01-02 13:04:05 +0000 | [diff] [blame] | 45 | // 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.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 49 | |
stefan@webrtc.org | bfacda6 | 2013-03-27 16:36:01 +0000 | [diff] [blame] | 50 | // 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.org | d5a4d9b | 2012-01-02 13:04:05 +0000 | [diff] [blame] | 55 | // 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.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 59 | |
mflodman@webrtc.org | d5a4d9b | 2012-01-02 13:04:05 +0000 | [diff] [blame] | 60 | // This function deregisters a used Transport for a specified channel. |
| 61 | virtual int DeregisterSendTransport(const int video_channel) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 62 | |
mflodman@webrtc.org | d5a4d9b | 2012-01-02 13:04:05 +0000 | [diff] [blame] | 63 | // 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.org | a989080 | 2013-12-13 00:21:03 +0000 | [diff] [blame] | 68 | const int length, |
| 69 | const PacketTime& packet_time) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 70 | |
mflodman@webrtc.org | d5a4d9b | 2012-01-02 13:04:05 +0000 | [diff] [blame] | 71 | // 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.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 76 | |
mflodman@webrtc.org | d5a4d9b | 2012-01-02 13:04:05 +0000 | [diff] [blame] | 77 | // 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.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 81 | |
solenberg@webrtc.org | b1f5010 | 2014-03-24 10:38:25 +0000 | [diff] [blame] | 82 | // 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.org | a16147c | 2014-03-25 10:37:31 +0000 | [diff] [blame] | 89 | // 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.org | d5a4d9b | 2012-01-02 13:04:05 +0000 | [diff] [blame] | 96 | protected: |
| 97 | ViENetwork() {} |
| 98 | virtual ~ViENetwork() {} |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 99 | }; |
mflodman@webrtc.org | d5a4d9b | 2012-01-02 13:04:05 +0000 | [diff] [blame] | 100 | |
| 101 | } // namespace webrtc |
| 102 | |
| 103 | #endif // WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_NETWORK_H_ |