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