blob: 7bfed465ce3028dd7f3217cf02eb59a5f9a8d2f2 [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
wu@webrtc.org6ecc7732014-05-08 22:22:41 +000037enum { kViEMaxNumberOfChannels = 64 };
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000038enum { 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
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000054// ViENetwork
55enum { kViEMaxMtu = 1500 };
56enum { kViESocketThreads = 1 };
57enum { kViENumReceiveSocketBuffers = 500 };
58
59// ViERender
60// Max valid time set in SetRenderTimeoutImage
61enum { kViEMaxRenderTimeoutTimeMs = 10000 };
62// Min valid time set in SetRenderTimeoutImage
63enum { kViEMinRenderTimeoutTimeMs = 33 };
64enum { kViEDefaultRenderDelayMs = 10 };
65
66// ViERTP_RTCP
stefan@webrtc.org7fff32c2013-02-01 15:09:57 +000067enum { kSendSidePacketHistorySize = 600 };
68
69// NACK
70enum { kMaxPacketAgeToNack = 450 }; // In sequence numbers.
71enum { kMaxNackListSize = 250 };
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000072
73// Id definitions
74enum {
75 kViEChannelIdBase = 0x0,
76 kViEChannelIdMax = 0xFF,
77 kViECaptureIdBase = 0x1001,
78 kViECaptureIdMax = 0x10FF,
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000079 kViEDummyChannelId = 0xFFFF
80};
81
82// Module id
83// Create a unique id based on the ViE instance id and the
84// channel id. ViE id > 0 and 0 <= channel id <= 255
85
86inline int ViEId(const int vieId, const int channelId = -1) {
87 if (channelId == -1) {
88 return static_cast<int>((vieId << 16) + kViEDummyChannelId);
89 }
90 return static_cast<int>((vieId << 16) + channelId);
91}
92
93inline int ViEModuleId(const int vieId, const int channelId = -1) {
94 if (channelId == -1) {
95 return static_cast<int>((vieId << 16) + kViEDummyChannelId);
96 }
97 return static_cast<int>((vieId << 16) + channelId);
98}
99
100inline int ChannelId(const int moduleId) {
101 return static_cast<int>(moduleId & 0xffff);
102}
103
pbos@webrtc.org7d6e2a02013-05-13 09:29:03 +0000104// Build information macros
105#if defined(_DEBUG) || defined(DEBUG)
106#define BUILDMODE "d"
107#elif defined(NDEBUG)
108#define BUILDMODE "r"
109#else
110#define BUILDMODE "?"
111#endif
112
113#define BUILDTIME __TIME__
114#define BUILDDATE __DATE__
115
116// Example: "Oct 10 2002 12:05:30 r".
117#define BUILDINFO BUILDDATE " " BUILDTIME " " BUILDMODE
118
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000119// Windows specific.
120#if defined(_WIN32)
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000121 #define RENDER_MODULE_TYPE kRenderWindows
122
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000123 // Include libraries.
124 #pragma comment(lib, "winmm.lib")
125
126 #ifndef WEBRTC_EXTERNAL_TRANSPORT
127 #pragma comment(lib, "ws2_32.lib")
128 #pragma comment(lib, "Iphlpapi.lib") // _GetAdaptersAddresses
129 #endif
130#endif
131
132// Mac specific.
133#ifdef WEBRTC_MAC
134 #define SLEEP(x) usleep(x * 1000)
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000135 #define RENDER_MODULE_TYPE kRenderWindows
136#endif
137
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000138// Android specific.
139#ifdef WEBRTC_ANDROID
140 #define FAR
141 #define __cdecl
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000142#endif // WEBRTC_ANDROID
143
144} // namespace webrtc
145
niklas.enbom@webrtc.orgab360a72012-10-31 14:35:11 +0000146#endif // WEBRTC_VIDEO_ENGINE_VIE_DEFINES_H_