Home | History | Annotate | Download | only in include
      1 /* ------------------------------------------------------------------
      2  * Copyright (C) 1998-2009 PacketVideo
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
     13  * express or implied.
     14  * See the License for the specific language governing permissions
     15  * and limitations under the License.
     16  * -------------------------------------------------------------------
     17  */
     18 #ifndef PVMF_SM_TUNABLES_H_INCLUDED
     19 #define PVMF_SM_TUNABLES_H_INCLUDED
     20 
     21 #ifndef PVMF_STREAMING_MEM_CONFIG_H_INCLUDED
     22 #include "pvmf_streaming_mem_config.h"
     23 #endif
     24 
     25 /**
     26  * This file contains all the tunable parameters in streaming manager
     27  * and its children nodes. These are compile time constants for now
     28  * and once we have the capability and config interface implemented
     29  * for all the nodes, these would be configured thru that interface
     30  */
     31 
     32 /*
     33  * Streaming Manager Node config constants
     34  */
     35 
     36 
     37 /*
     38  * Session Controller Node config constants
     39  */
     40 
     41 /*
     42  * Jitter Buffer Node config constants
     43  */
     44 #define PVMF_JITTER_BUFFER_NODE_MEDIA_MSG_SIZE 128
     45 
     46 #define DEFAULT_MAX_INACTIVITY_DURATION_IN_MS 70000
     47 
     48 #define DEFAULT_NUM_FRAGMENTS_IN_MEDIA_MSG 1
     49 
     50 #define DEFAULT_NUM_MEDIA_MSGS_IN_JITTER_BUFFER    2048 //64
     51 
     52 #define PVMF_JITTER_BUFFER_NODE_THINNING_PERCENT 10
     53 
     54 #define PVMF_JITTER_BUFFER_NODE_THINNING_LIVE_INTERVAL_MS 300000
     55 
     56 #define PVMF_JITTER_BUFFER_NODE_THINNING_MIN_DURATION_MS 300000
     57 
     58 /* Percentage of the jitter buffer occupancy */
     59 /* High water mark is in terms of buffer occupancy */
     60 /* Low water mark is in terms of time */
     61 #define DEFAULT_JITTER_BUFFER_HIGH_WATER_MARK 0.80
     62 #define DEFAULT_JITTER_BUFFER_LOW_WATER_MARK  0.40
     63 
     64 #if (PMVF_JITTER_BUFFER_NODE_USE_NO_RESIZE_ALLOC)
     65 #define MAX_SOCKET_BUFFER_SIZE        1500
     66 #else
     67 //This should be the same size as DEFAULT_RTPPACKETSOURCE_TCP_BUFFER_SIZE.
     68 #define MAX_SOCKET_BUFFER_SIZE        (16*1024)
     69 #define MIN_SOCKET_BUFFER_SIZE        (2*1024)
     70 #endif
     71 #define MAX_FEEDBACK_SOCKET_BUFFER_SIZE   (1500)
     72 
     73 /* Based on 128 Kbps for a jitter of 7 seconds */
     74 #define DEFAULT_RTP_SOCKET_MEM_POOL_SIZE_IN_BYTES 112000
     75 //This must be 2*MAX_SOCKET_BUFFER_SIZE because the PS Node allocates
     76 //MAX_SOCKET_BUFFER_SIZE for receive data per request.  It must be at least 2x
     77 //to prevent packet loss due to out-of-memory because the PS Node will
     78 //immediately requests the next packet when one comes in but before the
     79 //previous packet is consumed.
     80 #define DEFAULT_RTCP_SOCKET_MEM_POOL_SIZE_IN_BYTES (2 * MAX_SOCKET_BUFFER_SIZE)
     81 /* Expressed as a percentage to account for PVMF media msg overhead */
     82 #define PVMF_JITTER_BUFFER_NODE_MEM_POOL_OVERHEAD  10
     83 //This should be at least 2x the max socket buffer size to prevent
     84 //packet loss due to waiting for free buffers.
     85 #define MIN_RTP_SOCKET_MEM_POOL_SIZE_IN_BYTES      (8 * MAX_SOCKET_BUFFER_SIZE)
     86 #define SOCKET_MEM_POOL_OVERHEAD_IN_BYTES          256
     87 
     88 // ************* PVMFSMSharedBufferAllocWithReSize  constants
     89 
     90 // default number of times we can add another buffer
     91 #define DEFAULT_MAX_NUM_SOCKETMEMPOOL_RESIZES      1   // allow one resize only
     92 #define MAX_NUM_SOCKETMEMPOOL_RESIZES              1000
     93 #define MIN_NUM_SOCKETMEMPOOL_RESIZES              0
     94 
     95 // default size of added buffers
     96 #define DEFAULT_MAX_SOCKETMEMPOOL_RESIZELEN_FEEDBACK_PORT  \
     97                                 MIN_RTP_SOCKET_MEM_POOL_SIZE_IN_BYTES
     98 #define DEFAULT_MAX_SOCKETMEMPOOL_RESIZELEN_INPUT_PORT  \
     99                 (MIN_RTP_SOCKET_MEM_POOL_SIZE_IN_BYTES + 2*MAX_SOCKET_BUFFER_SIZE)
    100 
    101 #define MIN_SOCKETMEMPOOL_RESIZELEN_INPUT_PORT     0
    102 #define MAX_SOCKETMEMPOOL_RESIZELEN_INPUT_PORT     128*1024
    103 
    104 // *************
    105 
    106 #define MAX_RTCP_SOURCES 31
    107 #define MAX_RTCP_BLOCK_SIZE 512
    108 #define DEFAULT_RTCP_MEM_POOL_BUFFERS 4
    109 #define RTCP_RAND_SEED 666
    110 
    111 #define MIN_RTSP_SERVER_INACTIVITY_TIMEOUT_IN_SEC   1
    112 #define MAX_RTSP_SERVER_INACTIVITY_TIMEOUT_IN_SEC   300
    113 
    114 // RTCP INTERVAL related
    115 #define DEFAULT_RTCP_INTERVAL_USEC 1000000
    116 #define DEFAULT_RTCP_INTERVAL_SEC  1
    117 #define RTCP_FIXED_INTERVAL_MODE   1
    118 
    119 
    120 #define DEFAULT_JITTER_BUFFER_DURATION_IN_MS 4000
    121 #define MAX_JITTER_BUFFER_DURATION_IN_MS     100000
    122 #define MIN_JITTER_BUFFER_DURATION_IN_MS     1000
    123 
    124 #define DEFAULT_JITTER_BUFFER_UNDERFLOW_THRESHOLD_IN_MS 500
    125 #define DEFAULT_PLAY_BACK_THRESHOLD_IN_MS    250
    126 #define DEFAULT_ESTIMATED_SERVER_KEEPAHEAD_FOR_OOO_SYNC_IN_MS   500
    127 
    128 /* Status event happends at 5 Hz (200 msec) intervals */
    129 #define PVMF_JITTER_BUFFER_BUFFERING_STATUS_EVENT_FREQUENCY 5
    130 #define PVMF_JITTER_BUFFER_BUFFERING_STATUS_EVENT_CYCLES 1
    131 
    132 #define PVMF_JITTER_BUFFER_NODE_SESSION_DURATION_MONITORING_INTERVAL_MAX_IN_MS (10*60*1000)
    133 
    134 /* Non-resizable allocator related constants */
    135 #define PVMF_JB_NO_RESIZE_ALLOC_NUM_CHUNKS_RTP 256
    136 #define PVMF_JB_NO_RESIZE_ALLOC_NUM_CHUNKS_FB  16
    137 #define PVMF_JB_NO_RESIZE_ALLOC_CHUNK_SIZE (MAX_SOCKET_BUFFER_SIZE + 128)
    138 
    139 #define PVMF_EOS_TIMER_GAURD_BAND_IN_MS 200
    140 
    141 /* Firewall packet related */
    142 #define PVMF_JITTER_BUFFER_NODE_DEFAULT_FIREWALL_PKT_ATTEMPTS 3
    143 #define PVMF_JITTER_BUFFER_NODE_MAX_FIREWALL_PKT_SIZE       8
    144 #define PVMF_JITTER_BUFFER_NODE_FIREWALL_PKT_MEMPOOL_SIZE   256
    145 #define PVMF_JITTER_BUFFER_NODE_FIREWALL_PKT_DEFAULT_SERVER_RESPONSE_TIMEOUT_IN_MS 1000
    146 #define PVMF_JITTER_BUFFER_NODE_MAX_RTP_FIREWALL_PKT_SIZE   12
    147 #define PVMF_JITTER_BUFFER_NODE_FIREWALL_PKT_DEFAULT_PAUSE_DURATION_IN_MS 20000
    148 
    149 #define JITTERBUFFERNODE_MAX_RUNL_TIME_IN_MS 25
    150 
    151 #define PVMF_SM_MSHTTP_NODE_DEFAULT_JITTER_BUFFER_SIZE (2*1024*1024)
    152 /* Media layer node related */
    153 #define MEDIALAYERNODE_MAXNUM_MEDIA_DATA     10
    154 #define MEDIALAYERNODE_MAX_RUNL_TIME_IN_MS   25
    155 
    156 /* Jitter buffer overflow related */
    157 #define CONSECUTIVE_LOW_BUFFER_COUNT_THRESHOLD 100
    158 #define MIN_PERCENT_OCCUPANCY_THRESHOLD 10
    159 #define JITTER_BUFFER_DURATION_MULTIPLIER_THRESHOLD 1.5
    160 #endif
    161 
    162 
    163