Changeset 1846
- Timestamp:
- Mar 4, 2008 4:23:42 PM (17 years ago)
- Location:
- pjproject/trunk/pjmedia/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-codec/gsm.c
r1267 r1846 35 35 #if defined(PJMEDIA_HAS_GSM_CODEC) && PJMEDIA_HAS_GSM_CODEC != 0 36 36 37 /* We removed PLC in 0.6 */38 #define PLC_DISABLED 137 /* We removed PLC in 0.6 (and re-enabled it again in 0.9!) */ 38 #define PLC_DISABLED 0 39 39 40 40 -
pjproject/trunk/pjmedia/src/pjmedia/g711.c
r1417 r1846 33 33 #if defined(PJMEDIA_HAS_G711_CODEC) && PJMEDIA_HAS_G711_CODEC!=0 34 34 35 /* We removed PLC in 0.6 */36 #define PLC_DISABLED 135 /* We removed PLC in 0.6 (and re-enabled it again in 0.9!) */ 36 #define PLC_DISABLED 0 37 37 38 38 -
pjproject/trunk/pjmedia/src/pjmedia/plc_common.c
r1266 r1846 19 19 #include <pjmedia/plc.h> 20 20 #include <pjmedia/errno.h> 21 #include <pjmedia/wsola.h> 21 22 #include <pj/assert.h> 22 23 #include <pj/pool.h> … … 24 25 25 26 26 static void* plc_replay_create(pj_pool_t*, unsigned c, unsigned f); 27 static void plc_replay_save(void*, pj_int16_t*); 28 static void plc_replay_generate(void*, pj_int16_t*); 29 30 extern void* pjmedia_plc_steveu_create(pj_pool_t*, unsigned c, unsigned f); 31 extern void pjmedia_plc_steveu_save(void*, pj_int16_t*); 32 extern void pjmedia_plc_steveu_generate(void*, pj_int16_t*); 33 27 static void* plc_wsola_create(pj_pool_t*, unsigned c, unsigned f); 28 static void plc_wsola_save(void*, pj_int16_t*); 29 static void plc_wsola_generate(void*, pj_int16_t*); 34 30 35 31 /** … … 44 40 45 41 46 #if defined(PJMEDIA_HAS_STEVEU_PLC) && PJMEDIA_HAS_STEVEU_PLC!=0 47 static struct plc_alg plc_steveu = 42 static struct plc_alg plc_wsola = 48 43 { 49 &pjmedia_plc_steveu_create, 50 &pjmedia_plc_steveu_save, 51 &pjmedia_plc_steveu_generate 52 }; 53 #endif 54 55 56 static struct plc_alg plc_replay = 57 { 58 &plc_replay_create, 59 &plc_replay_save, 60 &plc_replay_generate 44 &plc_wsola_create, 45 &plc_wsola_save, 46 &plc_wsola_generate 61 47 }; 62 48 … … 89 75 plc = PJ_POOL_ZALLOC_T(pool, pjmedia_plc); 90 76 91 if (0) 92 ; 93 #if defined(PJMEDIA_HAS_STEVEU_PLC) && PJMEDIA_HAS_STEVEU_PLC!=0 94 else if (clock_rate == 8000) 95 plc->op = &plc_steveu; 96 #endif 97 else 98 plc->op = &plc_replay; 99 77 plc->op = &plc_wsola; 100 78 plc->obj = plc->op->plc_create(pool, clock_rate, samples_per_frame); 101 79 … … 134 112 ////////////////////////////////////////////////////////////////////////////// 135 113 /* 136 * Simple replay based plc114 * Packet loss concealment based on WSOLA 137 115 */ 138 struct replay_plc116 struct wsola_plc 139 117 { 140 unsigned size; 141 unsigned replay_cnt; 142 pj_int16_t *frame; 118 pjmedia_wsola *wsola; 119 pj_bool_t prev_lost; 143 120 }; 144 121 145 122 146 static void* plc_ replay_create(pj_pool_t *pool, unsigned clock_rate,147 123 static void* plc_wsola_create(pj_pool_t *pool, unsigned clock_rate, 124 unsigned samples_per_frame) 148 125 { 149 struct replay_plc *o; 126 struct wsola_plc *o; 127 pj_status_t status; 150 128 151 129 PJ_UNUSED_ARG(clock_rate); 152 130 153 o = PJ_POOL_ALLOC_T(pool, struct replay_plc); 154 o->size = samples_per_frame * 2; 155 o->replay_cnt = 0; 156 o->frame = (pj_int16_t*) pj_pool_zalloc(pool, o->size); 131 o = PJ_POOL_ALLOC_T(pool, struct wsola_plc); 132 133 status = pjmedia_wsola_create(pool, clock_rate, samples_per_frame, 1, 134 PJMEDIA_WSOLA_NO_DISCARD, &o->wsola); 135 if (status != PJ_SUCCESS) 136 return NULL; 157 137 158 138 return o; 159 139 } 160 140 161 static void plc_ replay_save(void *plc, pj_int16_t *frame)141 static void plc_wsola_save(void *plc, pj_int16_t *frame) 162 142 { 163 struct replay_plc *o = (struct replay_plc*) plc;143 struct wsola_plc *o = (struct wsola_plc*) plc; 164 144 165 pj _memcpy(o->frame, frame, o->size);166 o-> replay_cnt = 0;145 pjmedia_wsola_save(o->wsola, frame, o->prev_lost); 146 o->prev_lost = PJ_FALSE; 167 147 } 168 148 169 static void plc_ replay_generate(void *plc, pj_int16_t *frame)149 static void plc_wsola_generate(void *plc, pj_int16_t *frame) 170 150 { 171 struct replay_plc *o = (struct replay_plc*) plc; 172 unsigned i, count; 173 pj_int16_t *samp; 174 175 ++o->replay_cnt; 176 177 if (o->replay_cnt < 16) { 178 pj_memcpy(frame, o->frame, o->size); 151 struct wsola_plc *o = (struct wsola_plc*) plc; 179 152 180 181 count = o->size / 2; 182 samp = o->frame; 183 for (i=0; i<count; ++i) 184 samp[i] = (pj_int16_t)(samp[i] >> 1); 185 } else { 186 pj_bzero(frame, o->size); 187 } 153 pjmedia_wsola_generate(o->wsola, frame); 154 o->prev_lost = PJ_TRUE; 188 155 } 189 156 190 157 191
Note: See TracChangeset
for help on using the changeset viewer.