Home | History | Annotate | Download | only in video_engine
      1 /*
      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 
     11 #ifndef WEBRTC_VIDEO_ENGINE_VIE_DEFINES_H_
     12 #define WEBRTC_VIDEO_ENGINE_VIE_DEFINES_H_
     13 
     14 #include "webrtc/engine_configurations.h"
     15 
     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
     25 #include <sys/socket.h>  // NOLINT
     26 #include <sys/time.h>  // NOLINT
     27 #include <sys/types.h>  // NOLINT
     28 #include <time.h>  // NOLINT
     29 #endif
     30 
     31 namespace webrtc {
     32 
     33 // General
     34 enum { kViEMinKeyRequestIntervalMs = 300 };
     35 
     36 // ViEBase
     37 enum { kViEMaxNumberOfChannels = 64 };
     38 enum { kViEVersionMaxMessageSize = 1024 };
     39 enum { kViEMaxModuleVersionSize = 960 };
     40 
     41 // ViECapture
     42 enum { kViEMaxCaptureDevices = 256 };
     43 enum { kViECaptureDefaultWidth = 352 };
     44 enum { kViECaptureDefaultHeight = 288 };
     45 enum { kViECaptureDefaultFramerate = 30 };
     46 enum { kViECaptureMaxSnapshotWaitTimeMs = 500 };
     47 
     48 // ViECodec
     49 enum { kViEMaxCodecWidth = 4096 };
     50 enum { kViEMaxCodecHeight = 3072 };
     51 enum { kViEMaxCodecFramerate = 60 };
     52 enum { kViEMinCodecBitrate = 30 };
     53 
     54 // ViENetwork
     55 enum { kViEMaxMtu = 1500 };
     56 enum { kViESocketThreads = 1 };
     57 enum { kViENumReceiveSocketBuffers = 500 };
     58 
     59 // ViERender
     60 // Max valid time set in SetRenderTimeoutImage
     61 enum { kViEMaxRenderTimeoutTimeMs  = 10000 };
     62 // Min valid time set in SetRenderTimeoutImage
     63 enum { kViEMinRenderTimeoutTimeMs = 33 };
     64 enum { kViEDefaultRenderDelayMs = 10 };
     65 
     66 // ViERTP_RTCP
     67 enum { kSendSidePacketHistorySize = 600 };
     68 
     69 // NACK
     70 enum { kMaxPacketAgeToNack = 450 };  // In sequence numbers.
     71 enum { kMaxNackListSize = 250 };
     72 
     73 // Id definitions
     74 enum {
     75   kViEChannelIdBase = 0x0,
     76   kViEChannelIdMax = 0xFF,
     77   kViECaptureIdBase = 0x1001,
     78   kViECaptureIdMax = 0x10FF,
     79   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 
     86 inline 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 
     93 inline 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 
    100 inline int ChannelId(const int moduleId) {
    101   return static_cast<int>(moduleId & 0xffff);
    102 }
    103 
    104 //  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 
    119 // Windows specific.
    120 #if defined(_WIN32)
    121   #define RENDER_MODULE_TYPE kRenderWindows
    122 
    123   // 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)
    135   #define RENDER_MODULE_TYPE kRenderWindows
    136 #endif
    137 
    138 // Android specific.
    139 #ifdef WEBRTC_ANDROID
    140   #define FAR
    141   #define __cdecl
    142 #endif  // WEBRTC_ANDROID
    143 
    144 }  // namespace webrtc
    145 
    146 #endif  // WEBRTC_VIDEO_ENGINE_VIE_DEFINES_H_
    147