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