blob: 97f64f49d0530e657e6c963726e05747faa03d17 [file] [log] [blame]
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +00001/*
2 * Copyright (c) 2012 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
niklas.enbom@webrtc.orgab360a72012-10-31 14:35:11 +000011#ifndef WEBRTC_VIDEO_ENGINE_VIE_DEFINES_H_
12#define WEBRTC_VIDEO_ENGINE_VIE_DEFINES_H_
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000013
pbos@webrtc.org281cff82013-05-17 13:44:48 +000014#include "webrtc/engine_configurations.h"
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000015
16// TODO(mflodman) Remove.
17#ifdef WEBRTC_ANDROID
18#include <arpa/inet.h> // NOLINT
19#include <linux/net.h> // NOLINT
20#include <netinet/in.h> // NOLINT
21#include <pthread.h> // NOLINT
22#include <stdio.h> // NOLINT
23#include <stdlib.h> // NOLINT
24#include <string.h> // NOLINT
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000025#include <sys/socket.h> // NOLINT
26#include <sys/time.h> // NOLINT
pbos@webrtc.org281cff82013-05-17 13:44:48 +000027#include <sys/types.h> // NOLINT
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000028#include <time.h> // NOLINT
29#endif
30
31namespace webrtc {
32
33// General
34enum { kViEMinKeyRequestIntervalMs = 300 };
35
36// ViEBase
37enum { kViEMaxNumberOfChannels = 32 };
38enum { kViEVersionMaxMessageSize = 1024 };
39enum { kViEMaxModuleVersionSize = 960 };
40
41// ViECapture
vikasmarwaha@webrtc.orgdcfeff72013-05-13 20:28:23 +000042enum { kViEMaxCaptureDevices = 256 };
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000043enum { kViECaptureDefaultWidth = 352 };
44enum { kViECaptureDefaultHeight = 288 };
45enum { kViECaptureDefaultFramerate = 30 };
46enum { kViECaptureMaxSnapshotWaitTimeMs = 500 };
47
48// ViECodec
fbarchard@google.comf0934102013-02-12 04:57:56 +000049enum { kViEMaxCodecWidth = 4096 };
50enum { kViEMaxCodecHeight = 3072 };
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000051enum { kViEMaxCodecFramerate = 60 };
52enum { kViEMinCodecBitrate = 30 };
53
54// ViEEncryption
55enum { kViEMaxSrtpKeyLength = 30 };
56enum { kViEMinSrtpEncryptLength = 16 };
57enum { kViEMaxSrtpEncryptLength = 256 };
58enum { kViEMaxSrtpAuthSh1Length = 20 };
59enum { kViEMaxSrtpTagAuthNullLength = 12 };
60enum { kViEMaxSrtpKeyAuthNullLength = 256 };
61
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000062// ViENetwork
63enum { kViEMaxMtu = 1500 };
64enum { kViESocketThreads = 1 };
65enum { kViENumReceiveSocketBuffers = 500 };
66
67// ViERender
68// Max valid time set in SetRenderTimeoutImage
69enum { kViEMaxRenderTimeoutTimeMs = 10000 };
70// Min valid time set in SetRenderTimeoutImage
71enum { kViEMinRenderTimeoutTimeMs = 33 };
72enum { kViEDefaultRenderDelayMs = 10 };
73
74// ViERTP_RTCP
stefan@webrtc.org7fff32c2013-02-01 15:09:57 +000075enum { kSendSidePacketHistorySize = 600 };
76
77// NACK
78enum { kMaxPacketAgeToNack = 450 }; // In sequence numbers.
79enum { kMaxNackListSize = 250 };
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000080
81// Id definitions
82enum {
83 kViEChannelIdBase = 0x0,
84 kViEChannelIdMax = 0xFF,
85 kViECaptureIdBase = 0x1001,
86 kViECaptureIdMax = 0x10FF,
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000087 kViEDummyChannelId = 0xFFFF
88};
89
90// Module id
91// Create a unique id based on the ViE instance id and the
92// channel id. ViE id > 0 and 0 <= channel id <= 255
93
94inline int ViEId(const int vieId, const int channelId = -1) {
95 if (channelId == -1) {
96 return static_cast<int>((vieId << 16) + kViEDummyChannelId);
97 }
98 return static_cast<int>((vieId << 16) + channelId);
99}
100
101inline int ViEModuleId(const int vieId, const int channelId = -1) {
102 if (channelId == -1) {
103 return static_cast<int>((vieId << 16) + kViEDummyChannelId);
104 }
105 return static_cast<int>((vieId << 16) + channelId);
106}
107
108inline int ChannelId(const int moduleId) {
109 return static_cast<int>(moduleId & 0xffff);
110}
111
pbos@webrtc.org7d6e2a02013-05-13 09:29:03 +0000112// Build information macros
113#if defined(_DEBUG) || defined(DEBUG)
114#define BUILDMODE "d"
115#elif defined(NDEBUG)
116#define BUILDMODE "r"
117#else
118#define BUILDMODE "?"
119#endif
120
121#define BUILDTIME __TIME__
122#define BUILDDATE __DATE__
123
124// Example: "Oct 10 2002 12:05:30 r".
125#define BUILDINFO BUILDDATE " " BUILDTIME " " BUILDMODE
126
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000127// Windows specific.
128#if defined(_WIN32)
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000129 #define RENDER_MODULE_TYPE kRenderWindows
130
131 // Warning pragmas.
132 // new behavior: elements of array 'XXX' will be default initialized.
133 #pragma warning(disable: 4351)
134 // 'this' : used in base member initializer list.
135 #pragma warning(disable: 4355)
136 // Frame pointer register 'ebp' modified by inline assembly code.
137 #pragma warning(disable: 4731)
138
139 // Include libraries.
140 #pragma comment(lib, "winmm.lib")
141
142 #ifndef WEBRTC_EXTERNAL_TRANSPORT
143 #pragma comment(lib, "ws2_32.lib")
144 #pragma comment(lib, "Iphlpapi.lib") // _GetAdaptersAddresses
145 #endif
146#endif
147
148// Mac specific.
149#ifdef WEBRTC_MAC
150 #define SLEEP(x) usleep(x * 1000)
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000151 #define RENDER_MODULE_TYPE kRenderWindows
152#endif
153
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000154// Android specific.
155#ifdef WEBRTC_ANDROID
156 #define FAR
157 #define __cdecl
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000158#endif // WEBRTC_ANDROID
159
160} // namespace webrtc
161
niklas.enbom@webrtc.orgab360a72012-10-31 14:35:11 +0000162#endif // WEBRTC_VIDEO_ENGINE_VIE_DEFINES_H_