From 483805f79570115ab95c69698792d238c1719b1b Mon Sep 17 00:00:00 2001 From: Jason Parker Date: Mon, 11 Mar 2013 15:09:56 -0500 Subject: Import pjproject-2.1 --- pjmedia/build/Makefile | 6 +- pjmedia/build/os-auto.mak.in | 11 +- pjmedia/build/pjmedia_codec.vcproj | 12 +- pjmedia/include/pjmedia-audiodev/audiodev.h | 8 +- pjmedia/include/pjmedia-codec.h | 5 +- pjmedia/include/pjmedia-codec/config.h | 48 +- pjmedia/include/pjmedia-codec/config_auto.h.in | 11 +- pjmedia/include/pjmedia-codec/opencore_amr.h | 146 ++++ pjmedia/include/pjmedia-codec/opencore_amrnb.h | 89 -- pjmedia/include/pjmedia-codec/silk.h | 133 +++ pjmedia/include/pjmedia-codec/types.h | 30 +- pjmedia/include/pjmedia-videodev/config.h | 13 +- pjmedia/include/pjmedia/codec.h | 15 +- pjmedia/include/pjmedia/config.h | 34 +- pjmedia/include/pjmedia/sdp.h | 19 +- pjmedia/include/pjmedia/transport.h | 27 +- pjmedia/include/pjmedia/transport_ice.h | 8 +- pjmedia/src/pjmedia-audiodev/alsa_dev.c | 4 +- pjmedia/src/pjmedia-audiodev/bb10_dev.c | 364 ++++++--- pjmedia/src/pjmedia-audiodev/symb_aps_dev.cpp | 58 +- pjmedia/src/pjmedia-audiodev/symb_vas_dev.cpp | 62 +- pjmedia/src/pjmedia-codec/audio_codecs.c | 15 +- pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c | 17 +- pjmedia/src/pjmedia-codec/opencore_amr.c | 1031 ++++++++++++++++++++++++ pjmedia/src/pjmedia-codec/opencore_amrnb.c | 831 ------------------- pjmedia/src/pjmedia-codec/silk.c | 953 ++++++++++++++++++++++ pjmedia/src/pjmedia-videodev/dshow_dev.c | 17 +- pjmedia/src/pjmedia-videodev/sdl_dev.c | 6 +- pjmedia/src/pjmedia-videodev/v4l2_dev.c | 5 +- pjmedia/src/pjmedia/codec.c | 52 +- pjmedia/src/pjmedia/conference.c | 6 +- pjmedia/src/pjmedia/converter.c | 4 +- pjmedia/src/pjmedia/endpoint.c | 10 +- pjmedia/src/pjmedia/g711.c | 7 +- pjmedia/src/pjmedia/jbuf.c | 9 +- pjmedia/src/pjmedia/rtcp.c | 5 +- pjmedia/src/pjmedia/rtp.c | 4 +- pjmedia/src/pjmedia/sdp.c | 14 +- pjmedia/src/pjmedia/sdp_neg.c | 4 +- pjmedia/src/pjmedia/stream.c | 104 ++- pjmedia/src/pjmedia/transport_ice.c | 8 +- pjmedia/src/pjmedia/transport_srtp.c | 69 +- pjmedia/src/pjmedia/transport_udp.c | 8 +- pjmedia/src/pjmedia/types.c | 6 +- pjmedia/src/pjmedia/vid_codec_util.c | 290 ++++--- pjmedia/src/pjmedia/vid_port.c | 13 +- pjmedia/src/pjmedia/vid_stream.c | 21 +- pjmedia/src/pjmedia/vid_stream_info.c | 5 +- pjmedia/src/test/mips_test.c | 45 +- 49 files changed, 3350 insertions(+), 1312 deletions(-) create mode 100644 pjmedia/include/pjmedia-codec/opencore_amr.h delete mode 100644 pjmedia/include/pjmedia-codec/opencore_amrnb.h create mode 100644 pjmedia/include/pjmedia-codec/silk.h create mode 100644 pjmedia/src/pjmedia-codec/opencore_amr.c delete mode 100644 pjmedia/src/pjmedia-codec/opencore_amrnb.c create mode 100644 pjmedia/src/pjmedia-codec/silk.c (limited to 'pjmedia') diff --git a/pjmedia/build/Makefile b/pjmedia/build/Makefile index 2f97296..026d89c 100644 --- a/pjmedia/build/Makefile +++ b/pjmedia/build/Makefile @@ -113,7 +113,7 @@ export PJMEDIA_CODEC_SRCDIR = ../src/pjmedia-codec export PJMEDIA_CODEC_OBJS += audio_codecs.o ffmpeg_vid_codecs.o \ h263_packetizer.o h264_packetizer.o \ $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \ - ipp_codecs.o $(CODEC_OBJS) \ + ipp_codecs.o opencore_amr.o silk.o $(CODEC_OBJS) \ g7221_sdp_match.o amr_sdp_match.o export PJMEDIA_CODEC_CFLAGS += $(_CFLAGS) $(GSM_CFLAGS) $(SPEEX_CFLAGS) \ $(ILBC_CFLAGS) $(IPP_CFLAGS) $(G7221_CFLAGS) @@ -173,7 +173,9 @@ pjmedia-audiodev: pjsdp: $(MAKE) -f $(RULES_MAK) APP=PJSDP app=pjsdp $(PJSDP_LIB) -pjmedia-test: $(PJMEDIA_LIB) +$(PJMEDIA_LIB): pjmedia + +pjmedia-test: $(PJMEDIA_LIB) pjmedia $(MAKE) -f $(RULES_MAK) APP=PJMEDIA_TEST app=pjmedia-test $(PJMEDIA_TEST_EXE) .PHONY: ../lib/pjmedia.ko diff --git a/pjmedia/build/os-auto.mak.in b/pjmedia/build/os-auto.mak.in index 98ecf28..04224e8 100644 --- a/pjmedia/build/os-auto.mak.in +++ b/pjmedia/build/os-auto.mak.in @@ -58,6 +58,7 @@ AC_NO_ILBC_CODEC=@ac_no_ilbc_codec@ AC_NO_G722_CODEC=@ac_no_g722_codec@ AC_NO_G7221_CODEC=@ac_no_g7221_codec@ AC_NO_OPENCORE_AMRNB=@ac_no_opencore_amrnb@ +AC_NO_OPENCORE_AMRWB=@ac_no_opencore_amrwb@ export CODEC_OBJS= @@ -113,7 +114,15 @@ endif ifeq ($(AC_NO_OPENCORE_AMRNB),1) export CFLAGS += -DPJMEDIA_HAS_OPENCORE_AMRNB_CODEC=0 else -export CODEC_OBJS += opencore_amrnb.o +export CODEC_OBJS += opencore_amr.o +endif + +ifeq ($(AC_NO_OPENCORE_AMRWB),1) +export CFLAGS += -DPJMEDIA_HAS_OPENCORE_AMRWB_CODEC=0 +else +ifeq ($(AC_NO_OPENCORE_AMRNB),1) +export CODEC_OBJS += opencore_amr.o +endif endif diff --git a/pjmedia/build/pjmedia_codec.vcproj b/pjmedia/build/pjmedia_codec.vcproj index 158d43d..eddbc8c 100644 --- a/pjmedia/build/pjmedia_codec.vcproj +++ b/pjmedia/build/pjmedia_codec.vcproj @@ -2975,13 +2975,17 @@ + + @@ -3122,7 +3126,7 @@ > + + diff --git a/pjmedia/include/pjmedia-audiodev/audiodev.h b/pjmedia/include/pjmedia-audiodev/audiodev.h index f8edb0d..7e13d14 100644 --- a/pjmedia/include/pjmedia-audiodev/audiodev.h +++ b/pjmedia/include/pjmedia-audiodev/audiodev.h @@ -1,4 +1,4 @@ -/* $Id: audiodev.h 3664 2011-07-19 03:42:28Z nanang $ */ +/* $Id: audiodev.h 4243 2012-08-31 11:42:17Z nanang $ */ /* * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2003-2008 Benny Prijono @@ -424,6 +424,12 @@ typedef struct pjmedia_aud_param */ pj_bool_t cng_enabled; + /** + * Enable/disable VAD. This setting is optional, and will only be used + * if PJMEDIA_AUD_DEV_CAP_VAD is set in the flags. + */ + pj_bool_t vad_enabled; + } pjmedia_aud_param; diff --git a/pjmedia/include/pjmedia-codec.h b/pjmedia/include/pjmedia-codec.h index c666996..c63e46e 100644 --- a/pjmedia/include/pjmedia-codec.h +++ b/pjmedia/include/pjmedia-codec.h @@ -1,4 +1,4 @@ -/* $Id: pjmedia-codec.h 4049 2012-04-13 06:24:23Z ming $ */ +/* $Id: pjmedia-codec.h 4331 2013-01-23 06:18:18Z ming $ */ /* * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2003-2008 Benny Prijono @@ -34,8 +34,9 @@ #include #include #include +#include #include -#include +#include #endif /* __PJMEDIA_CODEC_PJMEDIA_CODEC_H__ */ diff --git a/pjmedia/include/pjmedia-codec/config.h b/pjmedia/include/pjmedia-codec/config.h index 2c71cc9..29350db 100644 --- a/pjmedia/include/pjmedia-codec/config.h +++ b/pjmedia/include/pjmedia-codec/config.h @@ -1,4 +1,4 @@ -/* $Id: config.h 4070 2012-04-23 13:48:10Z bennylp $ */ +/* $Id: config.h 4331 2013-01-23 06:18:18Z ming $ */ /* * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2003-2008 Benny Prijono @@ -322,9 +322,19 @@ # define PJMEDIA_HAS_OPENCORE_AMRNB_CODEC 0 #endif +/** + * Enable OpenCORE AMR-WB codec. + * See https://trac.pjsip.org/repos/ticket/1608 for some info. + * + * Default: 0 + */ +#ifndef PJMEDIA_HAS_OPENCORE_AMRWB_CODEC +# define PJMEDIA_HAS_OPENCORE_AMRWB_CODEC 0 +#endif + /** * Link with libopencore-amrXX via pragma comment on Visual Studio. - * This option only makes sense if PJMEDIA_HAS_OPENCORE_AMRNB_CODEC + * This option only makes sense if PJMEDIA_HAS_OPENCORE_AMRNB/WB_CODEC * is enabled. * * Default: 1 @@ -335,7 +345,7 @@ /** * Link with libopencore-amrXX.a that has been produced with gcc. - * This option only makes sense if PJMEDIA_HAS_OPENCORE_AMRNB_CODEC + * This option only makes sense if PJMEDIA_HAS_OPENCORE_AMRNB/WB_CODEC * and PJMEDIA_AUTO_LINK_OPENCORE_AMR_LIBS are enabled. * * Default: 1 @@ -377,6 +387,38 @@ #endif +/** + * Enable SILK codec. + * + * Default: 0 + */ +#ifndef PJMEDIA_HAS_SILK_CODEC +# define PJMEDIA_HAS_SILK_CODEC 0 +#endif + + +/** + * SILK codec default complexity setting, valid values are 0 (lowest), 1, + * and 2. + * + * Default: 2 + */ +#ifndef PJMEDIA_CODEC_SILK_DEFAULT_COMPLEXITY +# define PJMEDIA_CODEC_SILK_DEFAULT_COMPLEXITY 2 +#endif + +/** + * SILK codec default quality setting, valid values are ranging from + * 0 (lowest) to 10. Please note that pjsua-lib may override this setting + * via its codec quality setting (i.e PJSUA_DEFAULT_CODEC_QUALITY). + * + * Default: 10 + */ +#ifndef PJMEDIA_CODEC_SILK_DEFAULT_QUALITY +# define PJMEDIA_CODEC_SILK_DEFAULT_QUALITY 10 +#endif + + /** * Specify if FFMPEG codecs are available. * diff --git a/pjmedia/include/pjmedia-codec/config_auto.h.in b/pjmedia/include/pjmedia-codec/config_auto.h.in index 887d083..11da110 100644 --- a/pjmedia/include/pjmedia-codec/config_auto.h.in +++ b/pjmedia/include/pjmedia-codec/config_auto.h.in @@ -1,4 +1,4 @@ -/* $Id: config_auto.h.in 3841 2011-10-24 09:28:13Z ming $ */ +/* $Id: config_auto.h.in 4331 2013-01-23 06:18:18Z ming $ */ /* * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2003-2008 Benny Prijono @@ -74,6 +74,15 @@ #undef PJMEDIA_HAS_OPENCORE_AMRNB_CODEC #endif +/* OpenCORE AMR-WB codec */ +#ifndef PJMEDIA_HAS_OPENCORE_AMRWB_CODEC +#undef PJMEDIA_HAS_OPENCORE_AMRWB_CODEC +#endif + +/* SILK codec */ +#ifndef PJMEDIA_HAS_SILK_CODEC +#undef PJMEDIA_HAS_SILK_CODEC +#endif #endif /* __PJMEDIA_CODEC_CONFIG_AUTO_H_ */ diff --git a/pjmedia/include/pjmedia-codec/opencore_amr.h b/pjmedia/include/pjmedia-codec/opencore_amr.h new file mode 100644 index 0000000..3d5049b --- /dev/null +++ b/pjmedia/include/pjmedia-codec/opencore_amr.h @@ -0,0 +1,146 @@ +/* $Id: opencore_amr.h 4335 2013-01-29 08:09:15Z ming $ */ +/* + * Copyright (C) 2011-2013 Teluu Inc. (http://www.teluu.com) + * Copyright (C) 2011 Dan Arrhenius + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __PJMEDIA_CODEC_OPENCORE_AMR_H__ +#define __PJMEDIA_CODEC_OPENCORE_AMR_H__ + +#include + +/** + * @defgroup PJMED_OC_AMR OpenCORE AMR Codec + * @ingroup PJMEDIA_CODEC_CODECS + * @brief AMRCodec wrapper for OpenCORE AMR codec + * @{ + */ + +PJ_BEGIN_DECL + +/** + * Bitmask options to be passed during AMR codec factory initialization. + */ +enum pjmedia_amr_options +{ + PJMEDIA_AMR_NO_NB = 1, /**< Disable narrowband mode. */ + PJMEDIA_AMR_NO_WB = 2, /**< Disable wideband mode. */ +}; + +/** + * Settings. Use #pjmedia_codec_opencore_amrnb/wb_set_config() to + * activate. + */ +typedef struct pjmedia_codec_amr_config +{ + /** + * Control whether to use octent align. + */ + pj_bool_t octet_align; + + /** + * Set the bitrate. + */ + unsigned bitrate; + +} pjmedia_codec_amr_config; + +typedef pjmedia_codec_amr_config pjmedia_codec_amrnb_config; +typedef pjmedia_codec_amr_config pjmedia_codec_amrwb_config; + +/** + * Initialize and register AMR codec factory to pjmedia endpoint. + * + * @param endpt The pjmedia endpoint. + * @param options Bitmask of pjmedia_amr_options (default=0). + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_codec_opencore_amr_init(pjmedia_endpt* endpt, + unsigned options); + +/** + * Initialize and register AMR codec factory using default settings to + * pjmedia endpoint. + * + * @param endpt The pjmedia endpoint. + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) +pjmedia_codec_opencore_amr_init_default(pjmedia_endpt* endpt); + +/** + * Unregister AMR codec factory from pjmedia endpoint and deinitialize + * the OpenCORE codec library. + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_codec_opencore_amr_deinit(void); + +/** + * Initialize and register AMR-NB codec factory to pjmedia endpoint. Calling + * this function will automatically initialize AMR codec factory without + * the wideband mode (i.e. it is equivalent to calling + * #pjmedia_codec_opencore_amr_init() with PJMEDIA_AMR_NO_WB). Application + * should call #pjmedia_codec_opencore_amr_init() instead if wishing to use + * both modes. + * + * @param endpt The pjmedia endpoint. + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_codec_opencore_amrnb_init(pjmedia_endpt* endpt); + +/** + * Unregister AMR-NB codec factory from pjmedia endpoint and deinitialize + * the OpenCORE codec library. + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_codec_opencore_amrnb_deinit(void); + + +/** + * Set AMR-NB parameters. + * + * @param cfg The settings; + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_codec_opencore_amrnb_set_config( + const pjmedia_codec_amrnb_config* cfg); + + +/** + * Set AMR-WB parameters. + * + * @param cfg The settings; + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_codec_opencore_amrwb_set_config( + const pjmedia_codec_amrwb_config* cfg); + +PJ_END_DECL + + +/** + * @} + */ + +#endif /* __PJMEDIA_CODEC_OPENCORE_AMRNB_H__ */ + diff --git a/pjmedia/include/pjmedia-codec/opencore_amrnb.h b/pjmedia/include/pjmedia-codec/opencore_amrnb.h deleted file mode 100644 index aedb460..0000000 --- a/pjmedia/include/pjmedia-codec/opencore_amrnb.h +++ /dev/null @@ -1,89 +0,0 @@ -/* $Id: opencore_amrnb.h 3841 2011-10-24 09:28:13Z ming $ */ -/* - * Copyright (C) 2011 Teluu Inc. (http://www.teluu.com) - * Copyright (C) 2011 Dan Arrhenius - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#ifndef __PJMEDIA_CODEC_OPENCORE_AMRNB_H__ -#define __PJMEDIA_CODEC_OPENCORE_AMRNB_H__ - -#include - -/** - * @defgroup PJMED_OC_AMRNB OpenCORE AMR-NB Codec - * @ingroup PJMEDIA_CODEC_CODECS - * @brief AMRCodec wrapper for OpenCORE AMR-NB codec - * @{ - */ - -PJ_BEGIN_DECL - -/** - * Settings. Use #pjmedia_codec_opencore_amrnb_set_config() to - * activate. - */ -typedef struct pjmedia_codec_amrnb_config -{ - /** - * Control whether to use octent align. - */ - pj_bool_t octet_align; - - /** - * Set the bitrate. - */ - unsigned bitrate; - -} pjmedia_codec_amrnb_config; - - -/** - * Initialize and register AMR-NB codec factory to pjmedia endpoint. - * - * @param endpt The pjmedia endpoint. - * - * @return PJ_SUCCESS on success. - */ -PJ_DECL(pj_status_t) pjmedia_codec_opencore_amrnb_init(pjmedia_endpt* endpt); - -/** - * Unregister AMR-NB codec factory from pjmedia endpoint and deinitialize - * the OpenCORE codec library. - * - * @return PJ_SUCCESS on success. - */ -PJ_DECL(pj_status_t) pjmedia_codec_opencore_amrnb_deinit(void); - - -/** - * Set AMR-NB parameters. - * - * @param cfg The settings; - * - * @return PJ_SUCCESS on success. - */ -PJ_DECL(pj_status_t) pjmedia_codec_opencore_amrnb_set_config( - const pjmedia_codec_amrnb_config* cfg); - -PJ_END_DECL - - -/** - * @} - */ - -#endif /* __PJMEDIA_CODEC_OPENCORE_AMRNB_H__ */ - diff --git a/pjmedia/include/pjmedia-codec/silk.h b/pjmedia/include/pjmedia-codec/silk.h new file mode 100644 index 0000000..810faca --- /dev/null +++ b/pjmedia/include/pjmedia-codec/silk.h @@ -0,0 +1,133 @@ +/* $Id: silk.h 4264 2012-09-24 06:58:16Z nanang $ */ +/* + * Copyright (C) 2012-2012 Teluu Inc. (http://www.teluu.com) + * Contributed by Regis Montoya (aka r3gis - www.r3gis.fr) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __PJMEDIA_CODEC_SILK_H__ +#define __PJMEDIA_CODEC_SILK_H__ + +/** + * @file silk.h + * @brief SILK codec. + */ + +#include + +/** + * @defgroup PJMED_SILK SILK Codec Family + * @ingroup PJMEDIA_CODEC_CODECS + * @brief Implementation of SILK codecs (narrow/medium/wide/superwide-band). + * @{ + * + * This section describes functions to initialize and register SILK codec + * factory to the codec manager. After the codec factory has been registered, + * application can use @ref PJMEDIA_CODEC API to manipulate the codec. + * + * The SILK codec uses multiple bit rates, and supports super wideband + * (24 kHz sampling rate), wideband (16 kHz sampling rate), medium (12kHz + * sampling rate), and narrowband (telephone quality, 8 kHz sampling rate). + * + * By default, the SILK codec factory registers two SILK codecs: + * "SILK/8000" narrowband codec and "SILK/16000" wideband codec. This behavior + * can be changed by specifying #pjmedia_codec_silk_options flags during + * initialization. + * + * + * \section codec_setting Codec Settings + * + * \subsection general_setting General Settings + * + * General codec settings for this codec such as VAD and PLC can be + * manipulated through the setting field in #pjmedia_codec_param. + * Please see the documentation of #pjmedia_codec_param for more info. + * + * \subsection specific_setting Codec Specific Settings + * + * The following settings are applicable for this codec. + * + * \subsubsection quality_vs_complexity Quality vs Complexity + * + * The SILK codec quality versus computational complexity and bandwidth + * requirement can be adjusted by modifying the quality and complexity + * setting, by calling #pjmedia_codec_silk_set_config(). + * + * The default setting of quality is specified in + * #PJMEDIA_CODEC_SILK_DEFAULT_QUALITY. And the default setting of + * complexity is specified in #PJMEDIA_CODEC_SILK_DEFAULT_COMPLEXITY. + */ + +PJ_BEGIN_DECL + +typedef struct pjmedia_codec_silk_setting +{ + pj_bool_t enabled; /**< Enable/disable. */ + int quality; /**< Encoding quality, or use -1 for default + (@see PJMEDIA_CODEC_SILK_DEFAULT_QUALITY). */ + int complexity; /**< Encoding complexity, or use -1 for default + (@see PJMEDIA_CODEC_SILK_DEFAULT_COMPLEXITY)*/ +} pjmedia_codec_silk_setting; + + +/** + * Initialize and register SILK codec factory to pjmedia endpoint. By default, + * only narrowband (8kHz sampling rate) and wideband (16kHz sampling rate) + * will be enabled. Quality and complexity for those sampling rate modes + * will be set to the default values (see #PJMEDIA_CODEC_SILK_DEFAULT_QUALITY + * and #PJMEDIA_CODEC_SILK_DEFAULT_COMPLEXITY), application may modify these + * settings via #pjmedia_codec_silk_set_config(). + * + * @param endpt The pjmedia endpoint. + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_codec_silk_init(pjmedia_endpt *endpt); + + +/** + * Change the configuration setting of the SILK codec for the specified + * clock rate. + * + * @param clock_rate PCM sampling rate, in Hz, valid values are 8000, + * 12000, 16000 and 24000. + * @param opt The setting to be applied for the specified + * clock rate. + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_codec_silk_set_config( + unsigned clock_rate, + const pjmedia_codec_silk_setting *opt); + + +/** + * Unregister SILK codec factory from pjmedia endpoint and deinitialize + * the SILK codec library. + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_codec_silk_deinit(void); + + +PJ_END_DECL + + +/** + * @} + */ + +#endif /* __PJMEDIA_CODEC_SILK_H__ */ + diff --git a/pjmedia/include/pjmedia-codec/types.h b/pjmedia/include/pjmedia-codec/types.h index a18fa30..53e71e1 100644 --- a/pjmedia/include/pjmedia-codec/types.h +++ b/pjmedia/include/pjmedia-codec/types.h @@ -1,4 +1,4 @@ -/* $Id: types.h 3664 2011-07-19 03:42:28Z nanang $ */ +/* $Id: types.h 4264 2012-09-24 06:58:16Z nanang $ */ /* * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2003-2008 Benny Prijono @@ -63,18 +63,10 @@ enum pjmedia_audio_pt PJMEDIA_RTP_PT_SPEEX_NB, /**< Speex narrowband/8KHz */ PJMEDIA_RTP_PT_SPEEX_WB, /**< Speex wideband/16KHz */ PJMEDIA_RTP_PT_SPEEX_UWB, /**< Speex 32KHz */ - PJMEDIA_RTP_PT_L16_8KHZ_MONO, /**< L16 @ 8KHz, mono */ - PJMEDIA_RTP_PT_L16_8KHZ_STEREO, /**< L16 @ 8KHz, stereo */ - //PJMEDIA_RTP_PT_L16_11KHZ_MONO, /**< L16 @ 11KHz, mono */ - //PJMEDIA_RTP_PT_L16_11KHZ_STEREO, /**< L16 @ 11KHz, stereo */ - PJMEDIA_RTP_PT_L16_16KHZ_MONO, /**< L16 @ 16KHz, mono */ - PJMEDIA_RTP_PT_L16_16KHZ_STEREO, /**< L16 @ 16KHz, stereo */ - //PJMEDIA_RTP_PT_L16_22KHZ_MONO, /**< L16 @ 22KHz, mono */ - //PJMEDIA_RTP_PT_L16_22KHZ_STEREO, /**< L16 @ 22KHz, stereo */ - //PJMEDIA_RTP_PT_L16_32KHZ_MONO, /**< L16 @ 32KHz, mono */ - //PJMEDIA_RTP_PT_L16_32KHZ_STEREO, /**< L16 @ 32KHz, stereo */ - //PJMEDIA_RTP_PT_L16_48KHZ_MONO, /**< L16 @ 48KHz, mono */ - //PJMEDIA_RTP_PT_L16_48KHZ_STEREO, /**< L16 @ 48KHz, stereo */ + PJMEDIA_RTP_PT_SILK_NB, /**< SILK narrowband/8KHz */ + PJMEDIA_RTP_PT_SILK_MB, /**< SILK mediumband/12KHz */ + PJMEDIA_RTP_PT_SILK_WB, /**< SILK wideband/16KHz */ + PJMEDIA_RTP_PT_SILK_SWB, /**< SILK 24KHz */ PJMEDIA_RTP_PT_ILBC, /**< iLBC (13.3/15.2Kbps) */ PJMEDIA_RTP_PT_AMR, /**< AMR (4.75 - 12.2Kbps) */ PJMEDIA_RTP_PT_AMRWB, /**< AMRWB (6.6 - 23.85Kbps)*/ @@ -91,6 +83,18 @@ enum pjmedia_audio_pt PJMEDIA_RTP_PT_G7221C_48, /**< G722.1 Annex C (48Kbps)*/ PJMEDIA_RTP_PT_G7221_RSV1, /**< G722.1 reserve */ PJMEDIA_RTP_PT_G7221_RSV2, /**< G722.1 reserve */ + PJMEDIA_RTP_PT_L16_8KHZ_MONO, /**< L16 @ 8KHz, mono */ + PJMEDIA_RTP_PT_L16_8KHZ_STEREO, /**< L16 @ 8KHz, stereo */ + //PJMEDIA_RTP_PT_L16_11KHZ_MONO, /**< L16 @ 11KHz, mono */ + //PJMEDIA_RTP_PT_L16_11KHZ_STEREO, /**< L16 @ 11KHz, stereo */ + PJMEDIA_RTP_PT_L16_16KHZ_MONO, /**< L16 @ 16KHz, mono */ + PJMEDIA_RTP_PT_L16_16KHZ_STEREO, /**< L16 @ 16KHz, stereo */ + //PJMEDIA_RTP_PT_L16_22KHZ_MONO, /**< L16 @ 22KHz, mono */ + //PJMEDIA_RTP_PT_L16_22KHZ_STEREO, /**< L16 @ 22KHz, stereo */ + //PJMEDIA_RTP_PT_L16_32KHZ_MONO, /**< L16 @ 32KHz, mono */ + //PJMEDIA_RTP_PT_L16_32KHZ_STEREO, /**< L16 @ 32KHz, stereo */ + //PJMEDIA_RTP_PT_L16_48KHZ_MONO, /**< L16 @ 48KHz, mono */ + //PJMEDIA_RTP_PT_L16_48KHZ_STEREO, /**< L16 @ 48KHz, stereo */ /* Caution! * Ensure the value of the last pt above is <= 127. diff --git a/pjmedia/include/pjmedia-videodev/config.h b/pjmedia/include/pjmedia-videodev/config.h index 12a251a..ef161eb 100644 --- a/pjmedia/include/pjmedia-videodev/config.h +++ b/pjmedia/include/pjmedia-videodev/config.h @@ -1,4 +1,4 @@ -/* $Id: config.h 4016 2012-04-04 05:05:50Z bennylp $ */ +/* $Id: config.h 4414 2013-03-05 08:21:02Z riza $ */ /* * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) * @@ -132,6 +132,17 @@ PJ_BEGIN_DECL # define PJMEDIA_VIDEO_DEV_HAS_AVI 1 #endif +/** + * Specify the SDL library name to be linked with Visual Studio project. + * By default, the name is autodetected based on SDL version ("sdl.lib" or + * "sdl2.lib"), but application may explicitly specify the library name if this + * autodetection fails. Common names are: "sdl2.lib" or "sdl.lib". + * + * Default: undeclared. + */ +#ifndef PJMEDIA_SDL_LIB +# undef PJMEDIA_SDL_LIB +#endif /** * @} diff --git a/pjmedia/include/pjmedia/codec.h b/pjmedia/include/pjmedia/codec.h index 62c79e0..58fa7a1 100644 --- a/pjmedia/include/pjmedia/codec.h +++ b/pjmedia/include/pjmedia/codec.h @@ -1,4 +1,4 @@ -/* $Id: codec.h 3664 2011-07-19 03:42:28Z nanang $ */ +/* $Id: codec.h 4278 2012-10-05 10:04:54Z ming $ */ /* * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2003-2008 Benny Prijono @@ -276,6 +276,7 @@ typedef struct pjmedia_codec_param unsigned channel_cnt; /**< Channel count. */ pj_uint32_t avg_bps; /**< Average bandwidth in bits/sec */ pj_uint32_t max_bps; /**< Maximum bandwidth in bits/sec */ + unsigned max_rx_frame_size; /**< Maximum frame size */ pj_uint16_t frm_ptime; /**< Decoder frame ptime in msec. */ pj_uint16_t enc_ptime; /**< Encoder ptime, or zero if it's equal to decoder ptime. */ @@ -308,6 +309,18 @@ typedef struct pjmedia_codec_param } pjmedia_codec_param; +/** + * Duplicate codec parameter. + * + * @param pool The pool. + * @param src The codec parameter to be duplicated. + * + * @return Duplicated codec parameter. + */ +PJ_DECL(pjmedia_codec_param*) pjmedia_codec_param_clone( + pj_pool_t *pool, + const pjmedia_codec_param *src); + /* * Forward declaration for pjmedia_codec. diff --git a/pjmedia/include/pjmedia/config.h b/pjmedia/include/pjmedia/config.h index d5a598f..b229eca 100644 --- a/pjmedia/include/pjmedia/config.h +++ b/pjmedia/include/pjmedia/config.h @@ -1,4 +1,4 @@ -/* $Id: config.h 4130 2012-05-17 08:35:51Z nanang $ */ +/* $Id: config.h 4240 2012-08-31 09:03:36Z ming $ */ /* * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2003-2008 Benny Prijono @@ -371,13 +371,21 @@ /** - * Max packet size to support. + * Max packet size for transmitting direction. */ #ifndef PJMEDIA_MAX_MTU # define PJMEDIA_MAX_MTU 1500 #endif +/** + * Max packet size for receiving direction. + */ +#ifndef PJMEDIA_MAX_MRU +# define PJMEDIA_MAX_MRU 2000 +#endif + + /** * DTMF/telephone-event duration, in timestamp. */ @@ -676,6 +684,28 @@ #endif +/** + * This macro controls whether pjmedia should include SDP + * bandwidth modifier "TIAS" (RFC3890). + * + * Note that there is also a run-time variable to turn this setting + * on or off, defined in endpoint.c. To access this variable, use + * the following construct + * + \verbatim + extern pj_bool_t pjmedia_add_bandwidth_tias_in_sdp; + + // Do not enable bandwidth information inclusion in sdp + pjmedia_add_bandwidth_tias_in_sdp = PJ_FALSE; + \endverbatim + * + * Default: 1 (yes) + */ +#ifndef PJMEDIA_ADD_BANDWIDTH_TIAS_IN_SDP +# define PJMEDIA_ADD_BANDWIDTH_TIAS_IN_SDP 1 +#endif + + /** * This macro controls whether pjmedia should include SDP rtpmap * attribute for static payload types. SDP rtpmap for static diff --git a/pjmedia/include/pjmedia/sdp.h b/pjmedia/include/pjmedia/sdp.h index 2dc58d6..bababef 100644 --- a/pjmedia/include/pjmedia/sdp.h +++ b/pjmedia/include/pjmedia/sdp.h @@ -1,4 +1,4 @@ -/* $Id: sdp.h 3945 2012-01-27 09:12:59Z nanang $ */ +/* $Id: sdp.h 4367 2013-02-21 20:49:19Z nanang $ */ /* * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2003-2008 Benny Prijono @@ -685,6 +685,23 @@ PJ_DECL(int) pjmedia_sdp_print( const pjmedia_sdp_session *sdp, PJ_DECL(pj_status_t) pjmedia_sdp_validate(const pjmedia_sdp_session *sdp); +/** + * Perform semantic validation for the specified SDP session descriptor. + * This function perform validation beyond just syntactic verification, + * such as to verify the value of network type and address type, check + * the connection line, and verify that \a rtpmap attribute is present + * when dynamic payload type is used. + * + * @param sdp The SDP session descriptor to validate. + * @param strict Flag whether the check should be strict, i.e: allow + * media without connection line when port is zero. + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_sdp_validate2(const pjmedia_sdp_session *sdp, + pj_bool_t strict); + + /** * Clone SDP session descriptor. * diff --git a/pjmedia/include/pjmedia/transport.h b/pjmedia/include/pjmedia/transport.h index dca9f29..e86c974 100644 --- a/pjmedia/include/pjmedia/transport.h +++ b/pjmedia/include/pjmedia/transport.h @@ -1,4 +1,4 @@ -/* $Id: transport.h 3664 2011-07-19 03:42:28Z nanang $ */ +/* $Id: transport.h 4345 2013-02-13 07:43:32Z nanang $ */ /* * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2003-2008 Benny Prijono @@ -566,7 +566,7 @@ PJ_INLINE(void) pjmedia_transport_info_init(pjmedia_transport_info *info) * for example to fill in the "c=" and "m=" line of local SDP. * * @param tp The transport. - * @param info Media socket info to be initialized. + * @param info Media transport info to be initialized. * * @return PJ_SUCCESS on success. */ @@ -580,6 +580,29 @@ PJ_INLINE(pj_status_t) pjmedia_transport_get_info(pjmedia_transport *tp, } +/** + * Utility API to get transport type specific info from the specified media + * transport info. + * + * @param info Media transport info. + * @param type Media transport type. + * + * @return Pointer to media transport specific info, or NULL if + * specific info for the transport type is not found. + */ +PJ_INLINE(void*) pjmedia_transport_info_get_spc_info( + pjmedia_transport_info *info, + pjmedia_transport_type type) +{ + unsigned i; + for (i = 0; i < info->specific_info_cnt; ++i) { + if (info->spc_info[i].type == type) + return (void*)info->spc_info[i].buffer; + } + return NULL; +} + + /** * Attach callbacks to be called on receipt of incoming RTP/RTCP packets. * This is just a simple wrapper which calls attach() member of diff --git a/pjmedia/include/pjmedia/transport_ice.h b/pjmedia/include/pjmedia/transport_ice.h index 4500fae..417ee6d 100644 --- a/pjmedia/include/pjmedia/transport_ice.h +++ b/pjmedia/include/pjmedia/transport_ice.h @@ -1,4 +1,4 @@ -/* $Id: transport_ice.h 3872 2011-10-28 04:27:41Z bennylp $ */ +/* $Id: transport_ice.h 4350 2013-02-15 03:57:31Z nanang $ */ /* * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2003-2008 Benny Prijono @@ -68,6 +68,12 @@ typedef struct pjmedia_ice_cb */ typedef struct pjmedia_ice_transport_info { + /** + * Specifies whether ICE is used, i.e. SDP offer and answer indicates + * that both parties support ICE and ICE should be used for the session. + */ + pj_bool_t active; + /** * ICE sesion state. */ diff --git a/pjmedia/src/pjmedia-audiodev/alsa_dev.c b/pjmedia/src/pjmedia-audiodev/alsa_dev.c index 72b995e..31b3b06 100644 --- a/pjmedia/src/pjmedia-audiodev/alsa_dev.c +++ b/pjmedia/src/pjmedia-audiodev/alsa_dev.c @@ -1,4 +1,4 @@ -/* $Id: alsa_dev.c 4130 2012-05-17 08:35:51Z nanang $ */ +/* $Id: alsa_dev.c 4283 2012-10-12 06:19:32Z ming $ */ /* * Copyright (C) 2009-2011 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2007-2009 Keystream AB and Konftel AB, All rights reserved. @@ -232,7 +232,7 @@ static pj_status_t add_dev (struct alsa_factory *af, const char *dev_name) pj_bzero(adi, sizeof(*adi)); /* Set device name */ - strcpy(adi->name, dev_name); + strncpy(adi->name, dev_name, sizeof(adi->name)); /* Check the number of playback channels */ adi->output_count = (pb_result>=0) ? 1 : 0; diff --git a/pjmedia/src/pjmedia-audiodev/bb10_dev.c b/pjmedia/src/pjmedia-audiodev/bb10_dev.c index 418256d..f920080 100644 --- a/pjmedia/src/pjmedia-audiodev/bb10_dev.c +++ b/pjmedia/src/pjmedia-audiodev/bb10_dev.c @@ -1,4 +1,4 @@ -/* $Id: bb10_dev.c 4151 2012-06-01 04:49:57Z ming $ */ +/* $Id: bb10_dev.c 4340 2013-02-05 05:15:01Z bennylp $ */ /* * Copyright (C) 2008-2012 Teluu Inc. (http://www.teluu.com) * @@ -33,6 +33,11 @@ #if defined(PJMEDIA_AUDIO_DEV_HAS_BB10) && PJMEDIA_AUDIO_DEV_HAS_BB10 != 0 +#ifndef PJ_BBSDK_VER + /* Format: 0xMMNNRR: MM: major, NN: minor, RR: revision */ +# define PJ_BBSDK_VER 0x100006 +#endif + #include #include #include @@ -40,6 +45,9 @@ #include #include #include +#if PJ_BBSDK_VER >= 0x100006 +#include