config.h 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722
  1. /*
  2. * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
  3. * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #ifndef __PJMEDIA_CONFIG_H__
  20. #define __PJMEDIA_CONFIG_H__
  21. /**
  22. * @file pjmedia/config.h Compile time config
  23. * @brief Contains some compile time constants.
  24. */
  25. #include <pj/config.h>
  26. /**
  27. * @defgroup PJMEDIA_BASE Base Types and Configurations
  28. */
  29. /**
  30. * @defgroup PJMEDIA_CONFIG Compile time configuration
  31. * @ingroup PJMEDIA_BASE
  32. * @brief Some compile time configuration settings.
  33. * @{
  34. */
  35. /*
  36. * Include config_auto.h if autoconf is used (PJ_AUTOCONF is set)
  37. */
  38. #if defined(PJ_AUTOCONF)
  39. # include <pjmedia/config_auto.h>
  40. #endif
  41. /**
  42. * Initial memory block for media endpoint.
  43. */
  44. #ifndef PJMEDIA_POOL_LEN_ENDPT
  45. # define PJMEDIA_POOL_LEN_ENDPT 8000
  46. #endif
  47. /**
  48. * Memory increment for media endpoint.
  49. */
  50. #ifndef PJMEDIA_POOL_INC_ENDPT
  51. # define PJMEDIA_POOL_INC_ENDPT 4000
  52. #endif
  53. /**
  54. * Initial memory block for event manager.
  55. */
  56. #ifndef PJMEDIA_POOL_LEN_EVTMGR
  57. # define PJMEDIA_POOL_LEN_EVTMGR 500
  58. #endif
  59. /**
  60. * Memory increment for event manager.
  61. */
  62. #ifndef PJMEDIA_POOL_INC_EVTMGR
  63. # define PJMEDIA_POOL_INC_EVTMGR 500
  64. #endif
  65. /**
  66. * Maximum number of events that can be handled by event manager.
  67. *
  68. * Default: 16
  69. */
  70. #ifndef PJMEDIA_EVENT_MAX_EVENTS
  71. # define PJMEDIA_EVENT_MAX_EVENTS 16
  72. #endif
  73. /**
  74. * Specify whether we prefer to use audio switch board rather than
  75. * conference bridge.
  76. *
  77. * Audio switch board is a kind of simplified version of conference
  78. * bridge, but not really the subset of conference bridge. It has
  79. * stricter rules on audio routing among the pjmedia ports and has
  80. * no audio mixing capability. The power of it is it could work with
  81. * encoded audio frames where conference brigde couldn't.
  82. *
  83. * Default: 0
  84. */
  85. #ifndef PJMEDIA_CONF_USE_SWITCH_BOARD
  86. # define PJMEDIA_CONF_USE_SWITCH_BOARD 0
  87. #endif
  88. /**
  89. * Specify buffer size for audio switch board, in bytes. This buffer will
  90. * be used for transmitting/receiving audio frame data (and some overheads,
  91. * i.e: pjmedia_frame structure) among conference ports in the audio
  92. * switch board. For example, if a port uses PCM format @44100Hz mono
  93. * and frame time 20ms, the PCM audio data will require 1764 bytes,
  94. * so with overhead, a safe buffer size will be ~1900 bytes.
  95. *
  96. * Default: PJMEDIA_MAX_MTU
  97. */
  98. #ifndef PJMEDIA_CONF_SWITCH_BOARD_BUF_SIZE
  99. # define PJMEDIA_CONF_SWITCH_BOARD_BUF_SIZE PJMEDIA_MAX_MTU
  100. #endif
  101. /**
  102. * Specify whether the conference bridge uses AGC, an automatic adjustment to
  103. * avoid dramatic change in the signal level which can cause noise.
  104. *
  105. * Default: 1 (enabled)
  106. */
  107. #ifndef PJMEDIA_CONF_USE_AGC
  108. # define PJMEDIA_CONF_USE_AGC 1
  109. #endif
  110. /*
  111. * Types of sound stream backends.
  112. */
  113. /**
  114. * This macro has been deprecated in releasee 1.1. Please see
  115. * http://trac.pjsip.org/repos/wiki/Audio_Dev_API for more information.
  116. */
  117. #if defined(PJMEDIA_SOUND_IMPLEMENTATION)
  118. # error PJMEDIA_SOUND_IMPLEMENTATION has been deprecated
  119. #endif
  120. /**
  121. * This macro has been deprecated in releasee 1.1. Please see
  122. * http://trac.pjsip.org/repos/wiki/Audio_Dev_API for more information.
  123. */
  124. #if defined(PJMEDIA_PREFER_DIRECT_SOUND)
  125. # error PJMEDIA_PREFER_DIRECT_SOUND has been deprecated
  126. #endif
  127. /**
  128. * This macro controls whether the legacy sound device API is to be
  129. * implemented, for applications that still use the old sound device
  130. * API (sound.h). If this macro is set to non-zero, the sound_legacy.c
  131. * will be included in the compilation. The sound_legacy.c is an
  132. * implementation of old sound device (sound.h) using the new Audio
  133. * Device API.
  134. *
  135. * Please see http://trac.pjsip.org/repos/wiki/Audio_Dev_API for more
  136. * info.
  137. */
  138. #ifndef PJMEDIA_HAS_LEGACY_SOUND_API
  139. # define PJMEDIA_HAS_LEGACY_SOUND_API 1
  140. #endif
  141. /**
  142. * Specify default sound device latency, in milisecond.
  143. */
  144. #ifndef PJMEDIA_SND_DEFAULT_REC_LATENCY
  145. # define PJMEDIA_SND_DEFAULT_REC_LATENCY 100
  146. #endif
  147. /**
  148. * Specify default sound device latency, in milisecond.
  149. *
  150. * Default is 160ms for Windows Mobile and 140ms for other platforms.
  151. */
  152. #ifndef PJMEDIA_SND_DEFAULT_PLAY_LATENCY
  153. # if defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE!=0
  154. # define PJMEDIA_SND_DEFAULT_PLAY_LATENCY 160
  155. # else
  156. # define PJMEDIA_SND_DEFAULT_PLAY_LATENCY 140
  157. # endif
  158. #endif
  159. /*
  160. * Types of WSOLA backend algorithm.
  161. */
  162. /**
  163. * This denotes implementation of WSOLA using null algorithm. Expansion
  164. * will generate zero frames, and compression will just discard some
  165. * samples from the input.
  166. *
  167. * This type of implementation may be used as it requires the least
  168. * processing power.
  169. */
  170. #define PJMEDIA_WSOLA_IMP_NULL 0
  171. /**
  172. * This denotes implementation of WSOLA using fixed or floating point WSOLA
  173. * algorithm. This implementation provides the best quality of the result,
  174. * at the expense of one frame delay and intensive processing power
  175. * requirement.
  176. */
  177. #define PJMEDIA_WSOLA_IMP_WSOLA 1
  178. /**
  179. * This denotes implementation of WSOLA algorithm with faster waveform
  180. * similarity calculation. This implementation provides fair quality of
  181. * the result with the main advantage of low processing power requirement.
  182. */
  183. #define PJMEDIA_WSOLA_IMP_WSOLA_LITE 2
  184. /**
  185. * Specify type of Waveform based Similarity Overlap and Add (WSOLA) backend
  186. * implementation to be used. WSOLA is an algorithm to expand and/or compress
  187. * audio frames without changing the pitch, and used by the delaybuf and as PLC
  188. * backend algorithm.
  189. *
  190. * Default is PJMEDIA_WSOLA_IMP_WSOLA
  191. */
  192. #ifndef PJMEDIA_WSOLA_IMP
  193. # define PJMEDIA_WSOLA_IMP PJMEDIA_WSOLA_IMP_WSOLA
  194. #endif
  195. /**
  196. * Specify the default maximum duration of synthetic audio that is generated
  197. * by WSOLA. This value should be long enough to cover burst of packet losses.
  198. * but not too long, because as the duration increases the quality would
  199. * degrade considerably.
  200. *
  201. * Note that this limit is only applied when fading is enabled in the WSOLA
  202. * session.
  203. *
  204. * Default: 80
  205. */
  206. #ifndef PJMEDIA_WSOLA_MAX_EXPAND_MSEC
  207. # define PJMEDIA_WSOLA_MAX_EXPAND_MSEC 80
  208. #endif
  209. /**
  210. * Specify WSOLA template length, in milliseconds. The longer the template,
  211. * the smoother signal to be generated at the expense of more computation
  212. * needed, since the algorithm will have to compare more samples to find
  213. * the most similar pitch.
  214. *
  215. * Default: 5
  216. */
  217. #ifndef PJMEDIA_WSOLA_TEMPLATE_LENGTH_MSEC
  218. # define PJMEDIA_WSOLA_TEMPLATE_LENGTH_MSEC 5
  219. #endif
  220. /**
  221. * Specify WSOLA algorithm delay, in milliseconds. The algorithm delay is
  222. * used to merge synthetic samples with real samples in the transition
  223. * between real to synthetic and vice versa. The longer the delay, the
  224. * smoother signal to be generated, at the expense of longer latency and
  225. * a slighty more computation.
  226. *
  227. * Default: 5
  228. */
  229. #ifndef PJMEDIA_WSOLA_DELAY_MSEC
  230. # define PJMEDIA_WSOLA_DELAY_MSEC 5
  231. #endif
  232. /**
  233. * Set this to non-zero to disable fade-out/in effect in the PLC when it
  234. * instructs WSOLA to generate synthetic frames. The use of fading may
  235. * or may not improve the quality of audio, depending on the nature of
  236. * packet loss and the type of audio input (e.g. speech vs music).
  237. * Disabling fading also implicitly remove the maximum limit of synthetic
  238. * audio samples generated by WSOLA (see PJMEDIA_WSOLA_MAX_EXPAND_MSEC).
  239. *
  240. * Default: 0
  241. */
  242. #ifndef PJMEDIA_WSOLA_PLC_NO_FADING
  243. # define PJMEDIA_WSOLA_PLC_NO_FADING 0
  244. #endif
  245. /**
  246. * Limit the number of calls by stream to the PLC to generate synthetic
  247. * frames to this duration. If packets are still lost after this maximum
  248. * duration, silence will be generated by the stream instead. Since the
  249. * PLC normally should have its own limit on the maximum duration of
  250. * synthetic frames to be generated (for PJMEDIA's PLC, the limit is
  251. * PJMEDIA_WSOLA_MAX_EXPAND_MSEC), we can set this value to a large number
  252. * to give additional flexibility should the PLC wants to do something
  253. * clever with the lost frames.
  254. *
  255. * Default: 240 ms
  256. */
  257. #ifndef PJMEDIA_MAX_PLC_DURATION_MSEC
  258. # define PJMEDIA_MAX_PLC_DURATION_MSEC 240
  259. #endif
  260. /**
  261. * Specify number of sound buffers. Larger number is better for sound
  262. * stability and to accommodate sound devices that are unable to send frames
  263. * in timely manner, however it would probably cause more audio delay (and
  264. * definitely will take more memory). One individual buffer is normally 10ms
  265. * or 20 ms long, depending on ptime settings (samples_per_frame value).
  266. *
  267. * The setting here currently is used by the conference bridge, the splitter
  268. * combiner port, and dsound.c.
  269. *
  270. * Default: (PJMEDIA_SND_DEFAULT_PLAY_LATENCY+20)/20
  271. */
  272. #ifndef PJMEDIA_SOUND_BUFFER_COUNT
  273. # define PJMEDIA_SOUND_BUFFER_COUNT ((PJMEDIA_SND_DEFAULT_PLAY_LATENCY+20)/20)
  274. #endif
  275. /**
  276. * Specify which A-law/U-law conversion algorithm to use.
  277. * By default the conversion algorithm uses A-law/U-law table which gives
  278. * the best performance, at the expense of 33 KBytes of static data.
  279. * If this option is disabled, a smaller but slower algorithm will be used.
  280. */
  281. #ifndef PJMEDIA_HAS_ALAW_ULAW_TABLE
  282. # define PJMEDIA_HAS_ALAW_ULAW_TABLE 1
  283. #endif
  284. /**
  285. * Unless specified otherwise, G711 codec is included by default.
  286. */
  287. #ifndef PJMEDIA_HAS_G711_CODEC
  288. # define PJMEDIA_HAS_G711_CODEC 1
  289. #endif
  290. /*
  291. * Warn about obsolete macros.
  292. *
  293. * PJMEDIA_HAS_SMALL_FILTER has been deprecated in 0.7.
  294. */
  295. #if defined(PJMEDIA_HAS_SMALL_FILTER)
  296. # ifdef _MSC_VER
  297. # pragma message("Warning: PJMEDIA_HAS_SMALL_FILTER macro is deprecated"\
  298. " and has no effect")
  299. # else
  300. # warning "PJMEDIA_HAS_SMALL_FILTER macro is deprecated and has no effect"
  301. # endif
  302. #endif
  303. /*
  304. * Warn about obsolete macros.
  305. *
  306. * PJMEDIA_HAS_LARGE_FILTER has been deprecated in 0.7.
  307. */
  308. #if defined(PJMEDIA_HAS_LARGE_FILTER)
  309. # ifdef _MSC_VER
  310. # pragma message("Warning: PJMEDIA_HAS_LARGE_FILTER macro is deprecated"\
  311. " and has no effect")
  312. # else
  313. # warning "PJMEDIA_HAS_LARGE_FILTER macro is deprecated"
  314. # endif
  315. #endif
  316. /*
  317. * These macros are obsolete in 0.7.1 so it will trigger compilation error.
  318. * Please use PJMEDIA_RESAMPLE_IMP to select the resample implementation
  319. * to use.
  320. */
  321. #ifdef PJMEDIA_HAS_LIBRESAMPLE
  322. # error "PJMEDIA_HAS_LIBRESAMPLE macro is deprecated. Use '#define PJMEDIA_RESAMPLE_IMP PJMEDIA_RESAMPLE_LIBRESAMPLE'"
  323. #endif
  324. #ifdef PJMEDIA_HAS_SPEEX_RESAMPLE
  325. # error "PJMEDIA_HAS_SPEEX_RESAMPLE macro is deprecated. Use '#define PJMEDIA_RESAMPLE_IMP PJMEDIA_RESAMPLE_SPEEX'"
  326. #endif
  327. /*
  328. * Sample rate conversion backends.
  329. * Select one of these backends in PJMEDIA_RESAMPLE_IMP.
  330. */
  331. /** No resampling */
  332. #define PJMEDIA_RESAMPLE_NONE 1
  333. /** Sample rate conversion using libresample */
  334. #define PJMEDIA_RESAMPLE_LIBRESAMPLE 2
  335. /** Sample rate conversion using Speex */
  336. #define PJMEDIA_RESAMPLE_SPEEX 3
  337. /** Sample rate conversion using libsamplerate (a.k.a Secret Rabbit Code) */
  338. #define PJMEDIA_RESAMPLE_LIBSAMPLERATE 4
  339. /**
  340. * Select which resample implementation to use. Currently pjmedia supports:
  341. * - #PJMEDIA_RESAMPLE_LIBRESAMPLE, to use libresample-1.7, this is the default
  342. * implementation to be used.
  343. * - #PJMEDIA_RESAMPLE_LIBSAMPLERATE, to use libsamplerate implementation
  344. * (a.k.a. Secret Rabbit Code).
  345. * - #PJMEDIA_RESAMPLE_SPEEX, to use sample rate conversion in Speex library.
  346. * - #PJMEDIA_RESAMPLE_NONE, to disable sample rate conversion. Any calls to
  347. * resample function will return error.
  348. *
  349. * Default is PJMEDIA_RESAMPLE_LIBRESAMPLE
  350. */
  351. #ifndef PJMEDIA_RESAMPLE_IMP
  352. # define PJMEDIA_RESAMPLE_IMP PJMEDIA_RESAMPLE_LIBRESAMPLE
  353. #endif
  354. /**
  355. * Specify whether libsamplerate, when used, should be linked statically
  356. * into the application. This option is only useful for Visual Studio
  357. * projects, and when this static linking is enabled
  358. */
  359. /**
  360. * Default file player/writer buffer size.
  361. */
  362. #ifndef PJMEDIA_FILE_PORT_BUFSIZE
  363. # define PJMEDIA_FILE_PORT_BUFSIZE 4000
  364. #endif
  365. /**
  366. * Maximum frame duration (in msec) to be supported.
  367. * This (among other thing) will affect the size of buffers to be allocated
  368. * for outgoing packets.
  369. */
  370. #ifndef PJMEDIA_MAX_FRAME_DURATION_MS
  371. # define PJMEDIA_MAX_FRAME_DURATION_MS 200
  372. #endif
  373. /**
  374. * Max packet size for transmitting direction.
  375. */
  376. #ifndef PJMEDIA_MAX_MTU
  377. # define PJMEDIA_MAX_MTU 1500
  378. #endif
  379. /**
  380. * Max packet size for receiving direction.
  381. */
  382. #ifndef PJMEDIA_MAX_MRU
  383. # define PJMEDIA_MAX_MRU 2000
  384. #endif
  385. /**
  386. * DTMF/telephone-event duration, in timestamp. To specify the duration in
  387. * milliseconds, use the setting PJMEDIA_DTMF_DURATION_MSEC instead.
  388. *
  389. * Note that for a clockrate of 8 KHz, a dtmf duration of 1600 timestamp
  390. * units (the default value of PJMEDIA_DTMF_DURATION) is equivalent to 200 ms.
  391. */
  392. #ifndef PJMEDIA_DTMF_DURATION
  393. # define PJMEDIA_DTMF_DURATION 1600 /* in timestamp */
  394. #endif
  395. /**
  396. * DTMF/telephone-event duration, in milliseconds. If the value is greater
  397. * than zero, than this setting will be used instead of PJMEDIA_DTMF_DURATION.
  398. */
  399. #ifndef PJMEDIA_DTMF_DURATION_MSEC
  400. # define PJMEDIA_DTMF_DURATION_MSEC 200
  401. #endif
  402. /**
  403. * Number of RTP packets received from different source IP address from the
  404. * remote address required to make the stream switch transmission
  405. * to the source address.
  406. */
  407. #ifndef PJMEDIA_RTP_NAT_PROBATION_CNT
  408. # define PJMEDIA_RTP_NAT_PROBATION_CNT 10
  409. #endif
  410. /**
  411. * Number of RTCP packets received from different source IP address from the
  412. * remote address required to make the stream switch RTCP transmission
  413. * to the source address.
  414. */
  415. #ifndef PJMEDIA_RTCP_NAT_PROBATION_CNT
  416. # define PJMEDIA_RTCP_NAT_PROBATION_CNT 3
  417. #endif
  418. /**
  419. * Specify whether RTCP should be advertised in SDP. This setting would
  420. * affect whether RTCP candidate will be added in SDP when ICE is used.
  421. * Application might want to disable RTCP advertisement in SDP to
  422. * reduce the message size.
  423. *
  424. * Default: 1 (yes)
  425. */
  426. #ifndef PJMEDIA_ADVERTISE_RTCP
  427. # define PJMEDIA_ADVERTISE_RTCP 1
  428. #endif
  429. /**
  430. * Interval to send regular RTCP packets, in msec.
  431. */
  432. #ifndef PJMEDIA_RTCP_INTERVAL
  433. # define PJMEDIA_RTCP_INTERVAL 5000 /* msec*/
  434. #endif
  435. /**
  436. * Minimum interval between two consecutive outgoing RTCP-FB packets,
  437. * such as Picture Loss Indication, in msec.
  438. */
  439. #ifndef PJMEDIA_RTCP_FB_INTERVAL
  440. # define PJMEDIA_RTCP_FB_INTERVAL 50 /* msec*/
  441. #endif
  442. /**
  443. * Tell RTCP to ignore the first N packets when calculating the
  444. * jitter statistics. From experimentation, the first few packets
  445. * (25 or so) have relatively big jitter, possibly because during
  446. * this time, the program is also busy setting up the signaling,
  447. * so they make the average jitter big.
  448. *
  449. * Default: 25.
  450. */
  451. #ifndef PJMEDIA_RTCP_IGNORE_FIRST_PACKETS
  452. # define PJMEDIA_RTCP_IGNORE_FIRST_PACKETS 25
  453. #endif
  454. /**
  455. * Specify whether RTCP statistics includes raw jitter statistics.
  456. * Raw jitter is defined as absolute value of network transit time
  457. * difference of two consecutive packets; refering to "difference D"
  458. * term in interarrival jitter calculation in RFC 3550 section 6.4.1.
  459. *
  460. * Default: 0 (no).
  461. */
  462. #ifndef PJMEDIA_RTCP_STAT_HAS_RAW_JITTER
  463. # define PJMEDIA_RTCP_STAT_HAS_RAW_JITTER 0
  464. #endif
  465. /**
  466. * Specify the factor with wich RTCP RTT statistics should be normalized
  467. * if exceptionally high. For e.g. mobile networks with potentially large
  468. * fluctuations, this might be unwanted.
  469. *
  470. * Use (0) to disable this feature.
  471. *
  472. * Default: 3.
  473. */
  474. #ifndef PJMEDIA_RTCP_NORMALIZE_FACTOR
  475. # define PJMEDIA_RTCP_NORMALIZE_FACTOR 3
  476. #endif
  477. /**
  478. * Specify whether RTCP statistics includes IP Delay Variation statistics.
  479. * IPDV is defined as network transit time difference of two consecutive
  480. * packets. The IPDV statistic can be useful to inspect clock skew existance
  481. * and level, e.g: when the IPDV mean values were stable in positive numbers,
  482. * then the remote clock (used in sending RTP packets) is faster than local
  483. * system clock. Ideally, the IPDV mean values are always equal to 0.
  484. *
  485. * Default: 0 (no).
  486. */
  487. #ifndef PJMEDIA_RTCP_STAT_HAS_IPDV
  488. # define PJMEDIA_RTCP_STAT_HAS_IPDV 0
  489. #endif
  490. /**
  491. * Specify whether RTCP XR support should be built into PJMEDIA. Disabling
  492. * this feature will reduce footprint slightly. Note that even when this
  493. * setting is enabled, RTCP XR processing will only be performed in stream
  494. * if it is enabled on run-time on per stream basis. See
  495. * PJMEDIA_STREAM_ENABLE_XR setting for more info.
  496. *
  497. * Default: 0 (no).
  498. */
  499. #ifndef PJMEDIA_HAS_RTCP_XR
  500. # define PJMEDIA_HAS_RTCP_XR 0
  501. #endif
  502. /**
  503. * The RTCP XR feature is activated and used by stream if \a enable_rtcp_xr
  504. * field of \a pjmedia_stream_info structure is non-zero. This setting
  505. * controls the default value of this field.
  506. *
  507. * Default: 0 (disabled)
  508. */
  509. #ifndef PJMEDIA_STREAM_ENABLE_XR
  510. # define PJMEDIA_STREAM_ENABLE_XR 0
  511. #endif
  512. /**
  513. * Specify the buffer length for storing any received RTCP SDES text
  514. * in a stream session. Usually RTCP contains only the mandatory SDES
  515. * field, i.e: CNAME.
  516. *
  517. * Default: 64 bytes.
  518. */
  519. #ifndef PJMEDIA_RTCP_RX_SDES_BUF_LEN
  520. # define PJMEDIA_RTCP_RX_SDES_BUF_LEN 64
  521. #endif
  522. /**
  523. * Specify the maximum number of RTCP Feedback capability definition.
  524. *
  525. * Default: 16
  526. */
  527. #ifndef PJMEDIA_RTCP_FB_MAX_CAP
  528. # define PJMEDIA_RTCP_FB_MAX_CAP 16
  529. #endif
  530. /**
  531. * Specify how long (in miliseconds) the stream should suspend the
  532. * silence detector/voice activity detector (VAD) during the initial
  533. * period of the session. This feature is useful to open bindings in
  534. * all NAT routers between local and remote endpoint since most NATs
  535. * do not allow incoming packet to get in before local endpoint sends
  536. * outgoing packets.
  537. *
  538. * Specify zero to disable this feature.
  539. *
  540. * Default: 600 msec (which gives good probability that some RTP
  541. * packets will reach the destination, but without
  542. * filling up the jitter buffer on the remote end).
  543. */
  544. #ifndef PJMEDIA_STREAM_VAD_SUSPEND_MSEC
  545. # define PJMEDIA_STREAM_VAD_SUSPEND_MSEC 600
  546. #endif
  547. /**
  548. * Perform RTP payload type checking in the audio stream. Normally the peer
  549. * MUST send RTP with payload type as we specified in our SDP. Certain
  550. * agents may not be able to follow this hence the only way to have
  551. * communication is to disable this check.
  552. *
  553. * Default: 1
  554. */
  555. #ifndef PJMEDIA_STREAM_CHECK_RTP_PT
  556. # define PJMEDIA_STREAM_CHECK_RTP_PT 1
  557. #endif
  558. /**
  559. * Reserve some space for application extra data, e.g: SRTP auth tag,
  560. * in RTP payload, so the total payload length will not exceed the MTU.
  561. */
  562. #ifndef PJMEDIA_STREAM_RESV_PAYLOAD_LEN
  563. # define PJMEDIA_STREAM_RESV_PAYLOAD_LEN 20
  564. #endif
  565. /**
  566. * Specify the maximum duration of silence period in the codec, in msec.
  567. * This is useful for example to keep NAT binding open in the firewall
  568. * and to prevent server from disconnecting the call because no
  569. * RTP packet is received.
  570. *
  571. * This only applies to codecs that use PJMEDIA's VAD such as G711, GSM,
  572. * iLBC, G722, G722.1, L16. Some other codecs, such as Speex, Opus, G729,
  573. * have their own VAD/DTX mechanism will not be affected by this setting.
  574. *
  575. * Use (-1) to disable this feature.
  576. *
  577. * Default: 5000 ms
  578. */
  579. #ifndef PJMEDIA_CODEC_MAX_SILENCE_PERIOD
  580. # define PJMEDIA_CODEC_MAX_SILENCE_PERIOD 5000
  581. #endif
  582. /**
  583. * Suggested or default threshold to be set for fixed silence detection
  584. * or as starting threshold for adaptive silence detection. The threshold
  585. * has the range from zero to 0xFFFF.
  586. */
  587. #ifndef PJMEDIA_SILENCE_DET_THRESHOLD
  588. # define PJMEDIA_SILENCE_DET_THRESHOLD 4
  589. #endif
  590. /**
  591. * Maximum silence threshold in the silence detector. The silence detector
  592. * will not cut the audio transmission if the audio level is above this
  593. * level.
  594. *
  595. * Use 0x10000 (or greater) to disable this feature.
  596. *
  597. * Default: 0x10000 (disabled)
  598. */
  599. #ifndef PJMEDIA_SILENCE_DET_MAX_THRESHOLD
  600. # define PJMEDIA_SILENCE_DET_MAX_THRESHOLD 0x10000
  601. #endif
  602. /**
  603. * Speex Accoustic Echo Cancellation (AEC).
  604. * By default is enabled.
  605. */
  606. #ifndef PJMEDIA_HAS_SPEEX_AEC
  607. # define PJMEDIA_HAS_SPEEX_AEC 1
  608. #endif
  609. /**
  610. * Specify whether Automatic Gain Control (AGC) should also be enabled in
  611. * Speex AEC.
  612. *
  613. * Default: 1 (yes)
  614. */
  615. #ifndef PJMEDIA_SPEEX_AEC_USE_AGC
  616. # define PJMEDIA_SPEEX_AEC_USE_AGC 1
  617. #endif
  618. /**
  619. * Specify whether denoise should also be enabled in Speex AEC.
  620. *
  621. * Default: 1 (yes)
  622. */
  623. #ifndef PJMEDIA_SPEEX_AEC_USE_DENOISE
  624. # define PJMEDIA_SPEEX_AEC_USE_DENOISE 1
  625. #endif
  626. /**
  627. * WebRtc Accoustic Echo Cancellation (AEC).
  628. * By default is disabled.
  629. */
  630. #ifndef PJMEDIA_HAS_WEBRTC_AEC
  631. # define PJMEDIA_HAS_WEBRTC_AEC 0
  632. #endif
  633. /**
  634. * Specify whether WebRtc EC should use its mobile version AEC.
  635. *
  636. * Default: 0 (no)
  637. */
  638. #ifndef PJMEDIA_WEBRTC_AEC_USE_MOBILE
  639. # define PJMEDIA_WEBRTC_AEC_USE_MOBILE 0
  640. #endif
  641. /**
  642. * Maximum number of parameters in SDP fmtp attribute.
  643. *
  644. * Default: 16
  645. */
  646. #ifndef PJMEDIA_CODEC_MAX_FMTP_CNT
  647. # define PJMEDIA_CODEC_MAX_FMTP_CNT 16
  648. #endif
  649. /**
  650. * This specifies the behavior of the SDP negotiator when responding to an
  651. * offer, whether it should rather use the codec preference as set by
  652. * remote, or should it rather use the codec preference as specified by
  653. * local endpoint.
  654. *
  655. * For example, suppose incoming call has codec order "8 0 3", while
  656. * local codec order is "3 0 8". If remote codec order is preferable,
  657. * the selected codec will be 8, while if local codec order is preferable,
  658. * the selected codec will be 3.
  659. *
  660. * If set to non-zero, the negotiator will use the codec order as specified
  661. * by remote in the offer.
  662. *
  663. * Note that this behavior can be changed during run-time by calling
  664. * pjmedia_sdp_neg_set_prefer_remote_codec_order().
  665. *
  666. * Default is 1 (to maintain backward compatibility)
  667. */
  668. #ifndef PJMEDIA_SDP_NEG_PREFER_REMOTE_CODEC_ORDER
  669. # define PJMEDIA_SDP_NEG_PREFER_REMOTE_CODEC_ORDER 1
  670. #endif
  671. /**
  672. * This specifies the behavior of the SDP negotiator when responding to an
  673. * offer, whether it should answer with multiple formats or not.
  674. *
  675. * Note that this behavior can be changed during run-time by calling
  676. * pjmedia_sdp_neg_set_allow_multiple_codecs().
  677. *
  678. * Default is 0 (to maintain backward compatibility)
  679. */
  680. #ifndef PJMEDIA_SDP_NEG_ANSWER_MULTIPLE_CODECS
  681. # define PJMEDIA_SDP_NEG_ANSWER_MULTIPLE_CODECS 0
  682. #endif
  683. /**
  684. * This specifies the maximum number of the customized SDP format
  685. * negotiation callbacks.
  686. */
  687. #ifndef PJMEDIA_SDP_NEG_MAX_CUSTOM_FMT_NEG_CB
  688. # define PJMEDIA_SDP_NEG_MAX_CUSTOM_FMT_NEG_CB 8
  689. #endif
  690. /**
  691. * This specifies if the SDP negotiator should rewrite answer payload
  692. * type numbers to use the same payload type numbers as the remote offer
  693. * for all matched codecs.
  694. *
  695. * Default is 1 (yes)
  696. */
  697. #ifndef PJMEDIA_SDP_NEG_ANSWER_SYMMETRIC_PT
  698. # define PJMEDIA_SDP_NEG_ANSWER_SYMMETRIC_PT 1
  699. #endif
  700. /**
  701. * The SDP negotiator will maintain that the mapping from a particular
  702. * dynamic payload type number to a particular codec does not change,
  703. * as mandated by RFC 3264 section 8.3.2.
  704. * By default, the mapping is maintained for local endpoint only, i.e.
  705. * it only takes into account local offer and local answer.
  706. * Enable this if application wishes to maintain PT->codec mapping for
  707. * remote endpoint as well, i.e. to update the mapping based on remote
  708. * offer and answer too.
  709. *
  710. * Default is 0 (no)
  711. */
  712. #ifndef PJMEDIA_SDP_NEG_MAINTAIN_REMOTE_PT_MAP
  713. # define PJMEDIA_SDP_NEG_MAINTAIN_REMOTE_PT_MAP 0
  714. #endif
  715. /**
  716. * This specifies if the SDP negotiator should compare its content before
  717. * incrementing the origin version on the subsequent offer/answer.
  718. * If this is set to 1, origin version will only by incremented if the
  719. * new offer/answer is different than the previous one. For backward
  720. * compatibility and performance this is set to 0.
  721. *
  722. * Default is 0 (No)
  723. *
  724. * This macro has been deprecated in version 2.14.
  725. * See https://github.com/pjsip/pjproject/pull/3322 for more info.
  726. */
  727. #ifdef PJMEDIA_SDP_NEG_COMPARE_BEFORE_INC_VERSION
  728. # ifdef _MSC_VER
  729. # pragma message("Warning: PJMEDIA_SDP_NEG_COMPARE_BEFORE_INC_VERSION macro is"\
  730. " deprecated and has no effect")
  731. # else
  732. # warning "PJMEDIA_SDP_NEG_COMPARE_BEFORE_INC_VERSION macro is deprecated"\
  733. " and has no effect"
  734. # endif
  735. #endif
  736. /**
  737. * Support for sending and decoding RTCP port in SDP (RFC 3605).
  738. * Default is equal to PJMEDIA_ADVERTISE_RTCP setting.
  739. */
  740. #ifndef PJMEDIA_HAS_RTCP_IN_SDP
  741. # define PJMEDIA_HAS_RTCP_IN_SDP (PJMEDIA_ADVERTISE_RTCP)
  742. #endif
  743. /**
  744. * This macro controls whether pjmedia should include SDP
  745. * bandwidth modifier "TIAS" (RFC3890).
  746. *
  747. * Note that there is also a run-time variable to turn this setting
  748. * on or off, defined in endpoint.c. To access this variable, use
  749. * the following construct
  750. *
  751. \verbatim
  752. extern pj_bool_t pjmedia_add_bandwidth_tias_in_sdp;
  753. // Do not enable bandwidth information inclusion in sdp
  754. pjmedia_add_bandwidth_tias_in_sdp = PJ_FALSE;
  755. \endverbatim
  756. *
  757. * Default: 1 (yes)
  758. */
  759. #ifndef PJMEDIA_ADD_BANDWIDTH_TIAS_IN_SDP
  760. # define PJMEDIA_ADD_BANDWIDTH_TIAS_IN_SDP 1
  761. #endif
  762. /**
  763. * This macro controls whether pjmedia should include SDP rtpmap
  764. * attribute for static payload types. SDP rtpmap for static
  765. * payload types are optional, although they are normally included
  766. * for interoperability reason.
  767. *
  768. * Note that there is also a run-time variable to turn this setting
  769. * on or off, defined in endpoint.c. To access this variable, use
  770. * the following construct
  771. *
  772. \verbatim
  773. extern pj_bool_t pjmedia_add_rtpmap_for_static_pt;
  774. // Do not include rtpmap for static payload types (<96)
  775. pjmedia_add_rtpmap_for_static_pt = PJ_FALSE;
  776. \endverbatim
  777. *
  778. * Default: 1 (yes)
  779. */
  780. #ifndef PJMEDIA_ADD_RTPMAP_FOR_STATIC_PT
  781. # define PJMEDIA_ADD_RTPMAP_FOR_STATIC_PT 1
  782. #endif
  783. /**
  784. * This macro declares the start payload type for telephone-event
  785. * that is advertised by PJMEDIA for outgoing SDP. If this macro
  786. * is set to zero, telephone events would not be advertised nor
  787. * supported.
  788. */
  789. #ifndef PJMEDIA_RTP_PT_TELEPHONE_EVENTS
  790. # define PJMEDIA_RTP_PT_TELEPHONE_EVENTS 120
  791. #endif
  792. /**
  793. * This macro declares whether PJMEDIA should generate multiple
  794. * telephone-event formats in SDP offer, i.e: one for each audio codec
  795. * clock rate (see also ticket #2088). If this macro is set to zero, only
  796. * one telephone event format will be generated and it uses clock rate 8kHz
  797. * (old behavior before ticket #2088).
  798. *
  799. * Default: 1 (yes)
  800. */
  801. #ifndef PJMEDIA_TELEPHONE_EVENT_ALL_CLOCKRATES
  802. # define PJMEDIA_TELEPHONE_EVENT_ALL_CLOCKRATES 1
  803. #endif
  804. /**
  805. * Maximum tones/digits that can be enqueued in the tone generator.
  806. */
  807. #ifndef PJMEDIA_TONEGEN_MAX_DIGITS
  808. # define PJMEDIA_TONEGEN_MAX_DIGITS 32
  809. #endif
  810. /*
  811. * Below specifies the various tone generator backend algorithm.
  812. */
  813. /**
  814. * The math's sine(), floating point. This has very good precision
  815. * but it's the slowest and requires floating point support and
  816. * linking with the math library.
  817. */
  818. #define PJMEDIA_TONEGEN_SINE 1
  819. /**
  820. * Floating point approximation of sine(). This has relatively good
  821. * precision and much faster than plain sine(), but it requires floating-
  822. * point support and linking with the math library.
  823. */
  824. #define PJMEDIA_TONEGEN_FLOATING_POINT 2
  825. /**
  826. * Fixed point using sine signal generated by Cordic algorithm. This
  827. * algorithm can be tuned to provide balance between precision and
  828. * performance by tuning the PJMEDIA_TONEGEN_FIXED_POINT_CORDIC_LOOP
  829. * setting, and may be suitable for platforms that lack floating-point
  830. * support.
  831. */
  832. #define PJMEDIA_TONEGEN_FIXED_POINT_CORDIC 3
  833. /**
  834. * Fast fixed point using some approximation to generate sine waves.
  835. * The tone generated by this algorithm is not very precise, however
  836. * the algorithm is very fast.
  837. */
  838. #define PJMEDIA_TONEGEN_FAST_FIXED_POINT 4
  839. /**
  840. * Specify the tone generator algorithm to be used. Please see
  841. * https://docs.pjsip.org/en/latest/specific-guides/media/tonegen.html for
  842. * the performance analysis results of the various tone generator algorithms.
  843. *
  844. * Default value:
  845. * - PJMEDIA_TONEGEN_FLOATING_POINT when PJ_HAS_FLOATING_POINT is set
  846. * - PJMEDIA_TONEGEN_FIXED_POINT_CORDIC when PJ_HAS_FLOATING_POINT is not set
  847. */
  848. #ifndef PJMEDIA_TONEGEN_ALG
  849. # if defined(PJ_HAS_FLOATING_POINT) && PJ_HAS_FLOATING_POINT
  850. # define PJMEDIA_TONEGEN_ALG PJMEDIA_TONEGEN_FLOATING_POINT
  851. # else
  852. # define PJMEDIA_TONEGEN_ALG PJMEDIA_TONEGEN_FIXED_POINT_CORDIC
  853. # endif
  854. #endif
  855. /**
  856. * Specify the number of calculation loops to generate the tone, when
  857. * PJMEDIA_TONEGEN_FIXED_POINT_CORDIC algorithm is used. With more calculation
  858. * loops, the tone signal gets more precise, but this will add more
  859. * processing.
  860. *
  861. * Valid values are 1 to 28.
  862. *
  863. * Default value: 10
  864. */
  865. #ifndef PJMEDIA_TONEGEN_FIXED_POINT_CORDIC_LOOP
  866. # define PJMEDIA_TONEGEN_FIXED_POINT_CORDIC_LOOP 10
  867. #endif
  868. /**
  869. * Enable high quality of tone generation, the better quality will cost
  870. * more CPU load. This is only applied to floating point enabled machines.
  871. *
  872. * By default it is enabled when PJ_HAS_FLOATING_POINT is set.
  873. *
  874. * This macro has been deprecated in version 1.0-rc3.
  875. */
  876. #ifdef PJMEDIA_USE_HIGH_QUALITY_TONEGEN
  877. # error "The PJMEDIA_USE_HIGH_QUALITY_TONEGEN macro is obsolete"
  878. #endif
  879. /**
  880. * Fade-in duration for the tone, in milliseconds. Set to zero to disable
  881. * this feature.
  882. *
  883. * Default: 1 (msec)
  884. */
  885. #ifndef PJMEDIA_TONEGEN_FADE_IN_TIME
  886. # define PJMEDIA_TONEGEN_FADE_IN_TIME 1
  887. #endif
  888. /**
  889. * Fade-out duration for the tone, in milliseconds. Set to zero to disable
  890. * this feature.
  891. *
  892. * Default: 2 (msec)
  893. */
  894. #ifndef PJMEDIA_TONEGEN_FADE_OUT_TIME
  895. # define PJMEDIA_TONEGEN_FADE_OUT_TIME 2
  896. #endif
  897. /**
  898. * The default tone generator amplitude (1-32767).
  899. *
  900. * Default value: 12288
  901. */
  902. #ifndef PJMEDIA_TONEGEN_VOLUME
  903. # define PJMEDIA_TONEGEN_VOLUME 12288
  904. #endif
  905. /**
  906. * Enable support for SRTP media transport. This will require linking
  907. * with libsrtp from the third_party directory.
  908. *
  909. * By default it is enabled.
  910. */
  911. #ifndef PJMEDIA_HAS_SRTP
  912. # define PJMEDIA_HAS_SRTP 1
  913. #endif
  914. /**
  915. * Enable session description for SRTP keying.
  916. *
  917. * By default it is enabled.
  918. */
  919. #ifndef PJMEDIA_SRTP_HAS_SDES
  920. # define PJMEDIA_SRTP_HAS_SDES 1
  921. #endif
  922. /**
  923. * Enable DTLS for SRTP keying.
  924. *
  925. * Default value: 0 (disabled)
  926. */
  927. #ifndef PJMEDIA_SRTP_HAS_DTLS
  928. # define PJMEDIA_SRTP_HAS_DTLS 0
  929. #endif
  930. /**
  931. * Set OpenSSL ciphers for DTLS-SRTP.
  932. *
  933. * Default value: "DEFAULT"
  934. */
  935. #ifndef PJMEDIA_SRTP_DTLS_OSSL_CIPHERS
  936. # define PJMEDIA_SRTP_DTLS_OSSL_CIPHERS "DEFAULT"
  937. #endif
  938. /**
  939. * Maximum number of SRTP cryptos.
  940. *
  941. * Default: 16
  942. */
  943. #ifndef PJMEDIA_SRTP_MAX_CRYPTOS
  944. # define PJMEDIA_SRTP_MAX_CRYPTOS 16
  945. #endif
  946. /**
  947. * Enable AES_CM_256 cryptos in SRTP.
  948. * Default: enabled.
  949. */
  950. #ifndef PJMEDIA_SRTP_HAS_AES_CM_256
  951. # define PJMEDIA_SRTP_HAS_AES_CM_256 1
  952. #endif
  953. /**
  954. * Enable AES_CM_192 cryptos in SRTP.
  955. * It was reported that this crypto only works among libsrtp backends,
  956. * so we recommend to disable this.
  957. *
  958. * To enable this, you would require OpenSSL which supports it.
  959. * See https://github.com/pjsip/pjproject/issues/1943 for more info.
  960. *
  961. * Default: disabled.
  962. */
  963. #ifndef PJMEDIA_SRTP_HAS_AES_CM_192
  964. # define PJMEDIA_SRTP_HAS_AES_CM_192 0
  965. #endif
  966. /**
  967. * Enable AES_CM_128 cryptos in SRTP.
  968. * Default: enabled.
  969. */
  970. #ifndef PJMEDIA_SRTP_HAS_AES_CM_128
  971. # define PJMEDIA_SRTP_HAS_AES_CM_128 1
  972. #endif
  973. /**
  974. * Enable AES_GCM_256 cryptos in SRTP.
  975. *
  976. * To enable this, you would require OpenSSL which supports it.
  977. * See https://github.com/pjsip/pjproject/issues/1943 for more info.
  978. *
  979. * Default: disabled.
  980. */
  981. #ifndef PJMEDIA_SRTP_HAS_AES_GCM_256
  982. # define PJMEDIA_SRTP_HAS_AES_GCM_256 0
  983. #endif
  984. /**
  985. * Enable AES_GCM_128 cryptos in SRTP.
  986. *
  987. * To enable this, you would require OpenSSL which supports it.
  988. * See https://github.com/pjsip/pjproject/issues/1943 for more info.
  989. *
  990. * Default: disabled.
  991. */
  992. #ifndef PJMEDIA_SRTP_HAS_AES_GCM_128
  993. # define PJMEDIA_SRTP_HAS_AES_GCM_128 0
  994. #endif
  995. /**
  996. * Specify whether SRTP needs to handle condition that old packets with
  997. * incorect RTP seq are still coming when SRTP is restarted.
  998. *
  999. * Default: enabled.
  1000. */
  1001. #ifndef PJMEDIA_SRTP_CHECK_RTP_SEQ_ON_RESTART
  1002. # define PJMEDIA_SRTP_CHECK_RTP_SEQ_ON_RESTART 1
  1003. #endif
  1004. /**
  1005. * Specify whether SRTP needs to handle condition that remote may reset
  1006. * or maintain ROC when SRTP is restarted.
  1007. *
  1008. * Default: enabled.
  1009. */
  1010. #ifndef PJMEDIA_SRTP_CHECK_ROC_ON_RESTART
  1011. # define PJMEDIA_SRTP_CHECK_ROC_ON_RESTART 1
  1012. #endif
  1013. /**
  1014. * Let the library handle libsrtp initialization and deinitialization.
  1015. * Application may want to disable this and manually perform libsrtp
  1016. * initialization and deinitialization when it needs to use libsrtp
  1017. * before the library is initialized or after the library is shutdown.
  1018. *
  1019. * By default it is enabled.
  1020. */
  1021. #ifndef PJMEDIA_LIBSRTP_AUTO_INIT_DEINIT
  1022. # define PJMEDIA_LIBSRTP_AUTO_INIT_DEINIT 1
  1023. #endif
  1024. /**
  1025. * Enable support to handle codecs with inconsistent clock rate
  1026. * between clock rate in SDP/RTP & the clock rate that is actually used.
  1027. * This happens for example with G.722 and MPEG audio codecs.
  1028. * See:
  1029. * - G.722 : RFC 3551 4.5.2
  1030. * - MPEG audio : RFC 3551 4.5.13 & RFC 3119
  1031. * - OPUS : RFC 7587
  1032. *
  1033. * Also when this feature is enabled, some handling will be performed
  1034. * to deal with clock rate incompatibilities of some phones.
  1035. *
  1036. * By default it is enabled.
  1037. */
  1038. #ifndef PJMEDIA_HANDLE_G722_MPEG_BUG
  1039. # define PJMEDIA_HANDLE_G722_MPEG_BUG 1
  1040. #endif
  1041. /* Setting to determine if media transport should switch RTP and RTCP
  1042. * remote address to the source address of the packets it receives.
  1043. *
  1044. * By default it is enabled.
  1045. */
  1046. #ifndef PJMEDIA_TRANSPORT_SWITCH_REMOTE_ADDR
  1047. # define PJMEDIA_TRANSPORT_SWITCH_REMOTE_ADDR 1
  1048. #endif
  1049. /**
  1050. * Transport info (pjmedia_transport_info) contains a socket info and list
  1051. * of transport specific info, since transports can be chained together
  1052. * (for example, SRTP transport uses UDP transport as the underlying
  1053. * transport). This constant specifies maximum number of transport specific
  1054. * infos that can be held in a transport info.
  1055. */
  1056. #ifndef PJMEDIA_TRANSPORT_SPECIFIC_INFO_MAXCNT
  1057. # define PJMEDIA_TRANSPORT_SPECIFIC_INFO_MAXCNT 4
  1058. #endif
  1059. /**
  1060. * Maximum size in bytes of storage buffer of a transport specific info.
  1061. */
  1062. #ifndef PJMEDIA_TRANSPORT_SPECIFIC_INFO_MAXSIZE
  1063. # define PJMEDIA_TRANSPORT_SPECIFIC_INFO_MAXSIZE (50*sizeof(long))
  1064. #endif
  1065. /**
  1066. * Value to be specified in PJMEDIA_STREAM_ENABLE_KA setting.
  1067. * This indicates that an empty RTP packet should be used as
  1068. * the keep-alive packet.
  1069. */
  1070. #define PJMEDIA_STREAM_KA_EMPTY_RTP 1
  1071. /**
  1072. * Value to be specified in PJMEDIA_STREAM_ENABLE_KA setting.
  1073. * This indicates that a user defined packet should be used
  1074. * as the keep-alive packet. The content of the user-defined
  1075. * packet is specified by PJMEDIA_STREAM_KA_USER_PKT. Default
  1076. * content is a CR-LF packet.
  1077. */
  1078. #define PJMEDIA_STREAM_KA_USER 2
  1079. /**
  1080. * The content of the user defined keep-alive packet. The format
  1081. * of the packet is initializer to pj_str_t structure. Note that
  1082. * the content may contain NULL character.
  1083. */
  1084. #ifndef PJMEDIA_STREAM_KA_USER_PKT
  1085. # define PJMEDIA_STREAM_KA_USER_PKT { "\r\n", 2 }
  1086. #endif
  1087. /**
  1088. * Specify another type of keep-alive and NAT hole punching
  1089. * mechanism (the other type is PJMEDIA_STREAM_VAD_SUSPEND_MSEC
  1090. * and PJMEDIA_CODEC_MAX_SILENCE_PERIOD) to be used by stream.
  1091. * When this feature is enabled, the stream will initially
  1092. * transmit one packet to punch a hole in NAT, and periodically
  1093. * transmit keep-alive packets.
  1094. *
  1095. * When this alternative keep-alive mechanism is used, application
  1096. * may disable the other keep-alive mechanisms, i.e: by setting
  1097. * PJMEDIA_STREAM_VAD_SUSPEND_MSEC to zero and
  1098. * PJMEDIA_CODEC_MAX_SILENCE_PERIOD to -1.
  1099. *
  1100. * The value of this macro specifies the type of packet used
  1101. * for the keep-alive mechanism. Valid values are
  1102. * PJMEDIA_STREAM_KA_EMPTY_RTP and PJMEDIA_STREAM_KA_USER.
  1103. *
  1104. * The duration of the keep-alive interval further can be set
  1105. * with PJMEDIA_STREAM_KA_INTERVAL setting.
  1106. *
  1107. * Default: 0 (disabled)
  1108. */
  1109. #ifndef PJMEDIA_STREAM_ENABLE_KA
  1110. # define PJMEDIA_STREAM_ENABLE_KA 0
  1111. #endif
  1112. /**
  1113. * Specify the keep-alive interval of PJMEDIA_STREAM_ENABLE_KA
  1114. * mechanism, in seconds.
  1115. *
  1116. * Default: 5 seconds
  1117. */
  1118. #ifndef PJMEDIA_STREAM_KA_INTERVAL
  1119. # define PJMEDIA_STREAM_KA_INTERVAL 5
  1120. #endif
  1121. /**
  1122. * Specify the number of keep-alive needed to be sent after the stream is
  1123. * created.
  1124. *
  1125. * Setting this to 0 will disable it.
  1126. *
  1127. * Default : 2
  1128. */
  1129. #ifndef PJMEDIA_STREAM_START_KA_CNT
  1130. # define PJMEDIA_STREAM_START_KA_CNT 2
  1131. #endif
  1132. /**
  1133. * Specify the interval to send keep-alive after the stream is created,
  1134. * in msec.
  1135. *
  1136. * Default : 1000
  1137. */
  1138. #ifndef PJMEDIA_STREAM_START_KA_INTERVAL_MSEC
  1139. # define PJMEDIA_STREAM_START_KA_INTERVAL_MSEC 1000
  1140. #endif
  1141. /**
  1142. * Specify the number of identical consecutive error that will be ignored when
  1143. * receiving RTP/RTCP data before the library tries to restart the transport.
  1144. *
  1145. * When receiving RTP/RTCP data, the library will ignore error besides
  1146. * PJ_EPENDING or PJ_ECANCELLED and continue the loop to receive the data.
  1147. * If the OS always return error, then the loop will continue non stop.
  1148. * This setting will limit the number of the identical consecutive error,
  1149. * before the library start to restart the transport. If error still happens
  1150. * after transport restart, then PJMEDIA_EVENT_MEDIA_TP_ERR event will be
  1151. * publish as a notification.
  1152. *
  1153. * If PJ_ESOCKETSTOP is raised, then transport will be restarted regardless
  1154. * of this setting.
  1155. *
  1156. * To always ignore the error when receving RTP/RTCP, set this to 0.
  1157. *
  1158. * Default : 20
  1159. */
  1160. #ifndef PJMEDIA_IGNORE_RECV_ERR_CNT
  1161. # define PJMEDIA_IGNORE_RECV_ERR_CNT 20
  1162. #endif
  1163. /*
  1164. * .... new stuffs ...
  1165. */
  1166. /*
  1167. * Video
  1168. */
  1169. /**
  1170. * Top level option to enable/disable video features.
  1171. *
  1172. * Default: 0 (disabled)
  1173. */
  1174. #ifndef PJMEDIA_HAS_VIDEO
  1175. # define PJMEDIA_HAS_VIDEO 0
  1176. #endif
  1177. /**
  1178. * Specify if FFMPEG is available. The value here will be used as the default
  1179. * value for other FFMPEG settings below.
  1180. *
  1181. * Default: 0
  1182. */
  1183. #ifndef PJMEDIA_HAS_FFMPEG
  1184. # define PJMEDIA_HAS_FFMPEG 0
  1185. #endif
  1186. /**
  1187. * Specify if FFMPEG libavformat is available.
  1188. *
  1189. * Default: PJMEDIA_HAS_FFMPEG (or detected by configure)
  1190. */
  1191. #ifndef PJMEDIA_HAS_LIBAVFORMAT
  1192. # define PJMEDIA_HAS_LIBAVFORMAT PJMEDIA_HAS_FFMPEG
  1193. #endif
  1194. /**
  1195. * Specify if FFMPEG libavformat is available.
  1196. *
  1197. * Default: PJMEDIA_HAS_FFMPEG (or detected by configure)
  1198. */
  1199. #ifndef PJMEDIA_HAS_LIBAVCODEC
  1200. # define PJMEDIA_HAS_LIBAVCODEC PJMEDIA_HAS_FFMPEG
  1201. #endif
  1202. /**
  1203. * Specify if FFMPEG libavutil is available.
  1204. *
  1205. * Default: PJMEDIA_HAS_FFMPEG (or detected by configure)
  1206. */
  1207. #ifndef PJMEDIA_HAS_LIBAVUTIL
  1208. # define PJMEDIA_HAS_LIBAVUTIL PJMEDIA_HAS_FFMPEG
  1209. #endif
  1210. /**
  1211. * Specify if FFMPEG libswscale is available.
  1212. *
  1213. * Default: PJMEDIA_HAS_FFMPEG (or detected by configure)
  1214. */
  1215. #ifndef PJMEDIA_HAS_LIBSWSCALE
  1216. # define PJMEDIA_HAS_LIBSWSCALE PJMEDIA_HAS_FFMPEG
  1217. #endif
  1218. /**
  1219. * Specify if FFMPEG libavdevice is available.
  1220. *
  1221. * Default: PJMEDIA_HAS_FFMPEG (or detected by configure)
  1222. */
  1223. #ifndef PJMEDIA_HAS_LIBAVDEVICE
  1224. # define PJMEDIA_HAS_LIBAVDEVICE PJMEDIA_HAS_FFMPEG
  1225. #endif
  1226. /**
  1227. * Maximum video planes.
  1228. *
  1229. * Default: 4
  1230. */
  1231. #ifndef PJMEDIA_MAX_VIDEO_PLANES
  1232. # define PJMEDIA_MAX_VIDEO_PLANES 4
  1233. #endif
  1234. /**
  1235. * Maximum number of video formats.
  1236. *
  1237. * Default: 32
  1238. */
  1239. #ifndef PJMEDIA_MAX_VIDEO_FORMATS
  1240. # define PJMEDIA_MAX_VIDEO_FORMATS 32
  1241. #endif
  1242. /**
  1243. * Specify the maximum time difference (in ms) for synchronization between
  1244. * two medias. If the synchronization media source is ahead of time
  1245. * greater than this duration, it is considered to make a very large jump
  1246. * and the synchronization will be reset.
  1247. *
  1248. * Default: 20000
  1249. */
  1250. #ifndef PJMEDIA_CLOCK_SYNC_MAX_SYNC_MSEC
  1251. # define PJMEDIA_CLOCK_SYNC_MAX_SYNC_MSEC 20000
  1252. #endif
  1253. /**
  1254. * Maximum video frame size.
  1255. * Default: 128kB
  1256. */
  1257. #ifndef PJMEDIA_MAX_VIDEO_ENC_FRAME_SIZE
  1258. # define PJMEDIA_MAX_VIDEO_ENC_FRAME_SIZE (1<<17)
  1259. #endif
  1260. /**
  1261. * Specify the maximum duration (in ms) for resynchronization. When a media
  1262. * is late to another media it is supposed to be synchronized to, it is
  1263. * guaranteed to be synchronized again after this duration. While if the
  1264. * media is ahead/early by t ms, it is guaranteed to be synchronized after
  1265. * t + this duration. This timing only applies if there is no additional
  1266. * resynchronization required during the specified duration.
  1267. *
  1268. * Default: 2000
  1269. */
  1270. #ifndef PJMEDIA_CLOCK_SYNC_MAX_RESYNC_DURATION
  1271. # define PJMEDIA_CLOCK_SYNC_MAX_RESYNC_DURATION 2000
  1272. #endif
  1273. /**
  1274. * Minimum gap between two consecutive discards in jitter buffer,
  1275. * in milliseconds.
  1276. *
  1277. * Default: 200 ms
  1278. */
  1279. #ifndef PJMEDIA_JBUF_DISC_MIN_GAP
  1280. # define PJMEDIA_JBUF_DISC_MIN_GAP 200
  1281. #endif
  1282. /**
  1283. * Minimum burst level reference used for calculating discard duration
  1284. * in jitter buffer progressive discard algorithm, in frames.
  1285. *
  1286. * Default: 1 frame
  1287. */
  1288. #ifndef PJMEDIA_JBUF_PRO_DISC_MIN_BURST
  1289. # define PJMEDIA_JBUF_PRO_DISC_MIN_BURST 1
  1290. #endif
  1291. /**
  1292. * Maximum burst level reference used for calculating discard duration
  1293. * in jitter buffer progressive discard algorithm, in frames.
  1294. *
  1295. * Default: 200 frames
  1296. */
  1297. #ifndef PJMEDIA_JBUF_PRO_DISC_MAX_BURST
  1298. # define PJMEDIA_JBUF_PRO_DISC_MAX_BURST 100
  1299. #endif
  1300. /**
  1301. * Duration for progressive discard algotithm in jitter buffer to discard
  1302. * an excessive frame when burst is equal to or lower than
  1303. * PJMEDIA_JBUF_PRO_DISC_MIN_BURST, in milliseconds.
  1304. *
  1305. * Default: 2000 ms
  1306. */
  1307. #ifndef PJMEDIA_JBUF_PRO_DISC_T1
  1308. # define PJMEDIA_JBUF_PRO_DISC_T1 2000
  1309. #endif
  1310. /**
  1311. * Duration for progressive discard algotithm in jitter buffer to discard
  1312. * an excessive frame when burst is equal to or greater than
  1313. * PJMEDIA_JBUF_PRO_DISC_MAX_BURST, in milliseconds.
  1314. *
  1315. * Default: 10000 ms
  1316. */
  1317. #ifndef PJMEDIA_JBUF_PRO_DISC_T2
  1318. # define PJMEDIA_JBUF_PRO_DISC_T2 10000
  1319. #endif
  1320. /**
  1321. * Reset jitter buffer and return silent audio on stream playback start
  1322. * (first get_frame()). This is useful to avoid possible noise that may be
  1323. * introduced by discard algorithm and neutralize latency when audio device
  1324. * is started later than the stream.
  1325. *
  1326. * Set this to N>0 to allow N silent audio frames returned on stream playback
  1327. * start, this will allow about N frames to be buffered in the jitter buffer
  1328. * before the playback is started (prefetching effect).
  1329. * Set this to zero to disable this feature.
  1330. *
  1331. * Default: 1
  1332. */
  1333. #ifndef PJMEDIA_STREAM_SOFT_START
  1334. # define PJMEDIA_STREAM_SOFT_START 1
  1335. #endif
  1336. /**
  1337. * Video stream will discard old picture from the jitter buffer as soon as
  1338. * new picture is received, to reduce latency.
  1339. *
  1340. * Default: 0
  1341. */
  1342. #ifndef PJMEDIA_VID_STREAM_SKIP_PACKETS_TO_REDUCE_LATENCY
  1343. # define PJMEDIA_VID_STREAM_SKIP_PACKETS_TO_REDUCE_LATENCY 0
  1344. #endif
  1345. /**
  1346. * Maximum video payload size. Note that this must not be greater than
  1347. * PJMEDIA_MAX_MTU.
  1348. *
  1349. * Default: (PJMEDIA_MAX_MTU - 20 - (128+16)) if SRTP is enabled,
  1350. * otherwise (PJMEDIA_MAX_MTU - 20).
  1351. * Note that (128+16) constant value is taken from libSRTP macro
  1352. * SRTP_MAX_TRAILER_LEN.
  1353. */
  1354. #ifndef PJMEDIA_MAX_VID_PAYLOAD_SIZE
  1355. # if PJMEDIA_HAS_SRTP
  1356. # define PJMEDIA_MAX_VID_PAYLOAD_SIZE (PJMEDIA_MAX_MTU - 20 - (128+16))
  1357. # else
  1358. # define PJMEDIA_MAX_VID_PAYLOAD_SIZE (PJMEDIA_MAX_MTU - 20)
  1359. # endif
  1360. #endif
  1361. /**
  1362. * Specify target value for socket receive buffer size. It will be
  1363. * applied to RTP socket of media transport using setsockopt(). When
  1364. * transport failed to set the specified size, it will try with lower
  1365. * value until the highest possible is successfully set.
  1366. *
  1367. * Setting this to zero will leave the socket receive buffer size to
  1368. * OS default (e.g: usually 8 KB on desktop platforms).
  1369. *
  1370. * Default: 64 KB when video is enabled, otherwise zero (OS default)
  1371. */
  1372. #ifndef PJMEDIA_TRANSPORT_SO_RCVBUF_SIZE
  1373. # if PJMEDIA_HAS_VIDEO
  1374. # define PJMEDIA_TRANSPORT_SO_RCVBUF_SIZE (64*1024)
  1375. # else
  1376. # define PJMEDIA_TRANSPORT_SO_RCVBUF_SIZE 0
  1377. # endif
  1378. #endif
  1379. /**
  1380. * Specify target value for socket send buffer size. It will be
  1381. * applied to RTP socket of media transport using setsockopt(). When
  1382. * transport failed to set the specified size, it will try with lower
  1383. * value until the highest possible is successfully set.
  1384. *
  1385. * Setting this to zero will leave the socket send buffer size to
  1386. * OS default (e.g: usually 8 KB on desktop platforms).
  1387. *
  1388. * Default: 64 KB when video is enabled, otherwise zero (OS default)
  1389. */
  1390. #ifndef PJMEDIA_TRANSPORT_SO_SNDBUF_SIZE
  1391. # if PJMEDIA_HAS_VIDEO
  1392. # define PJMEDIA_TRANSPORT_SO_SNDBUF_SIZE (64*1024)
  1393. # else
  1394. # define PJMEDIA_TRANSPORT_SO_SNDBUF_SIZE 0
  1395. # endif
  1396. #endif
  1397. /**
  1398. * Specify if libyuv is available.
  1399. *
  1400. * Default: 0 (disable)
  1401. */
  1402. #ifndef PJMEDIA_HAS_LIBYUV
  1403. # define PJMEDIA_HAS_LIBYUV 0
  1404. #endif
  1405. /**
  1406. * Specify if dtmf flash in RFC 2833 is available.
  1407. */
  1408. #ifndef PJMEDIA_HAS_DTMF_FLASH
  1409. # define PJMEDIA_HAS_DTMF_FLASH 1
  1410. #endif
  1411. /**
  1412. * Specify the number of keyframe needed to be sent after the stream is
  1413. * created. Setting this to 0 will disable it.
  1414. *
  1415. * Default : 5
  1416. */
  1417. #ifndef PJMEDIA_VID_STREAM_START_KEYFRAME_CNT
  1418. # define PJMEDIA_VID_STREAM_START_KEYFRAME_CNT 5
  1419. #endif
  1420. /**
  1421. * Specify the interval to send keyframe after the stream is created, in msec.
  1422. *
  1423. * Default : 1000
  1424. */
  1425. #ifndef PJMEDIA_VID_STREAM_START_KEYFRAME_INTERVAL_MSEC
  1426. # define PJMEDIA_VID_STREAM_START_KEYFRAME_INTERVAL_MSEC 1000
  1427. #endif
  1428. /**
  1429. * Specify the minimum interval to send video keyframe, in msec.
  1430. *
  1431. * Default : 1000
  1432. */
  1433. #ifndef PJMEDIA_VID_STREAM_MIN_KEYFRAME_INTERVAL_MSEC
  1434. # define PJMEDIA_VID_STREAM_MIN_KEYFRAME_INTERVAL_MSEC 1000
  1435. #endif
  1436. /**
  1437. * Specify minimum delay of video decoding, in milliseconds. Lower value may
  1438. * degrade video quality significantly in a bad network environment (e.g:
  1439. * with persistent late and out-of-order RTP packets). Note that the value
  1440. * must be lower than jitter buffer maximum delay (configurable via
  1441. * pjmedia_stream_info.jb_max or pjsua_media_config.jb_max).
  1442. *
  1443. * Default : 100
  1444. */
  1445. #ifndef PJMEDIA_VID_STREAM_DECODE_MIN_DELAY_MSEC
  1446. # define PJMEDIA_VID_STREAM_DECODE_MIN_DELAY_MSEC 100
  1447. #endif
  1448. /**
  1449. * Perform RTP payload type checking in the video stream. Normally the peer
  1450. * MUST send RTP with payload type as we specified in our SDP. Certain
  1451. * agents may not be able to follow this hence the only way to have
  1452. * communication is to disable this check.
  1453. *
  1454. * Default: PJMEDIA_STREAM_CHECK_RTP_PT (follow audio stream's setting)
  1455. */
  1456. #ifndef PJMEDIA_VID_STREAM_CHECK_RTP_PT
  1457. # define PJMEDIA_VID_STREAM_CHECK_RTP_PT PJMEDIA_STREAM_CHECK_RTP_PT
  1458. #endif
  1459. /**
  1460. * @}
  1461. */
  1462. #endif /* __PJMEDIA_CONFIG_H__ */