diff options
author | Benny Prijono <bennylp@teluu.com> | 2006-04-28 14:48:02 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2006-04-28 14:48:02 +0000 |
commit | eae40f4fafeba6da36c80dc58a1472cff4affdad (patch) | |
tree | b2e0e376d3a43b2fa100fb4d162f5310c73acd5f /pjmedia/include | |
parent | 74e48f1aa4f7620cd85b5f6180d1a1485f092e6e (diff) |
Added Packet Lost Concealment (PLC) framework, with two backend algorithms (simple replay and G.711 Appendix I)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@417 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia/include')
-rw-r--r-- | pjmedia/include/pjmedia.h | 1 | ||||
-rw-r--r-- | pjmedia/include/pjmedia/config.h | 10 | ||||
-rw-r--r-- | pjmedia/include/pjmedia/plc.h | 102 |
3 files changed, 113 insertions, 0 deletions
diff --git a/pjmedia/include/pjmedia.h b/pjmedia/include/pjmedia.h index d0728ff5..c0869e9d 100644 --- a/pjmedia/include/pjmedia.h +++ b/pjmedia/include/pjmedia.h @@ -34,6 +34,7 @@ #include <pjmedia/jbuf.h> #include <pjmedia/master_port.h> #include <pjmedia/null_port.h> +#include <pjmedia/plc.h> #include <pjmedia/port.h> #include <pjmedia/resample.h> #include <pjmedia/rtcp.h> diff --git a/pjmedia/include/pjmedia/config.h b/pjmedia/include/pjmedia/config.h index 918ab3ea..980d377f 100644 --- a/pjmedia/include/pjmedia/config.h +++ b/pjmedia/include/pjmedia/config.h @@ -117,6 +117,16 @@ #endif +/** + * G.711 Appendix I Packet Lost Concealment (PLC). + * Enabled only when floating point is enabled. + */ +#ifndef PJMEDIA_HAS_G711_PLC +# define PJMEDIA_HAS_G711_PLC PJ_HAS_FLOATING_POINT +#endif + + + #endif /* __PJMEDIA_CONFIG_H__ */ diff --git a/pjmedia/include/pjmedia/plc.h b/pjmedia/include/pjmedia/plc.h new file mode 100644 index 00000000..e0631c73 --- /dev/null +++ b/pjmedia/include/pjmedia/plc.h @@ -0,0 +1,102 @@ +/* $Id$ */ +/* + * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org> + * + * 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_PLC_H__ +#define __PJMEDIA_PLC_H__ + + +/** + * @file plc.h + * @brief Packet Lost Concealment (PLC) API. + */ +#include <pjmedia/types.h> + +/** + * @defgroup PJMED_PLC Packet Lost Concealment + * @ingroup PJMEDIA + * @{ + * + */ + + +PJ_BEGIN_DECL + + +/** + * Opaque declaration for PLC. + */ +typedef struct pjmedia_plc pjmedia_plc; + + + +/** + * Create PLC session. This function will select the PLC algorithm to + * use based on the arguments. + * + * @param pool Pool to allocate memory for the PLC. + * @param clock_rate Media sampling rate. + * @param samples_per_frame Number of samples per frame. + * @param options Must be zero for now. + * @param p_plc Pointer to receive the PLC instance. + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_plc_create( pj_pool_t *pool, + unsigned clock_rate, + unsigned samples_per_frame, + unsigned options, + pjmedia_plc **p_plc); + + +/** + * Save a good frame to PLC. + * + * @param plc The PLC session. + * @param frame The good frame to be stored to PLC. This frame + * must have the same length as the configured + * samples per frame. + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_plc_save( pjmedia_plc *plc, + pj_int16_t *frame ); + + +/** + * Generate a replacement for lost frame. + * + * @param plc The PLC session. + * @param frame Buffer to receive the generated frame. This buffer + * must be able to store the frame. + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_plc_generate( pjmedia_plc *plc, + pj_int16_t *frame ); + + + + +PJ_END_DECL + +/** + * @} + */ + +#endif /* __PJMEDIA_PLC_H__ */ + |