blob: 9eec63e8212b3451e0fa2c08f512d8d7af608a5c [file] [log] [blame]
Alexandre Lision8af73cb2013-12-10 14:11:20 -05001/* $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 * 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
685/**
686 * This specifies the maximum number of the customized SDP format
687 * negotiation callbacks.
688 */
689#ifndef PJMEDIA_SDP_NEG_MAX_CUSTOM_FMT_NEG_CB
690# define PJMEDIA_SDP_NEG_MAX_CUSTOM_FMT_NEG_CB 8
691#endif
692
693
694/**
695 * This specifies if the SDP negotiator should rewrite answer payload
696 * type numbers to use the same payload type numbers as the remote offer
697 * for all matched codecs.
698 *
699 * Default is 1 (yes)
700 */
701#ifndef PJMEDIA_SDP_NEG_ANSWER_SYMMETRIC_PT
702# define PJMEDIA_SDP_NEG_ANSWER_SYMMETRIC_PT 1
703#endif
704
705
706/**
707 * Support for sending and decoding RTCP port in SDP (RFC 3605).
708 * Default is equal to PJMEDIA_ADVERTISE_RTCP setting.
709 */
710#ifndef PJMEDIA_HAS_RTCP_IN_SDP
711# define PJMEDIA_HAS_RTCP_IN_SDP (PJMEDIA_ADVERTISE_RTCP)
712#endif
713
714
715/**
716 * This macro controls whether pjmedia should include SDP
717 * bandwidth modifier "TIAS" (RFC3890).
718 *
719 * Note that there is also a run-time variable to turn this setting
720 * on or off, defined in endpoint.c. To access this variable, use
721 * the following construct
722 *
723 \verbatim
724 extern pj_bool_t pjmedia_add_bandwidth_tias_in_sdp;
725
726 // Do not enable bandwidth information inclusion in sdp
727 pjmedia_add_bandwidth_tias_in_sdp = PJ_FALSE;
728 \endverbatim
729 *
730 * Default: 1 (yes)
731 */
732#ifndef PJMEDIA_ADD_BANDWIDTH_TIAS_IN_SDP
733# define PJMEDIA_ADD_BANDWIDTH_TIAS_IN_SDP 1
734#endif
735
736
737/**
738 * This macro controls whether pjmedia should include SDP rtpmap
739 * attribute for static payload types. SDP rtpmap for static
740 * payload types are optional, although they are normally included
741 * for interoperability reason.
742 *
743 * Note that there is also a run-time variable to turn this setting
744 * on or off, defined in endpoint.c. To access this variable, use
745 * the following construct
746 *
747 \verbatim
748 extern pj_bool_t pjmedia_add_rtpmap_for_static_pt;
749
750 // Do not include rtpmap for static payload types (<96)
751 pjmedia_add_rtpmap_for_static_pt = PJ_FALSE;
752 \endverbatim
753 *
754 * Default: 1 (yes)
755 */
756#ifndef PJMEDIA_ADD_RTPMAP_FOR_STATIC_PT
757# define PJMEDIA_ADD_RTPMAP_FOR_STATIC_PT 1
758#endif
759
760
761/**
762 * This macro declares the payload type for telephone-event
763 * that is advertised by PJMEDIA for outgoing SDP. If this macro
764 * is set to zero, telephone events would not be advertised nor
765 * supported.
766 *
767 * If this value is changed to other number, please update the
768 * PJMEDIA_RTP_PT_TELEPHONE_EVENTS_STR too.
769 */
770#ifndef PJMEDIA_RTP_PT_TELEPHONE_EVENTS
771# define PJMEDIA_RTP_PT_TELEPHONE_EVENTS 96
772#endif
773
774
775/**
776 * Macro to get the string representation of the telephone-event
777 * payload type.
778 */
779#ifndef PJMEDIA_RTP_PT_TELEPHONE_EVENTS_STR
780# define PJMEDIA_RTP_PT_TELEPHONE_EVENTS_STR "96"
781#endif
782
783
784/**
785 * Maximum tones/digits that can be enqueued in the tone generator.
786 */
787#ifndef PJMEDIA_TONEGEN_MAX_DIGITS
788# define PJMEDIA_TONEGEN_MAX_DIGITS 32
789#endif
790
791
792/*
793 * Below specifies the various tone generator backend algorithm.
794 */
795
796/**
797 * The math's sine(), floating point. This has very good precision
798 * but it's the slowest and requires floating point support and
799 * linking with the math library.
800 */
801#define PJMEDIA_TONEGEN_SINE 1
802
803/**
804 * Floating point approximation of sine(). This has relatively good
805 * precision and much faster than plain sine(), but it requires floating-
806 * point support and linking with the math library.
807 */
808#define PJMEDIA_TONEGEN_FLOATING_POINT 2
809
810/**
811 * Fixed point using sine signal generated by Cordic algorithm. This
812 * algorithm can be tuned to provide balance between precision and
813 * performance by tuning the PJMEDIA_TONEGEN_FIXED_POINT_CORDIC_LOOP
814 * setting, and may be suitable for platforms that lack floating-point
815 * support.
816 */
817#define PJMEDIA_TONEGEN_FIXED_POINT_CORDIC 3
818
819/**
820 * Fast fixed point using some approximation to generate sine waves.
821 * The tone generated by this algorithm is not very precise, however
822 * the algorithm is very fast.
823 */
824#define PJMEDIA_TONEGEN_FAST_FIXED_POINT 4
825
826
827/**
828 * Specify the tone generator algorithm to be used. Please see
829 * http://trac.pjsip.org/repos/wiki/Tone_Generator for the performance
830 * analysis results of the various tone generator algorithms.
831 *
832 * Default value:
833 * - PJMEDIA_TONEGEN_FLOATING_POINT when PJ_HAS_FLOATING_POINT is set
834 * - PJMEDIA_TONEGEN_FIXED_POINT_CORDIC when PJ_HAS_FLOATING_POINT is not set
835 */
836#ifndef PJMEDIA_TONEGEN_ALG
837# if defined(PJ_HAS_FLOATING_POINT) && PJ_HAS_FLOATING_POINT
838# define PJMEDIA_TONEGEN_ALG PJMEDIA_TONEGEN_FLOATING_POINT
839# else
840# define PJMEDIA_TONEGEN_ALG PJMEDIA_TONEGEN_FIXED_POINT_CORDIC
841# endif
842#endif
843
844
845/**
846 * Specify the number of calculation loops to generate the tone, when
847 * PJMEDIA_TONEGEN_FIXED_POINT_CORDIC algorithm is used. With more calculation
848 * loops, the tone signal gets more precise, but this will add more
849 * processing.
850 *
851 * Valid values are 1 to 28.
852 *
853 * Default value: 10
854 */
855#ifndef PJMEDIA_TONEGEN_FIXED_POINT_CORDIC_LOOP
856# define PJMEDIA_TONEGEN_FIXED_POINT_CORDIC_LOOP 10
857#endif
858
859
860/**
861 * Enable high quality of tone generation, the better quality will cost
862 * more CPU load. This is only applied to floating point enabled machines.
863 *
864 * By default it is enabled when PJ_HAS_FLOATING_POINT is set.
865 *
866 * This macro has been deprecated in version 1.0-rc3.
867 */
868#ifdef PJMEDIA_USE_HIGH_QUALITY_TONEGEN
869# error "The PJMEDIA_USE_HIGH_QUALITY_TONEGEN macro is obsolete"
870#endif
871
872
873/**
874 * Fade-in duration for the tone, in milliseconds. Set to zero to disable
875 * this feature.
876 *
877 * Default: 1 (msec)
878 */
879#ifndef PJMEDIA_TONEGEN_FADE_IN_TIME
880# define PJMEDIA_TONEGEN_FADE_IN_TIME 1
881#endif
882
883
884/**
885 * Fade-out duration for the tone, in milliseconds. Set to zero to disable
886 * this feature.
887 *
888 * Default: 2 (msec)
889 */
890#ifndef PJMEDIA_TONEGEN_FADE_OUT_TIME
891# define PJMEDIA_TONEGEN_FADE_OUT_TIME 2
892#endif
893
894
895/**
896 * The default tone generator amplitude (1-32767).
897 *
898 * Default value: 12288
899 */
900#ifndef PJMEDIA_TONEGEN_VOLUME
901# define PJMEDIA_TONEGEN_VOLUME 12288
902#endif
903
904
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
916/**
917 * Enable support to handle codecs with inconsistent clock rate
918 * between clock rate in SDP/RTP & the clock rate that is actually used.
919 * This happens for example with G.722 and MPEG audio codecs.
920 * See:
921 * - G.722 : RFC 3551 4.5.2
922 * - MPEG audio : RFC 3551 4.5.13 & RFC 3119
923 *
924 * Also when this feature is enabled, some handling will be performed
925 * to deal with clock rate incompatibilities of some phones.
926 *
927 * By default it is enabled.
928 */
929#ifndef PJMEDIA_HANDLE_G722_MPEG_BUG
930# define PJMEDIA_HANDLE_G722_MPEG_BUG 1
931#endif
932
933
934/**
935 * Transport info (pjmedia_transport_info) contains a socket info and list
936 * of transport specific info, since transports can be chained together
937 * (for example, SRTP transport uses UDP transport as the underlying
938 * transport). This constant specifies maximum number of transport specific
939 * infos that can be held in a transport info.
940 */
941#ifndef PJMEDIA_TRANSPORT_SPECIFIC_INFO_MAXCNT
942# define PJMEDIA_TRANSPORT_SPECIFIC_INFO_MAXCNT 4
943#endif
944
945
946/**
947 * Maximum size in bytes of storage buffer of a transport specific info.
948 */
949#ifndef PJMEDIA_TRANSPORT_SPECIFIC_INFO_MAXSIZE
950# define PJMEDIA_TRANSPORT_SPECIFIC_INFO_MAXSIZE (36*sizeof(long))
951#endif
952
953
954/**
955 * Value to be specified in PJMEDIA_STREAM_ENABLE_KA setting.
956 * This indicates that an empty RTP packet should be used as
957 * the keep-alive packet.
958 */
959#define PJMEDIA_STREAM_KA_EMPTY_RTP 1
960
961/**
962 * Value to be specified in PJMEDIA_STREAM_ENABLE_KA setting.
963 * This indicates that a user defined packet should be used
964 * as the keep-alive packet. The content of the user-defined
965 * packet is specified by PJMEDIA_STREAM_KA_USER_PKT. Default
966 * content is a CR-LF packet.
967 */
968#define PJMEDIA_STREAM_KA_USER 2
969
970/**
971 * The content of the user defined keep-alive packet. The format
972 * of the packet is initializer to pj_str_t structure. Note that
973 * the content may contain NULL character.
974 */
975#ifndef PJMEDIA_STREAM_KA_USER_PKT
976# define PJMEDIA_STREAM_KA_USER_PKT { "\r\n", 2 }
977#endif
978
979/**
980 * Specify another type of keep-alive and NAT hole punching
981 * mechanism (the other type is PJMEDIA_STREAM_VAD_SUSPEND_MSEC
982 * and PJMEDIA_CODEC_MAX_SILENCE_PERIOD) to be used by stream.
983 * When this feature is enabled, the stream will initially
984 * transmit one packet to punch a hole in NAT, and periodically
985 * transmit keep-alive packets.
986 *
987 * When this alternative keep-alive mechanism is used, application
988 * may disable the other keep-alive mechanisms, i.e: by setting
989 * PJMEDIA_STREAM_VAD_SUSPEND_MSEC to zero and
990 * PJMEDIA_CODEC_MAX_SILENCE_PERIOD to -1.
991 *
992 * The value of this macro specifies the type of packet used
993 * for the keep-alive mechanism. Valid values are
994 * PJMEDIA_STREAM_KA_EMPTY_RTP and PJMEDIA_STREAM_KA_USER.
995 *
996 * The duration of the keep-alive interval further can be set
997 * with PJMEDIA_STREAM_KA_INTERVAL setting.
998 *
999 * Default: 0 (disabled)
1000 */
1001#ifndef PJMEDIA_STREAM_ENABLE_KA
1002# define PJMEDIA_STREAM_ENABLE_KA 0
1003#endif
1004
1005
1006/**
1007 * Specify the keep-alive interval of PJMEDIA_STREAM_ENABLE_KA
1008 * mechanism, in seconds.
1009 *
1010 * Default: 5 seconds
1011 */
1012#ifndef PJMEDIA_STREAM_KA_INTERVAL
1013# define PJMEDIA_STREAM_KA_INTERVAL 5
1014#endif
1015
1016
1017/*
1018 * .... new stuffs ...
1019 */
1020
1021/*
1022 * Video
1023 */
1024
1025/**
1026 * Top level option to enable/disable video features.
1027 *
1028 * Default: 0 (disabled)
1029 */
1030#ifndef PJMEDIA_HAS_VIDEO
1031# define PJMEDIA_HAS_VIDEO 0
1032#endif
1033
1034
1035/**
1036 * Specify if FFMPEG is available. The value here will be used as the default
1037 * value for other FFMPEG settings below.
1038 *
1039 * Default: 0
1040 */
1041#ifndef PJMEDIA_HAS_FFMPEG
1042# define PJMEDIA_HAS_FFMPEG 0
1043#endif
1044
1045/**
1046 * Specify if FFMPEG libavformat is available.
1047 *
1048 * Default: PJMEDIA_HAS_FFMPEG (or detected by configure)
1049 */
1050#ifndef PJMEDIA_HAS_LIBAVFORMAT
1051# define PJMEDIA_HAS_LIBAVFORMAT PJMEDIA_HAS_FFMPEG
1052#endif
1053
1054/**
1055 * Specify if FFMPEG libavformat is available.
1056 *
1057 * Default: PJMEDIA_HAS_FFMPEG (or detected by configure)
1058 */
1059#ifndef PJMEDIA_HAS_LIBAVCODEC
1060# define PJMEDIA_HAS_LIBAVCODEC PJMEDIA_HAS_FFMPEG
1061#endif
1062
1063/**
1064 * Specify if FFMPEG libavutil is available.
1065 *
1066 * Default: PJMEDIA_HAS_FFMPEG (or detected by configure)
1067 */
1068#ifndef PJMEDIA_HAS_LIBAVUTIL
1069# define PJMEDIA_HAS_LIBAVUTIL PJMEDIA_HAS_FFMPEG
1070#endif
1071
1072/**
1073 * Specify if FFMPEG libswscale is available.
1074 *
1075 * Default: PJMEDIA_HAS_FFMPEG (or detected by configure)
1076 */
1077#ifndef PJMEDIA_HAS_LIBSWSCALE
1078# define PJMEDIA_HAS_LIBSWSCALE PJMEDIA_HAS_FFMPEG
1079#endif
1080
1081/**
1082 * Specify if FFMPEG libavdevice is available.
1083 *
1084 * Default: PJMEDIA_HAS_FFMPEG (or detected by configure)
1085 */
1086#ifndef PJMEDIA_HAS_LIBAVDEVICE
1087# define PJMEDIA_HAS_LIBAVDEVICE PJMEDIA_HAS_FFMPEG
1088#endif
1089
1090/**
1091 * Specify if FFMPEG libavcore is available.
1092 *
1093 * Default: PJMEDIA_HAS_FFMPEG (or detected by configure)
1094 */
1095#ifndef PJMEDIA_HAS_LIBAVCORE
1096# define PJMEDIA_HAS_LIBAVCORE PJMEDIA_HAS_FFMPEG
1097#endif
1098
1099/**
1100 * Maximum video planes.
1101 *
1102 * Default: 4
1103 */
1104#ifndef PJMEDIA_MAX_VIDEO_PLANES
1105# define PJMEDIA_MAX_VIDEO_PLANES 4
1106#endif
1107
1108/**
1109 * Maximum number of video formats.
1110 *
1111 * Default: 32
1112 */
1113#ifndef PJMEDIA_MAX_VIDEO_FORMATS
1114# define PJMEDIA_MAX_VIDEO_FORMATS 32
1115#endif
1116
1117/**
1118 * Specify the maximum time difference (in ms) for synchronization between
1119 * two medias. If the synchronization media source is ahead of time
1120 * greater than this duration, it is considered to make a very large jump
1121 * and the synchronization will be reset.
1122 *
1123 * Default: 20000
1124 */
1125#ifndef PJMEDIA_CLOCK_SYNC_MAX_SYNC_MSEC
1126# define PJMEDIA_CLOCK_SYNC_MAX_SYNC_MSEC 20000
1127#endif
1128
1129/**
1130 * Maximum video frame size.
1131 * Default: 128kB
1132 */
1133#ifndef PJMEDIA_MAX_VIDEO_ENC_FRAME_SIZE
1134# define PJMEDIA_MAX_VIDEO_ENC_FRAME_SIZE (1<<17)
1135#endif
1136
1137
1138/**
1139 * Specify the maximum duration (in ms) for resynchronization. When a media
1140 * is late to another media it is supposed to be synchronized to, it is
1141 * guaranteed to be synchronized again after this duration. While if the
1142 * media is ahead/early by t ms, it is guaranteed to be synchronized after
1143 * t + this duration. This timing only applies if there is no additional
1144 * resynchronization required during the specified duration.
1145 *
1146 * Default: 2000
1147 */
1148#ifndef PJMEDIA_CLOCK_SYNC_MAX_RESYNC_DURATION
1149# define PJMEDIA_CLOCK_SYNC_MAX_RESYNC_DURATION 2000
1150#endif
1151
1152
1153/**
1154 * Minimum gap between two consecutive discards in jitter buffer,
1155 * in milliseconds.
1156 *
1157 * Default: 200 ms
1158 */
1159#ifndef PJMEDIA_JBUF_DISC_MIN_GAP
1160# define PJMEDIA_JBUF_DISC_MIN_GAP 200
1161#endif
1162
1163
1164/**
1165 * Minimum burst level reference used for calculating discard duration
1166 * in jitter buffer progressive discard algorithm, in frames.
1167 *
1168 * Default: 1 frame
1169 */
1170#ifndef PJMEDIA_JBUF_PRO_DISC_MIN_BURST
1171# define PJMEDIA_JBUF_PRO_DISC_MIN_BURST 1
1172#endif
1173
1174
1175/**
1176 * Maximum burst level reference used for calculating discard duration
1177 * in jitter buffer progressive discard algorithm, in frames.
1178 *
1179 * Default: 200 frames
1180 */
1181#ifndef PJMEDIA_JBUF_PRO_DISC_MAX_BURST
1182# define PJMEDIA_JBUF_PRO_DISC_MAX_BURST 100
1183#endif
1184
1185
1186/**
1187 * Duration for progressive discard algotithm in jitter buffer to discard
1188 * an excessive frame when burst is equal to or lower than
1189 * PJMEDIA_JBUF_PRO_DISC_MIN_BURST, in milliseconds.
1190 *
1191 * Default: 2000 ms
1192 */
1193#ifndef PJMEDIA_JBUF_PRO_DISC_T1
1194# define PJMEDIA_JBUF_PRO_DISC_T1 2000
1195#endif
1196
1197
1198/**
1199 * Duration for progressive discard algotithm in jitter buffer to discard
1200 * an excessive frame when burst is equal to or greater than
1201 * PJMEDIA_JBUF_PRO_DISC_MAX_BURST, in milliseconds.
1202 *
1203 * Default: 10000 ms
1204 */
1205#ifndef PJMEDIA_JBUF_PRO_DISC_T2
1206# define PJMEDIA_JBUF_PRO_DISC_T2 10000
1207#endif
1208
1209
1210/**
1211 * Video stream will discard old picture from the jitter buffer as soon as
1212 * new picture is received, to reduce latency.
1213 *
1214 * Default: 0
1215 */
1216#ifndef PJMEDIA_VID_STREAM_SKIP_PACKETS_TO_REDUCE_LATENCY
1217# define PJMEDIA_VID_STREAM_SKIP_PACKETS_TO_REDUCE_LATENCY 0
1218#endif
1219
1220
1221/**
1222 * Maximum video payload size. Note that this must not be greater than
1223 * PJMEDIA_MAX_MTU.
1224 *
1225 * Default: (PJMEDIA_MAX_MTU - 100)
1226 */
1227#ifndef PJMEDIA_MAX_VID_PAYLOAD_SIZE
1228# define PJMEDIA_MAX_VID_PAYLOAD_SIZE (PJMEDIA_MAX_MTU - 100)
1229#endif
1230
1231
1232/**
1233 * Specify target value for socket receive buffer size. It will be
1234 * applied to RTP socket of media transport using setsockopt(). When
1235 * transport failed to set the specified size, it will try with lower
1236 * value until the highest possible is successfully set.
1237 *
1238 * Setting this to zero will leave the socket receive buffer size to
1239 * OS default (e.g: usually 8 KB on desktop platforms).
1240 *
1241 * Default: 64 KB when video is enabled, otherwise zero (OS default)
1242 */
1243#ifndef PJMEDIA_TRANSPORT_SO_RCVBUF_SIZE
1244# if PJMEDIA_HAS_VIDEO
1245# define PJMEDIA_TRANSPORT_SO_RCVBUF_SIZE (64*1024)
1246# else
1247# define PJMEDIA_TRANSPORT_SO_RCVBUF_SIZE 0
1248# endif
1249#endif
1250
1251
1252/**
1253 * Specify target value for socket send buffer size. It will be
1254 * applied to RTP socket of media transport using setsockopt(). When
1255 * transport failed to set the specified size, it will try with lower
1256 * value until the highest possible is successfully set.
1257 *
1258 * Setting this to zero will leave the socket send buffer size to
1259 * OS default (e.g: usually 8 KB on desktop platforms).
1260 *
1261 * Default: 64 KB when video is enabled, otherwise zero (OS default)
1262 */
1263#ifndef PJMEDIA_TRANSPORT_SO_SNDBUF_SIZE
1264# if PJMEDIA_HAS_VIDEO
1265# define PJMEDIA_TRANSPORT_SO_SNDBUF_SIZE (64*1024)
1266# else
1267# define PJMEDIA_TRANSPORT_SO_SNDBUF_SIZE 0
1268# endif
1269#endif
1270
1271
1272/**
1273 * @}
1274 */
1275
1276
1277#endif /* __PJMEDIA_CONFIG_H__ */
1278
1279